| 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/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "cc/debug/fake_context_provider.h" |
| 8 #include "cc/layers/content_layer.h" | 9 #include "cc/layers/content_layer.h" |
| 9 #include "cc/layers/heads_up_display_layer.h" | 10 #include "cc/layers/heads_up_display_layer.h" |
| 10 #include "cc/layers/io_surface_layer.h" | 11 #include "cc/layers/io_surface_layer.h" |
| 11 #include "cc/layers/layer_impl.h" | 12 #include "cc/layers/layer_impl.h" |
| 12 #include "cc/layers/picture_layer.h" | 13 #include "cc/layers/picture_layer.h" |
| 13 #include "cc/layers/scrollbar_layer.h" | 14 #include "cc/layers/scrollbar_layer.h" |
| 14 #include "cc/layers/texture_layer.h" | 15 #include "cc/layers/texture_layer.h" |
| 15 #include "cc/layers/texture_layer_impl.h" | 16 #include "cc/layers/texture_layer_impl.h" |
| 16 #include "cc/layers/video_layer.h" | 17 #include "cc/layers/video_layer.h" |
| 17 #include "cc/layers/video_layer_impl.h" | 18 #include "cc/layers/video_layer_impl.h" |
| 18 #include "cc/output/filter_operations.h" | 19 #include "cc/output/filter_operations.h" |
| 19 #include "cc/test/fake_content_layer.h" | 20 #include "cc/test/fake_content_layer.h" |
| 20 #include "cc/test/fake_content_layer_client.h" | 21 #include "cc/test/fake_content_layer_client.h" |
| 21 #include "cc/test/fake_content_layer_impl.h" | 22 #include "cc/test/fake_content_layer_impl.h" |
| 22 #include "cc/test/fake_context_provider.h" | |
| 23 #include "cc/test/fake_delegated_renderer_layer.h" | 23 #include "cc/test/fake_delegated_renderer_layer.h" |
| 24 #include "cc/test/fake_delegated_renderer_layer_impl.h" | 24 #include "cc/test/fake_delegated_renderer_layer_impl.h" |
| 25 #include "cc/test/fake_layer_tree_host_client.h" | 25 #include "cc/test/fake_layer_tree_host_client.h" |
| 26 #include "cc/test/fake_output_surface.h" | 26 #include "cc/test/fake_output_surface.h" |
| 27 #include "cc/test/fake_scrollbar.h" | 27 #include "cc/test/fake_scrollbar.h" |
| 28 #include "cc/test/fake_scrollbar_layer.h" | 28 #include "cc/test/fake_scrollbar_layer.h" |
| 29 #include "cc/test/fake_video_frame_provider.h" | 29 #include "cc/test/fake_video_frame_provider.h" |
| 30 #include "cc/test/layer_tree_test.h" | 30 #include "cc/test/layer_tree_test.h" |
| 31 #include "cc/test/render_pass_test_common.h" | 31 #include "cc/test/render_pass_test_common.h" |
| 32 #include "cc/test/test_web_graphics_context_3d.h" | 32 #include "cc/test/test_web_graphics_context_3d.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 if (delegating_renderer()) { | 107 if (delegating_renderer()) { |
| 108 return FakeOutputSurface::CreateDelegating3d( | 108 return FakeOutputSurface::CreateDelegating3d( |
| 109 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 109 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
| 110 } | 110 } |
| 111 return FakeOutputSurface::Create3d( | 111 return FakeOutputSurface::Create3d( |
| 112 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 112 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 scoped_ptr<TestWebGraphicsContext3D> CreateOffscreenContext3d() { | 115 scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext3d() { |
| 116 if (!context3d_) | 116 if (!context3d_) |
| 117 return scoped_ptr<TestWebGraphicsContext3D>(); | 117 return scoped_ptr<WebKit::WebGraphicsContext3D>(); |
| 118 | 118 |
| 119 ++times_offscreen_created_; | 119 ++times_offscreen_created_; |
| 120 | 120 |
| 121 if (times_to_fail_create_offscreen_) { | 121 if (times_to_fail_create_offscreen_) { |
| 122 --times_to_fail_create_offscreen_; | 122 --times_to_fail_create_offscreen_; |
| 123 ExpectCreateToFail(); | 123 ExpectCreateToFail(); |
| 124 return scoped_ptr<TestWebGraphicsContext3D>(); | 124 return scoped_ptr<WebKit::WebGraphicsContext3D>(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 scoped_ptr<TestWebGraphicsContext3D> offscreen_context3d = | 127 scoped_ptr<TestWebGraphicsContext3D> offscreen_context3d = |
| 128 TestWebGraphicsContext3D::Create().Pass(); | 128 TestWebGraphicsContext3D::Create().Pass(); |
| 129 DCHECK(offscreen_context3d); | 129 DCHECK(offscreen_context3d); |
| 130 context3d_->add_share_group_context(offscreen_context3d.get()); | 130 context3d_->add_share_group_context(offscreen_context3d.get()); |
| 131 | 131 |
| 132 return offscreen_context3d.Pass(); | 132 return offscreen_context3d.PassAs<WebKit::WebGraphicsContext3D>(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 virtual scoped_refptr<cc::ContextProvider> | 135 virtual scoped_refptr<cc::ContextProvider> |
| 136 OffscreenContextProviderForMainThread() OVERRIDE { | 136 OffscreenContextProviderForMainThread() OVERRIDE { |
| 137 DCHECK(!HasImplThread()); | 137 DCHECK(!HasImplThread()); |
| 138 | 138 |
| 139 if (!offscreen_contexts_main_thread_.get() || | 139 if (!offscreen_contexts_main_thread_.get() || |
| 140 offscreen_contexts_main_thread_->DestroyedOnMainThread()) { | 140 offscreen_contexts_main_thread_->DestroyedOnMainThread()) { |
| 141 offscreen_contexts_main_thread_ = FakeContextProvider::Create( | 141 offscreen_contexts_main_thread_ = FakeContextProvider::Create( |
| 142 base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d, | 142 base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d, |
| (...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 impl_thread ? impl_thread->message_loop_proxy() : NULL); | 1598 impl_thread ? impl_thread->message_loop_proxy() : NULL); |
| 1599 EXPECT_FALSE(layer_tree_host); | 1599 EXPECT_FALSE(layer_tree_host); |
| 1600 } | 1600 } |
| 1601 }; | 1601 }; |
| 1602 | 1602 |
| 1603 SINGLE_AND_MULTI_THREAD_TEST_F( | 1603 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1604 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface); | 1604 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface); |
| 1605 | 1605 |
| 1606 } // namespace | 1606 } // namespace |
| 1607 } // namespace cc | 1607 } // namespace cc |
| OLD | NEW |