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_scoped_ui_resource.h" | 27 #include "cc/test/fake_scoped_ui_resource.h" |
28 #include "cc/test/fake_scrollbar.h" | 28 #include "cc/test/fake_scrollbar.h" |
29 #include "cc/test/fake_scrollbar_layer.h" | 29 #include "cc/test/fake_scrollbar_layer.h" |
30 #include "cc/test/fake_video_frame_provider.h" | 30 #include "cc/test/fake_video_frame_provider.h" |
31 #include "cc/test/layer_tree_test.h" | 31 #include "cc/test/layer_tree_test.h" |
32 #include "cc/test/render_pass_test_common.h" | 32 #include "cc/test/render_pass_test_common.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 108 } |
109 | 109 |
110 if (delegating_renderer()) { | 110 if (delegating_renderer()) { |
111 return FakeOutputSurface::CreateDelegating3d( | 111 return FakeOutputSurface::CreateDelegating3d( |
112 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 112 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
113 } | 113 } |
114 return FakeOutputSurface::Create3d( | 114 return FakeOutputSurface::Create3d( |
115 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 115 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
116 } | 116 } |
117 | 117 |
118 scoped_ptr<TestWebGraphicsContext3D> CreateOffscreenContext3d() { | 118 scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext3d() { |
119 if (!context3d_) | 119 if (!context3d_) |
120 return scoped_ptr<TestWebGraphicsContext3D>(); | 120 return scoped_ptr<WebKit::WebGraphicsContext3D>(); |
121 | 121 |
122 ++times_offscreen_created_; | 122 ++times_offscreen_created_; |
123 | 123 |
124 if (times_to_fail_create_offscreen_) { | 124 if (times_to_fail_create_offscreen_) { |
125 --times_to_fail_create_offscreen_; | 125 --times_to_fail_create_offscreen_; |
126 ExpectCreateToFail(); | 126 ExpectCreateToFail(); |
127 return scoped_ptr<TestWebGraphicsContext3D>(); | 127 return scoped_ptr<WebKit::WebGraphicsContext3D>(); |
128 } | 128 } |
129 | 129 |
130 scoped_ptr<TestWebGraphicsContext3D> offscreen_context3d = | 130 scoped_ptr<TestWebGraphicsContext3D> offscreen_context3d = |
131 TestWebGraphicsContext3D::Create().Pass(); | 131 TestWebGraphicsContext3D::Create().Pass(); |
132 DCHECK(offscreen_context3d); | 132 DCHECK(offscreen_context3d); |
133 context3d_->add_share_group_context(offscreen_context3d.get()); | 133 context3d_->add_share_group_context(offscreen_context3d.get()); |
134 | 134 |
135 return offscreen_context3d.Pass(); | 135 return offscreen_context3d.PassAs<WebKit::WebGraphicsContext3D>(); |
136 } | 136 } |
137 | 137 |
138 virtual scoped_refptr<cc::ContextProvider> | 138 virtual scoped_refptr<cc::ContextProvider> |
139 OffscreenContextProviderForMainThread() OVERRIDE { | 139 OffscreenContextProviderForMainThread() OVERRIDE { |
140 DCHECK(!HasImplThread()); | 140 DCHECK(!HasImplThread()); |
141 | 141 |
142 if (!offscreen_contexts_main_thread_.get() || | 142 if (!offscreen_contexts_main_thread_.get() || |
143 offscreen_contexts_main_thread_->DestroyedOnMainThread()) { | 143 offscreen_contexts_main_thread_->DestroyedOnMainThread()) { |
144 offscreen_contexts_main_thread_ = FakeContextProvider::Create( | 144 offscreen_contexts_main_thread_ = FakeContextProvider::Create( |
145 base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d, | 145 base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d, |
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1896 RunTest(true, false, true); | 1896 RunTest(true, false, true); |
1897 } | 1897 } |
1898 | 1898 |
1899 TEST_F(UIResourceLostBeforeActivateTree, | 1899 TEST_F(UIResourceLostBeforeActivateTree, |
1900 RunMultiThread_DelegatingRenderer_ImplSidePaint) { | 1900 RunMultiThread_DelegatingRenderer_ImplSidePaint) { |
1901 RunTest(true, true, true); | 1901 RunTest(true, true, true); |
1902 } | 1902 } |
1903 | 1903 |
1904 } // namespace | 1904 } // namespace |
1905 } // namespace cc | 1905 } // namespace cc |
OLD | NEW |