| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/layers/delegated_renderer_layer.h" | 8 #include "cc/layers/delegated_renderer_layer.h" |
| 9 #include "cc/layers/delegated_renderer_layer_client.h" | 9 #include "cc/layers/delegated_renderer_layer_client.h" |
| 10 #include "cc/layers/delegated_renderer_layer_impl.h" | 10 #include "cc/layers/delegated_renderer_layer_impl.h" |
| 11 #include "cc/output/compositor_frame.h" | 11 #include "cc/output/compositor_frame.h" |
| 12 #include "cc/output/compositor_frame_ack.h" | 12 #include "cc/output/compositor_frame_ack.h" |
| 13 #include "cc/output/delegated_frame_data.h" | 13 #include "cc/output/delegated_frame_data.h" |
| 14 #include "cc/quads/shared_quad_state.h" | 14 #include "cc/quads/shared_quad_state.h" |
| 15 #include "cc/quads/texture_draw_quad.h" | 15 #include "cc/quads/texture_draw_quad.h" |
| 16 #include "cc/test/fake_delegated_renderer_layer.h" | 16 #include "cc/test/fake_delegated_renderer_layer.h" |
| 17 #include "cc/test/fake_delegated_renderer_layer_impl.h" | 17 #include "cc/test/fake_delegated_renderer_layer_impl.h" |
| 18 #include "cc/test/fake_output_surface.h" | 18 #include "cc/test/fake_output_surface.h" |
| 19 #include "cc/test/layer_tree_test.h" | 19 #include "cc/test/layer_tree_test.h" |
| 20 #include "cc/trees/layer_tree_impl.h" | 20 #include "cc/trees/layer_tree_impl.h" |
| 21 #include "gpu/GLES2/gl2extchromium.h" | 21 #include "gpu/GLES2/gl2extchromium.h" |
| 22 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 22 | 23 |
| 23 namespace cc { | 24 namespace cc { |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 // These tests deal with delegated renderer layers. | 27 // These tests deal with delegated renderer layers. |
| 27 class LayerTreeHostDelegatedTest : public LayerTreeTest { | 28 class LayerTreeHostDelegatedTest : public LayerTreeTest { |
| 28 protected: | 29 protected: |
| 29 scoped_ptr<DelegatedFrameData> CreateFrameData(gfx::Rect root_output_rect, | 30 scoped_ptr<DelegatedFrameData> CreateFrameData(gfx::Rect root_output_rect, |
| 30 gfx::Rect root_damage_rect) { | 31 gfx::Rect root_damage_rect) { |
| 31 scoped_ptr<DelegatedFrameData> frame(new DelegatedFrameData); | 32 scoped_ptr<DelegatedFrameData> frame(new DelegatedFrameData); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 return; | 240 return; |
| 240 delegated_->SetFrameData(CreateFrameData(gfx::Rect(0, 0, 1, 1), | 241 delegated_->SetFrameData(CreateFrameData(gfx::Rect(0, 0, 1, 1), |
| 241 gfx::Rect(0, 0, 1, 1))); | 242 gfx::Rect(0, 0, 1, 1))); |
| 242 } | 243 } |
| 243 | 244 |
| 244 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 245 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 245 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); | 246 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); |
| 246 FakeDelegatedRendererLayerImpl* delegated_impl = | 247 FakeDelegatedRendererLayerImpl* delegated_impl = |
| 247 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); | 248 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); |
| 248 | 249 |
| 249 WebKit::WebGraphicsContext3D* context = | 250 ContextProvider* context_provider = |
| 250 host_impl->resource_provider()->GraphicsContext3D(); | 251 host_impl->output_surface()->context_provider(); |
| 251 | 252 |
| 252 ++num_activates_; | 253 ++num_activates_; |
| 253 switch (num_activates_) { | 254 switch (num_activates_) { |
| 254 case 2: | 255 case 2: |
| 255 EXPECT_TRUE(delegated_impl->ChildId()); | 256 EXPECT_TRUE(delegated_impl->ChildId()); |
| 256 EXPECT_FALSE(did_reset_child_id_); | 257 EXPECT_FALSE(did_reset_child_id_); |
| 257 | 258 |
| 258 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 259 context_provider->Context3d()->loseContextCHROMIUM( |
| 259 GL_INNOCENT_CONTEXT_RESET_ARB); | 260 GL_GUILTY_CONTEXT_RESET_ARB, |
| 261 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 260 break; | 262 break; |
| 261 case 3: | 263 case 3: |
| 262 EXPECT_TRUE(delegated_impl->ChildId()); | 264 EXPECT_TRUE(delegated_impl->ChildId()); |
| 263 EXPECT_TRUE(did_reset_child_id_); | 265 EXPECT_TRUE(did_reset_child_id_); |
| 264 EndTest(); | 266 EndTest(); |
| 265 break; | 267 break; |
| 266 } | 268 } |
| 267 } | 269 } |
| 268 | 270 |
| 269 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 271 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 } | 1468 } |
| 1467 } | 1469 } |
| 1468 | 1470 |
| 1469 virtual void AfterTest() OVERRIDE {} | 1471 virtual void AfterTest() OVERRIDE {} |
| 1470 }; | 1472 }; |
| 1471 | 1473 |
| 1472 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake); | 1474 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake); |
| 1473 | 1475 |
| 1474 } // namespace | 1476 } // namespace |
| 1475 } // namespace cc | 1477 } // namespace cc |
| OLD | NEW |