Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 | 98 |
| 99 TestContentLayerImpl* CreateRoot(const gfx::Transform& transform, | 99 TestContentLayerImpl* CreateRoot(const gfx::Transform& transform, |
| 100 const gfx::PointF& position, | 100 const gfx::PointF& position, |
| 101 const gfx::Size& bounds) { | 101 const gfx::Size& bounds) { |
| 102 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 102 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
| 103 int id = next_layer_impl_id_++; | 103 int id = next_layer_impl_id_++; |
| 104 scoped_ptr<TestContentLayerImpl> layer(new TestContentLayerImpl(tree, id)); | 104 scoped_ptr<TestContentLayerImpl> layer(new TestContentLayerImpl(tree, id)); |
| 105 TestContentLayerImpl* layer_ptr = layer.get(); | 105 TestContentLayerImpl* layer_ptr = layer.get(); |
| 106 SetProperties(layer_ptr, transform, position, bounds); | 106 SetProperties(layer_ptr, transform, position, bounds); |
| 107 | 107 |
| 108 host_->host_impl()->active_tree()->SetRootLayer(std::move(layer)); | 108 root_ = layer.get(); |
|
ajuma
2016/03/24 15:12:00
Are the changes in this file needed? In particular
sunxd
2016/03/29 14:26:34
Done.
| |
| 109 | 109 |
| 110 layer_ptr->SetForceRenderSurface(true); | 110 layer_ptr->SetForceRenderSurface(true); |
| 111 SetRootLayerOnMainThread(layer_ptr); | 111 SetRootLayerOnMainThread(layer_ptr); |
| 112 tree->SetRootLayer(std::move(layer)); | |
| 112 | 113 |
| 113 return layer_ptr; | 114 return layer_ptr; |
| 114 } | 115 } |
| 115 | 116 |
| 116 LayerImpl* CreateLayer(LayerImpl* parent, | 117 LayerImpl* CreateLayer(LayerImpl* parent, |
| 117 const gfx::Transform& transform, | 118 const gfx::Transform& transform, |
| 118 const gfx::PointF& position, | 119 const gfx::PointF& position, |
| 119 const gfx::Size& bounds) { | 120 const gfx::Size& bounds) { |
| 120 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 121 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
| 121 int id = next_layer_impl_id_++; | 122 int id = next_layer_impl_id_++; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 } | 212 } |
| 212 | 213 |
| 213 void AddCopyRequest(LayerImpl* layer) { | 214 void AddCopyRequest(LayerImpl* layer) { |
| 214 std::vector<scoped_ptr<CopyOutputRequest>> requests; | 215 std::vector<scoped_ptr<CopyOutputRequest>> requests; |
| 215 requests.push_back(CopyOutputRequest::CreateBitmapRequest(base::Bind( | 216 requests.push_back(CopyOutputRequest::CreateBitmapRequest(base::Bind( |
| 216 &OcclusionTrackerTest::CopyOutputCallback, base::Unretained(this)))); | 217 &OcclusionTrackerTest::CopyOutputCallback, base::Unretained(this)))); |
| 217 layer->PassCopyRequests(&requests); | 218 layer->PassCopyRequests(&requests); |
| 218 } | 219 } |
| 219 | 220 |
| 220 void CalcDrawEtc(TestContentLayerImpl* root) { | 221 void CalcDrawEtc(TestContentLayerImpl* root) { |
| 221 DCHECK(root == root->layer_tree_impl()->root_layer()); | 222 DCHECK(root == root_); |
| 222 | 223 |
| 223 // These occlusion tests attach and detach layers in multiple | 224 // These occlusion tests attach and detach layers in multiple |
| 224 // iterations, so rebuild property trees every time. | 225 // iterations, so rebuild property trees every time. |
| 225 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 226 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 226 | 227 |
| 227 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root); | 228 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root); |
| 228 | 229 |
| 229 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); | 230 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); |
| 230 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 231 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 231 root, root->bounds(), &render_surface_layer_list_impl_, | 232 root, root->bounds(), &render_surface_layer_list_impl_, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 | 304 |
| 304 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { | 305 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { |
| 305 owning_layer->SetMaskLayer(std::move(layer)); | 306 owning_layer->SetMaskLayer(std::move(layer)); |
| 306 } | 307 } |
| 307 | 308 |
| 308 bool opaque_layers_; | 309 bool opaque_layers_; |
| 309 FakeLayerTreeHostClient client_; | 310 FakeLayerTreeHostClient client_; |
| 310 TestTaskGraphRunner task_graph_runner_; | 311 TestTaskGraphRunner task_graph_runner_; |
| 311 scoped_ptr<FakeLayerTreeHost> host_; | 312 scoped_ptr<FakeLayerTreeHost> host_; |
| 312 // These hold ownership of the layers for the duration of the test. | 313 // These hold ownership of the layers for the duration of the test. |
| 314 LayerImpl* root_; | |
| 313 LayerImplList render_surface_layer_list_impl_; | 315 LayerImplList render_surface_layer_list_impl_; |
| 314 LayerIterator layer_iterator_begin_; | 316 LayerIterator layer_iterator_begin_; |
| 315 LayerIterator layer_iterator_; | 317 LayerIterator layer_iterator_; |
| 316 LayerList replica_layers_; | 318 LayerList replica_layers_; |
| 317 LayerList mask_layers_; | 319 LayerList mask_layers_; |
| 318 int next_layer_impl_id_; | 320 int next_layer_impl_id_; |
| 319 }; | 321 }; |
| 320 | 322 |
| 321 #define RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ | 323 #define RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 322 class ClassName##ImplThreadOpaqueLayers : public ClassName { \ | 324 class ClassName##ImplThreadOpaqueLayers : public ClassName { \ |
| (...skipping 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2511 EXPECT_EQ(gfx::Rect(), | 2513 EXPECT_EQ(gfx::Rect(), |
| 2512 occlusion.UnoccludedSurfaceContentRect( | 2514 occlusion.UnoccludedSurfaceContentRect( |
| 2513 surface, gfx::Rect(80, 70, 50, 50))); | 2515 surface, gfx::Rect(80, 70, 50, 50))); |
| 2514 } | 2516 } |
| 2515 }; | 2517 }; |
| 2516 | 2518 |
| 2517 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 2519 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
| 2518 | 2520 |
| 2519 } // namespace | 2521 } // namespace |
| 2520 } // namespace cc | 2522 } // namespace cc |
| OLD | NEW |