| 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 "cc/animation/layer_animation_controller.h" | 7 #include "cc/animation/layer_animation_controller.h" |
| 8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 static void DestroyLayer(LayerPtrType* layer) { layer->reset(); } | 164 static void DestroyLayer(LayerPtrType* layer) { layer->reset(); } |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; | 167 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; |
| 168 | 168 |
| 169 template <typename Types> class OcclusionTrackerTest : public testing::Test { | 169 template <typename Types> class OcclusionTrackerTest : public testing::Test { |
| 170 protected: | 170 protected: |
| 171 explicit OcclusionTrackerTest(bool opaque_layers) | 171 explicit OcclusionTrackerTest(bool opaque_layers) |
| 172 : opaque_layers_(opaque_layers), host_(FakeLayerTreeHost::Create()) {} | 172 : opaque_layers_(opaque_layers), |
| 173 client_(FakeLayerTreeHostClient::DIRECT_3D), |
| 174 host_(FakeLayerTreeHost::Create(&client_)) {} |
| 173 | 175 |
| 174 virtual void RunMyTest() = 0; | 176 virtual void RunMyTest() = 0; |
| 175 | 177 |
| 176 virtual void TearDown() { | 178 virtual void TearDown() { |
| 177 Types::DestroyLayer(&root_); | 179 Types::DestroyLayer(&root_); |
| 178 render_surface_layer_list_.reset(); | 180 render_surface_layer_list_.reset(); |
| 179 render_surface_layer_list_impl_.clear(); | 181 render_surface_layer_list_impl_.clear(); |
| 180 replica_layers_.clear(); | 182 replica_layers_.clear(); |
| 181 mask_layers_.clear(); | 183 mask_layers_.clear(); |
| 182 } | 184 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 void SetMask(Layer* owning_layer, scoped_refptr<Layer> layer) { | 426 void SetMask(Layer* owning_layer, scoped_refptr<Layer> layer) { |
| 425 owning_layer->SetMaskLayer(layer.get()); | 427 owning_layer->SetMaskLayer(layer.get()); |
| 426 mask_layers_.push_back(layer); | 428 mask_layers_.push_back(layer); |
| 427 } | 429 } |
| 428 | 430 |
| 429 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { | 431 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { |
| 430 owning_layer->SetMaskLayer(layer.Pass()); | 432 owning_layer->SetMaskLayer(layer.Pass()); |
| 431 } | 433 } |
| 432 | 434 |
| 433 bool opaque_layers_; | 435 bool opaque_layers_; |
| 436 FakeLayerTreeHostClient client_; |
| 434 scoped_ptr<FakeLayerTreeHost> host_; | 437 scoped_ptr<FakeLayerTreeHost> host_; |
| 435 // These hold ownership of the layers for the duration of the test. | 438 // These hold ownership of the layers for the duration of the test. |
| 436 typename Types::LayerPtrType root_; | 439 typename Types::LayerPtrType root_; |
| 437 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; | 440 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; |
| 438 LayerImplList render_surface_layer_list_impl_; | 441 LayerImplList render_surface_layer_list_impl_; |
| 439 typename Types::TestLayerIterator layer_iterator_begin_; | 442 typename Types::TestLayerIterator layer_iterator_begin_; |
| 440 typename Types::TestLayerIterator layer_iterator_; | 443 typename Types::TestLayerIterator layer_iterator_; |
| 441 typename Types::LayerType* last_layer_visited_; | 444 typename Types::LayerType* last_layer_visited_; |
| 442 LayerList replica_layers_; | 445 LayerList replica_layers_; |
| 443 LayerList mask_layers_; | 446 LayerList mask_layers_; |
| (...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3549 occlusion.occlusion_from_outside_target().ToString()); | 3552 occlusion.occlusion_from_outside_target().ToString()); |
| 3550 EXPECT_EQ(gfx::Rect().ToString(), | 3553 EXPECT_EQ(gfx::Rect().ToString(), |
| 3551 occlusion.occlusion_from_inside_target().ToString()); | 3554 occlusion.occlusion_from_inside_target().ToString()); |
| 3552 } | 3555 } |
| 3553 }; | 3556 }; |
| 3554 | 3557 |
| 3555 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestHiddenCopyRequestDoesNotOcclude) | 3558 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestHiddenCopyRequestDoesNotOcclude) |
| 3556 | 3559 |
| 3557 } // namespace | 3560 } // namespace |
| 3558 } // namespace cc | 3561 } // namespace cc |
| OLD | NEW |