From c6707fdbb7ab92a3ded2f6f18542bc77770e9cfc Mon Sep 17 00:00:00 2001 From: "weiliangc@chromium.org" Date: Mon, 23 Jun 2014 05:50:36 +0000 Subject: Removed QuadSink and MockQuadCuller Since QuadSink does not provide more functionatility than passing through to RenderPass and OcclusionTracker, it can be torn down and removed. Same is for MockQuadCuller. This CL follows 302603006, 306683002, 309493002. BUG=344962 TEST=cc_unittests Review URL: https://codereview.chromium.org/308193003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279050 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/test/fake_picture_layer_impl.cc | 9 ++++-- cc/test/fake_picture_layer_impl.h | 3 +- cc/test/layer_test_common.cc | 28 ++++++++++-------- cc/test/layer_test_common.h | 6 ++-- cc/test/mock_occlusion_tracker.h | 3 ++ cc/test/mock_quad_culler.cc | 33 ---------------------- cc/test/mock_quad_culler.h | 58 -------------------------------------- cc/test/render_pass_test_utils.cc | 1 - 8 files changed, 30 insertions(+), 111 deletions(-) delete mode 100644 cc/test/mock_quad_culler.cc delete mode 100644 cc/test/mock_quad_culler.h (limited to 'cc/test') diff --git a/cc/test/fake_picture_layer_impl.cc b/cc/test/fake_picture_layer_impl.cc index 8514bc3..3e92bd5 100644 --- a/cc/test/fake_picture_layer_impl.cc +++ b/cc/test/fake_picture_layer_impl.cc @@ -41,9 +41,12 @@ scoped_ptr FakePictureLayerImpl::CreateLayerImpl( new FakePictureLayerImpl(tree_impl, id())).PassAs(); } -void FakePictureLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { - PictureLayerImpl::AppendQuads(quad_sink, append_quads_data); +void FakePictureLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker& occlusion_tracker, + AppendQuadsData* append_quads_data) { + PictureLayerImpl::AppendQuads( + render_pass, occlusion_tracker, append_quads_data); ++append_quads_count_; } diff --git a/cc/test/fake_picture_layer_impl.h b/cc/test/fake_picture_layer_impl.h index 04661c4..14310c7 100644 --- a/cc/test/fake_picture_layer_impl.h +++ b/cc/test/fake_picture_layer_impl.h @@ -35,7 +35,8 @@ class FakePictureLayerImpl : public PictureLayerImpl { virtual scoped_ptr CreateLayerImpl(LayerTreeImpl* tree_impl) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; virtual gfx::Size CalculateTileSize( const gfx::Size& content_bounds) const OVERRIDE; diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc index 4daca5d..7a0de16 100644 --- a/cc/test/layer_test_common.cc +++ b/cc/test/layer_test_common.cc @@ -10,6 +10,7 @@ #include "cc/quads/draw_quad.h" #include "cc/quads/render_pass.h" #include "cc/test/fake_output_surface.h" +#include "cc/test/mock_occlusion_tracker.h" #include "cc/trees/layer_tree_host_common.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/point_conversions.h" @@ -102,9 +103,7 @@ void LayerTestCommon::VerifyQuadsCoverRectWithOcclusion( LayerTestCommon::LayerImplTest::LayerImplTest() : host_(FakeLayerTreeHost::Create()), root_layer_impl_(LayerImpl::Create(host_->host_impl()->active_tree(), 1)), - render_pass_(RenderPass::Create()), - quad_culler_(make_scoped_ptr( - new MockQuadCuller(render_pass_.get(), &occlusion_tracker_))) { + render_pass_(RenderPass::Create()) { scoped_ptr output_surface = FakeOutputSurface::Create3d(); host_->host_impl()->InitializeRenderer( output_surface.PassAs()); @@ -125,10 +124,11 @@ void LayerTestCommon::LayerImplTest::AppendQuadsWithOcclusion( const gfx::Rect& occluded) { AppendQuadsData data; - quad_culler_->clear_lists(); - quad_culler_->set_occluded_target_rect(occluded); + render_pass_->quad_list.clear(); + render_pass_->shared_quad_state_list.clear(); + occlusion_tracker_.set_occluded_target_rect(occluded); layer_impl->WillDraw(DRAW_MODE_HARDWARE, resource_provider()); - layer_impl->AppendQuads(quad_culler_.get(), &data); + layer_impl->AppendQuads(render_pass_.get(), occlusion_tracker_, &data); layer_impl->DidDraw(resource_provider()); } @@ -138,10 +138,11 @@ void LayerTestCommon::LayerImplTest::AppendQuadsForPassWithOcclusion( const gfx::Rect& occluded) { AppendQuadsData data(id); - quad_culler_->clear_lists(); - quad_culler_->set_occluded_target_rect(occluded); + render_pass_->quad_list.clear(); + render_pass_->shared_quad_state_list.clear(); + occlusion_tracker_.set_occluded_target_rect(occluded); layer_impl->WillDraw(DRAW_MODE_HARDWARE, resource_provider()); - layer_impl->AppendQuads(quad_culler_.get(), &data); + layer_impl->AppendQuads(render_pass_.get(), occlusion_tracker_, &data); layer_impl->DidDraw(resource_provider()); } @@ -150,11 +151,14 @@ void LayerTestCommon::LayerImplTest::AppendSurfaceQuadsWithOcclusion( const gfx::Rect& occluded) { AppendQuadsData data; - quad_culler_->clear_lists(); - quad_culler_->set_occluded_target_rect_for_contributing_surface(occluded); + render_pass_->quad_list.clear(); + render_pass_->shared_quad_state_list.clear(); + occlusion_tracker_.set_occluded_target_rect_for_contributing_surface( + occluded); bool for_replica = false; RenderPass::Id id(1, 1); - surface_impl->AppendQuads(quad_culler_.get(), &data, for_replica, id); + surface_impl->AppendQuads( + render_pass_.get(), occlusion_tracker_, &data, for_replica, id); } } // namespace cc diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h index d3f2ab3..3b967ec 100644 --- a/cc/test/layer_test_common.h +++ b/cc/test/layer_test_common.h @@ -7,8 +7,9 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" +#include "cc/quads/render_pass.h" #include "cc/test/fake_layer_tree_host.h" -#include "cc/test/mock_quad_culler.h" +#include "cc/test/mock_occlusion_tracker.h" #include "cc/trees/layer_tree_host_impl.h" #define EXPECT_SET_NEEDS_COMMIT(expect, code_to_test) \ @@ -113,14 +114,13 @@ class LayerTestCommon { LayerImpl* root_layer() const { return root_layer_impl_.get(); } FakeLayerTreeHostImpl* host_impl() const { return host_->host_impl(); } Proxy* proxy() const { return host_->host_impl()->proxy(); } - const QuadList& quad_list() const { return quad_culler_->quad_list(); } + const QuadList& quad_list() const { return render_pass_->quad_list; } private: scoped_ptr host_; scoped_ptr root_layer_impl_; scoped_ptr render_pass_; MockOcclusionTracker occlusion_tracker_; - scoped_ptr quad_culler_; }; }; diff --git a/cc/test/mock_occlusion_tracker.h b/cc/test/mock_occlusion_tracker.h index 6a88bce..649eb76 100644 --- a/cc/test/mock_occlusion_tracker.h +++ b/cc/test/mock_occlusion_tracker.h @@ -41,6 +41,9 @@ class MockOcclusionTracker : public OcclusionTracker { LayerType>::stack_[OcclusionTracker::stack_.size() - 2] .occlusion_from_inside_target = occluded; } + + private: + DISALLOW_COPY_AND_ASSIGN(MockOcclusionTracker); }; } // namespace cc diff --git a/cc/test/mock_quad_culler.cc b/cc/test/mock_quad_culler.cc deleted file mode 100644 index e1b140b..0000000 --- a/cc/test/mock_quad_culler.cc +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/test/mock_quad_culler.h" - -namespace cc { - -MockQuadCuller::MockQuadCuller( - RenderPass* render_pass, - MockOcclusionTracker* occlusion_tracker) - : QuadSink(render_pass, occlusion_tracker), - occlusion_tracker_(occlusion_tracker) { -} - -MockQuadCuller::~MockQuadCuller() {} - -gfx::Rect MockQuadCuller::UnoccludedContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform) { - return occlusion_tracker_->UnoccludedContentRect(content_rect, - draw_transform); -} - -gfx::Rect MockQuadCuller::UnoccludedContributingSurfaceContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform) { - return occlusion_tracker_->UnoccludedContributingSurfaceContentRect( - content_rect, draw_transform); -} - -} // namespace cc - diff --git a/cc/test/mock_quad_culler.h b/cc/test/mock_quad_culler.h deleted file mode 100644 index ca2f0aa..0000000 --- a/cc/test/mock_quad_culler.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_TEST_MOCK_QUAD_CULLER_H_ -#define CC_TEST_MOCK_QUAD_CULLER_H_ - -#include "base/memory/scoped_ptr.h" -#include "cc/layers/quad_sink.h" -#include "cc/quads/draw_quad.h" -#include "cc/quads/render_pass.h" -#include "cc/test/mock_occlusion_tracker.h" - -namespace cc { -class LayerImpl; - -class MockQuadCuller : public QuadSink { - public: - virtual ~MockQuadCuller(); - - MockQuadCuller(RenderPass* render_pass, - MockOcclusionTracker* occlusion_tracker); - - virtual gfx::Rect UnoccludedContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform) OVERRIDE; - - virtual gfx::Rect UnoccludedContributingSurfaceContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform) OVERRIDE; - - const QuadList& quad_list() const { return render_pass_->quad_list; } - const SharedQuadStateList& shared_quad_state_list() const { - return render_pass_->shared_quad_state_list; - } - - void set_occluded_target_rect(const gfx::Rect& occluded) { - occlusion_tracker_->set_occluded_target_rect(occluded); - } - - void set_occluded_target_rect_for_contributing_surface( - const gfx::Rect& occluded) { - occlusion_tracker_->set_occluded_target_rect_for_contributing_surface( - occluded); - } - - void clear_lists() { - render_pass_->quad_list.clear(); - render_pass_->shared_quad_state_list.clear(); - } - - private: - MockOcclusionTracker* occlusion_tracker_; -}; - -} // namespace cc - -#endif // CC_TEST_MOCK_QUAD_CULLER_H_ diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc index 7ea3a7a..5e85298 100644 --- a/cc/test/render_pass_test_utils.cc +++ b/cc/test/render_pass_test_utils.cc @@ -4,7 +4,6 @@ #include "cc/test/render_pass_test_utils.h" -#include "cc/layers/quad_sink.h" #include "cc/quads/render_pass_draw_quad.h" #include "cc/quads/shared_quad_state.h" #include "cc/quads/solid_color_draw_quad.h" -- cgit v1.1