diff options
author | weiliangc@chromium.org <weiliangc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-12 22:50:51 +0000 |
---|---|---|
committer | weiliangc@chromium.org <weiliangc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-12 22:50:51 +0000 |
commit | f06b05978f9fe04dbf3ca754d8f2f01270690efe (patch) | |
tree | 9388443fb33766d2b4673afad9805ecfcfbae291 | |
parent | a8c699eaad9a0516e81e6e01c2c4554162733636 (diff) | |
download | chromium_src-f06b05978f9fe04dbf3ca754d8f2f01270690efe.zip chromium_src-f06b05978f9fe04dbf3ca754d8f2f01270690efe.tar.gz chromium_src-f06b05978f9fe04dbf3ca754d8f2f01270690efe.tar.bz2 |
Expose default ctor of SQS and remove Create and Copy funciton of SQS
In order to avoid passing around ownership of SQS, expose default ctor,
and remove all function that returns scoped_ptr of SQS, meaning Create
and Copy function. Alternative of Copy function is CopyFrom function
that is called on raw pointer.
This follows 265823015 and 271703003.
BUG=344962
TEST=cc_unittests
Review URL: https://codereview.chromium.org/271683004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269901 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/quads/draw_quad_unittest.cc | 14 | ||||
-rw-r--r-- | cc/quads/render_pass.cc | 4 | ||||
-rw-r--r-- | cc/quads/shared_quad_state.cc | 8 | ||||
-rw-r--r-- | cc/quads/shared_quad_state.h | 6 |
4 files changed, 11 insertions, 21 deletions
diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc index cb11609..c038214 100644 --- a/cc/quads/draw_quad_unittest.cc +++ b/cc/quads/draw_quad_unittest.cc @@ -39,7 +39,7 @@ TEST(DrawQuadTest, CopySharedQuadState) { float opacity = 0.25f; SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; - scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); + scoped_ptr<SharedQuadState> state(new SharedQuadState); state->SetAll(quad_transform, content_bounds, visible_content_rect, @@ -48,7 +48,8 @@ TEST(DrawQuadTest, CopySharedQuadState) { opacity, blend_mode); - scoped_ptr<SharedQuadState> copy(state->Copy()); + scoped_ptr<SharedQuadState> copy(new SharedQuadState); + copy->CopyFrom(state.get()); EXPECT_EQ(quad_transform, copy->content_to_target_transform); EXPECT_RECT_EQ(visible_content_rect, copy->visible_content_rect); EXPECT_EQ(opacity, copy->opacity); @@ -66,7 +67,7 @@ scoped_ptr<SharedQuadState> CreateSharedQuadState() { float opacity = 1.f; SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; - scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); + scoped_ptr<SharedQuadState> state(new SharedQuadState); state->SetAll(quad_transform, content_bounds, visible_content_rect, @@ -88,9 +89,10 @@ void CompareDrawQuad(DrawQuad* quad, EXPECT_EQ(copy_shared_state, copy->shared_quad_state); } -#define CREATE_SHARED_STATE() \ - scoped_ptr<SharedQuadState> shared_state(CreateSharedQuadState()); \ - scoped_ptr<SharedQuadState> copy_shared_state(shared_state->Copy()); \ +#define CREATE_SHARED_STATE() \ + scoped_ptr<SharedQuadState> shared_state(CreateSharedQuadState()); \ + scoped_ptr<SharedQuadState> copy_shared_state(new SharedQuadState); \ + copy_shared_state->CopyFrom(shared_state.get()); #define QUAD_DATA \ gfx::Rect quad_rect(30, 40, 50, 60); \ diff --git a/cc/quads/render_pass.cc b/cc/quads/render_pass.cc index 535cb63..61fcb25 100644 --- a/cc/quads/render_pass.cc +++ b/cc/quads/render_pass.cc @@ -20,7 +20,7 @@ const size_t kDefaultNumQuadsToReserve = 128; namespace cc { void* RenderPass::Id::AsTracingId() const { - COMPILE_ASSERT(sizeof(size_t) <= sizeof(void*), // NOLINT(runtime/sizeof) + COMPILE_ASSERT(sizeof(size_t) <= sizeof(void*), // NOLINT size_t_bigger_than_pointer); return reinterpret_cast<void*>(base::HashPair(layer_id, index)); } @@ -170,7 +170,7 @@ scoped_ptr<base::Value> RenderPass::AsValue() const { } SharedQuadState* RenderPass::CreateAndAppendSharedQuadState() { - shared_quad_state_list.push_back(SharedQuadState::Create()); + shared_quad_state_list.push_back(make_scoped_ptr(new SharedQuadState)); return shared_quad_state_list.back(); } diff --git a/cc/quads/shared_quad_state.cc b/cc/quads/shared_quad_state.cc index 3832886..444d330 100644 --- a/cc/quads/shared_quad_state.cc +++ b/cc/quads/shared_quad_state.cc @@ -19,14 +19,6 @@ SharedQuadState::~SharedQuadState() { "cc::SharedQuadState", this); } -scoped_ptr<SharedQuadState> SharedQuadState::Create() { - return make_scoped_ptr(new SharedQuadState); -} - -scoped_ptr<SharedQuadState> SharedQuadState::Copy() const { - return make_scoped_ptr(new SharedQuadState(*this)); -} - void SharedQuadState::CopyFrom(const SharedQuadState* other) { *this = *other; } diff --git a/cc/quads/shared_quad_state.h b/cc/quads/shared_quad_state.h index cf44381..d0e2afb 100644 --- a/cc/quads/shared_quad_state.h +++ b/cc/quads/shared_quad_state.h @@ -24,10 +24,9 @@ namespace cc { // QuadList. class CC_EXPORT SharedQuadState { public: - static scoped_ptr<SharedQuadState> Create(); + SharedQuadState(); ~SharedQuadState(); - scoped_ptr<SharedQuadState> Copy() const; void CopyFrom(const SharedQuadState* other); void SetAll(const gfx::Transform& content_to_target_transform, @@ -50,9 +49,6 @@ class CC_EXPORT SharedQuadState { bool is_clipped; float opacity; SkXfermode::Mode blend_mode; - - private: - SharedQuadState(); }; } // namespace cc |