| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "cc/layers/layer_iterator.h" | 8 #include "cc/layers/layer_iterator.h" |
| 9 #include "cc/layers/solid_color_layer_impl.h" | 9 #include "cc/layers/solid_color_layer_impl.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl_client.h" | 10 #include "cc/test/fake_layer_tree_host_impl_client.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 FakeProxy proxy_; | 64 FakeProxy proxy_; |
| 65 DebugScopedSetImplThread impl_; | 65 DebugScopedSetImplThread impl_; |
| 66 FakeRenderingStatsInstrumentation stats_; | 66 FakeRenderingStatsInstrumentation stats_; |
| 67 scoped_ptr<LayerTreeHostImpl> host_impl_; | 67 scoped_ptr<LayerTreeHostImpl> host_impl_; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) { | 70 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) { |
| 71 SetTestName("unoccluded_content_rect_fully_occluded"); | 71 SetTestName("unoccluded_content_rect_fully_occluded"); |
| 72 | 72 |
| 73 gfx::Rect viewport_rect(768, 1038); | 73 gfx::Rect viewport_rect(768, 1038); |
| 74 OcclusionTrackerBase<LayerImpl, LayerImpl::RenderSurfaceType> tracker( | 74 OcclusionTracker<LayerImpl> tracker(viewport_rect, false); |
| 75 viewport_rect, false); | |
| 76 | 75 |
| 77 CreateHost(); | 76 CreateHost(); |
| 78 host_impl_->SetViewportSize(viewport_rect.size()); | 77 host_impl_->SetViewportSize(viewport_rect.size()); |
| 79 | 78 |
| 80 scoped_ptr<SolidColorLayerImpl> opaque_layer = | 79 scoped_ptr<SolidColorLayerImpl> opaque_layer = |
| 81 SolidColorLayerImpl::Create(active_tree(), 2); | 80 SolidColorLayerImpl::Create(active_tree(), 2); |
| 82 opaque_layer->SetBackgroundColor(SK_ColorRED); | 81 opaque_layer->SetBackgroundColor(SK_ColorRED); |
| 83 opaque_layer->SetContentsOpaque(true); | 82 opaque_layer->SetContentsOpaque(true); |
| 84 opaque_layer->SetDrawsContent(true); | 83 opaque_layer->SetDrawsContent(true); |
| 85 opaque_layer->SetBounds(viewport_rect.size()); | 84 opaque_layer->SetBounds(viewport_rect.size()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 EXPECT_EQ(end, begin); | 132 EXPECT_EQ(end, begin); |
| 134 | 133 |
| 135 PrintResults(); | 134 PrintResults(); |
| 136 } | 135 } |
| 137 | 136 |
| 138 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_10OpaqueLayers) { | 137 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_10OpaqueLayers) { |
| 139 static const int kNumOpaqueLayers = 10; | 138 static const int kNumOpaqueLayers = 10; |
| 140 SetTestName("unoccluded_content_rect_10_opaque_layers"); | 139 SetTestName("unoccluded_content_rect_10_opaque_layers"); |
| 141 | 140 |
| 142 gfx::Rect viewport_rect(768, 1038); | 141 gfx::Rect viewport_rect(768, 1038); |
| 143 OcclusionTrackerBase<LayerImpl, LayerImpl::RenderSurfaceType> tracker( | 142 OcclusionTracker<LayerImpl> tracker(viewport_rect, false); |
| 144 viewport_rect, false); | |
| 145 | 143 |
| 146 CreateHost(); | 144 CreateHost(); |
| 147 host_impl_->SetViewportSize(viewport_rect.size()); | 145 host_impl_->SetViewportSize(viewport_rect.size()); |
| 148 | 146 |
| 149 for (int i = 0; i < kNumOpaqueLayers; ++i) { | 147 for (int i = 0; i < kNumOpaqueLayers; ++i) { |
| 150 scoped_ptr<SolidColorLayerImpl> opaque_layer = | 148 scoped_ptr<SolidColorLayerImpl> opaque_layer = |
| 151 SolidColorLayerImpl::Create(active_tree(), 2 + i); | 149 SolidColorLayerImpl::Create(active_tree(), 2 + i); |
| 152 opaque_layer->SetBackgroundColor(SK_ColorRED); | 150 opaque_layer->SetBackgroundColor(SK_ColorRED); |
| 153 opaque_layer->SetContentsOpaque(true); | 151 opaque_layer->SetContentsOpaque(true); |
| 154 opaque_layer->SetDrawsContent(true); | 152 opaque_layer->SetDrawsContent(true); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); | 202 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); |
| 205 | 203 |
| 206 ++begin; | 204 ++begin; |
| 207 EXPECT_EQ(end, begin); | 205 EXPECT_EQ(end, begin); |
| 208 | 206 |
| 209 PrintResults(); | 207 PrintResults(); |
| 210 } | 208 } |
| 211 | 209 |
| 212 } // namespace | 210 } // namespace |
| 213 } // namespace cc | 211 } // namespace cc |
| OLD | NEW |