OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3078 } | 3078 } |
3079 | 3079 |
3080 void DeferredInitializeAndRedraw(LayerTreeHostImpl* host_impl) { | 3080 void DeferredInitializeAndRedraw(LayerTreeHostImpl* host_impl) { |
3081 EXPECT_FALSE(did_initialize_gl_); | 3081 EXPECT_FALSE(did_initialize_gl_); |
3082 // SetAndInitializeContext3D calls SetNeedsCommit. | 3082 // SetAndInitializeContext3D calls SetNeedsCommit. |
3083 FakeOutputSurface* fake_output_surface = | 3083 FakeOutputSurface* fake_output_surface = |
3084 static_cast<FakeOutputSurface*>(host_impl->output_surface()); | 3084 static_cast<FakeOutputSurface*>(host_impl->output_surface()); |
3085 scoped_refptr<TestContextProvider> context_provider = | 3085 scoped_refptr<TestContextProvider> context_provider = |
3086 TestContextProvider::Create(); // Not bound to thread. | 3086 TestContextProvider::Create(); // Not bound to thread. |
3087 EXPECT_TRUE( | 3087 EXPECT_TRUE( |
3088 fake_output_surface->InitializeAndSetContext3d(context_provider, NULL)); | 3088 fake_output_surface->InitializeAndSetContext3d(context_provider)); |
3089 did_initialize_gl_ = true; | 3089 did_initialize_gl_ = true; |
3090 } | 3090 } |
3091 | 3091 |
3092 void ReleaseGLAndRedraw(LayerTreeHostImpl* host_impl) { | 3092 void ReleaseGLAndRedraw(LayerTreeHostImpl* host_impl) { |
3093 EXPECT_TRUE(did_initialize_gl_); | 3093 EXPECT_TRUE(did_initialize_gl_); |
3094 EXPECT_FALSE(did_release_gl_); | 3094 EXPECT_FALSE(did_release_gl_); |
3095 // ReleaseGL calls SetNeedsCommit. | 3095 // ReleaseGL calls SetNeedsCommit. |
3096 static_cast<FakeOutputSurface*>(host_impl->output_surface())->ReleaseGL(); | 3096 static_cast<FakeOutputSurface*>(host_impl->output_surface())->ReleaseGL(); |
3097 did_release_gl_ = true; | 3097 did_release_gl_ = true; |
3098 } | 3098 } |
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4601 } | 4601 } |
4602 | 4602 |
4603 virtual void AfterTest() OVERRIDE {} | 4603 virtual void AfterTest() OVERRIDE {} |
4604 | 4604 |
4605 private: | 4605 private: |
4606 int num_commits_; | 4606 int num_commits_; |
4607 }; | 4607 }; |
4608 | 4608 |
4609 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostTestMemoryLimits); | 4609 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostTestMemoryLimits); |
4610 | 4610 |
4611 class LayerSetsNeedsFilterContext : public Layer { | |
4612 public: | |
4613 static scoped_refptr<LayerSetsNeedsFilterContext> Create() { | |
4614 return make_scoped_refptr(new LayerSetsNeedsFilterContext()); | |
4615 } | |
4616 | |
4617 virtual bool Update(ResourceUpdateQueue* queue, | |
4618 const OcclusionTracker<Layer>* occlusion) OVERRIDE { | |
4619 bool updated = Layer::Update(queue, occlusion); | |
4620 if (needs_context_) { | |
4621 layer_tree_host()->set_needs_filter_context(); | |
4622 return true; | |
4623 } | |
4624 return updated; | |
4625 } | |
4626 | |
4627 void set_needs_context(bool need) { needs_context_ = need; } | |
4628 | |
4629 private: | |
4630 LayerSetsNeedsFilterContext() : needs_context_(false) {} | |
4631 virtual ~LayerSetsNeedsFilterContext() {} | |
4632 | |
4633 bool needs_context_; | |
4634 }; | |
4635 | |
4636 class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest { | 4611 class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest { |
4637 protected: | 4612 protected: |
4638 virtual void SetupTree() OVERRIDE { | 4613 virtual void SetupTree() OVERRIDE { |
4639 LayerTreeHostTest::SetupTree(); | 4614 LayerTreeHostTest::SetupTree(); |
4640 root_layer_ = FakeContentLayer::Create(&client_); | 4615 root_layer_ = FakeContentLayer::Create(&client_); |
4641 root_layer_->SetBounds(gfx::Size(10, 10)); | 4616 root_layer_->SetBounds(gfx::Size(10, 10)); |
4642 root_layer_->SetIsDrawable(false); | 4617 root_layer_->SetIsDrawable(false); |
4643 root_layer_->SetHaveWheelEventHandlers(true); | 4618 root_layer_->SetHaveWheelEventHandlers(true); |
4644 layer_tree_host()->SetRootLayer(root_layer_); | 4619 layer_tree_host()->SetRootLayer(root_layer_); |
4645 LayerTreeHostTest::SetupTree(); | 4620 LayerTreeHostTest::SetupTree(); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5174 const gfx::Size bounds_; | 5149 const gfx::Size bounds_; |
5175 FakeContentLayerClient client_; | 5150 FakeContentLayerClient client_; |
5176 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5151 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
5177 scoped_refptr<FakePictureLayer> picture_layer_; | 5152 scoped_refptr<FakePictureLayer> picture_layer_; |
5178 Layer* child_layer_; | 5153 Layer* child_layer_; |
5179 }; | 5154 }; |
5180 | 5155 |
5181 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5156 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
5182 | 5157 |
5183 } // namespace cc | 5158 } // namespace cc |
OLD | NEW |