Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: cc/test/layer_tree_test.cc

Issue 1506023008: [NOT LANDED] Revert of cc: Split ThreadProxy into ProxyMain and ProxyImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/test/proxy_impl_for_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/test/layer_tree_test.h" 5 #include "cc/test/layer_tree_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 12 matching lines...) Expand all
23 #include "cc/test/fake_layer_tree_host_client.h" 23 #include "cc/test/fake_layer_tree_host_client.h"
24 #include "cc/test/fake_output_surface.h" 24 #include "cc/test/fake_output_surface.h"
25 #include "cc/test/test_context_provider.h" 25 #include "cc/test/test_context_provider.h"
26 #include "cc/test/test_gpu_memory_buffer_manager.h" 26 #include "cc/test/test_gpu_memory_buffer_manager.h"
27 #include "cc/test/test_shared_bitmap_manager.h" 27 #include "cc/test/test_shared_bitmap_manager.h"
28 #include "cc/test/test_task_graph_runner.h" 28 #include "cc/test/test_task_graph_runner.h"
29 #include "cc/trees/layer_tree_host_client.h" 29 #include "cc/trees/layer_tree_host_client.h"
30 #include "cc/trees/layer_tree_host_impl.h" 30 #include "cc/trees/layer_tree_host_impl.h"
31 #include "cc/trees/layer_tree_host_single_thread_client.h" 31 #include "cc/trees/layer_tree_host_single_thread_client.h"
32 #include "cc/trees/layer_tree_impl.h" 32 #include "cc/trees/layer_tree_impl.h"
33 #include "cc/trees/proxy_impl.h"
34 #include "cc/trees/proxy_main.h"
35 #include "cc/trees/single_thread_proxy.h" 33 #include "cc/trees/single_thread_proxy.h"
36 #include "cc/trees/threaded_channel.h" 34 #include "cc/trees/thread_proxy.h"
37 #include "testing/gmock/include/gmock/gmock.h" 35 #include "testing/gmock/include/gmock/gmock.h"
38 #include "ui/gfx/geometry/size_conversions.h" 36 #include "ui/gfx/geometry/size_conversions.h"
39 37
40 namespace cc { 38 namespace cc {
41 39
42 void CreateVirtualViewportLayers(Layer* root_layer, 40 void CreateVirtualViewportLayers(Layer* root_layer,
43 scoped_refptr<Layer> outer_scroll_layer, 41 scoped_refptr<Layer> outer_scroll_layer,
44 const gfx::Size& inner_bounds, 42 const gfx::Size& inner_bounds,
45 const gfx::Size& outer_bounds, 43 const gfx::Size& outer_bounds,
46 LayerTreeHost* host, 44 LayerTreeHost* host,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 outer_viewport_scroll_layer->SetBounds(scroll_bounds); 86 outer_viewport_scroll_layer->SetBounds(scroll_bounds);
89 outer_viewport_scroll_layer->SetIsDrawable(true); 87 outer_viewport_scroll_layer->SetIsDrawable(true);
90 CreateVirtualViewportLayers(root_layer, 88 CreateVirtualViewportLayers(root_layer,
91 outer_viewport_scroll_layer, 89 outer_viewport_scroll_layer,
92 inner_bounds, 90 inner_bounds,
93 outer_bounds, 91 outer_bounds,
94 host, 92 host,
95 layer_settings); 93 layer_settings);
96 } 94 }
97 95
98 // Creates a SingleThreadProxy that notifies the supplied |test_hooks| of 96 TestHooks::TestHooks() {}
99 // various actions. 97
98 TestHooks::~TestHooks() {}
99
100 DrawResult TestHooks::PrepareToDrawOnThread(
101 LayerTreeHostImpl* host_impl,
102 LayerTreeHostImpl::FrameData* frame_data,
103 DrawResult draw_result) {
104 return draw_result;
105 }
106
107 void TestHooks::CreateResourceAndTileTaskWorkerPool(
108 LayerTreeHostImpl* host_impl,
109 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
110 scoped_ptr<ResourcePool>* resource_pool) {
111 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
112 tile_task_worker_pool, resource_pool);
113 }
114
115 // Adapts ThreadProxy for test. Injects test hooks for testing.
116 class ThreadProxyForTest : public ThreadProxy {
117 public:
118 static scoped_ptr<Proxy> Create(
119 TestHooks* test_hooks,
120 LayerTreeHost* host,
121 TaskRunnerProvider* task_runner_provider,
122 scoped_ptr<BeginFrameSource> external_begin_frame_source) {
123 return make_scoped_ptr(
124 new ThreadProxyForTest(test_hooks, host, task_runner_provider,
125 std::move(external_begin_frame_source)));
126 }
127
128 ~ThreadProxyForTest() override {}
129
130 private:
131 TestHooks* test_hooks_;
132
133 void SetNeedsUpdateLayers() override {
134 ThreadProxy::SetNeedsUpdateLayers();
135 test_hooks_->DidSetNeedsUpdateLayers();
136 }
137
138 void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override {
139 test_hooks_->ScheduledActionWillSendBeginMainFrame();
140 ThreadProxy::ScheduledActionSendBeginMainFrame(args);
141 test_hooks_->ScheduledActionSendBeginMainFrame();
142 }
143
144 DrawResult ScheduledActionDrawAndSwapIfPossible() override {
145 DrawResult result = ThreadProxy::ScheduledActionDrawAndSwapIfPossible();
146 test_hooks_->ScheduledActionDrawAndSwapIfPossible();
147 return result;
148 }
149
150 void ScheduledActionCommit() override {
151 ThreadProxy::ScheduledActionCommit();
152 test_hooks_->ScheduledActionCommit();
153 }
154
155 void ScheduledActionBeginOutputSurfaceCreation() override {
156 ThreadProxy::ScheduledActionBeginOutputSurfaceCreation();
157 test_hooks_->ScheduledActionBeginOutputSurfaceCreation();
158 }
159
160 void ScheduledActionPrepareTiles() override {
161 ThreadProxy::ScheduledActionPrepareTiles();
162 test_hooks_->ScheduledActionPrepareTiles();
163 }
164
165 void ScheduledActionInvalidateOutputSurface() override {
166 ThreadProxy::ScheduledActionInvalidateOutputSurface();
167 test_hooks_->ScheduledActionInvalidateOutputSurface();
168 }
169
170 void SendBeginMainFrameNotExpectedSoon() override {
171 ThreadProxy::SendBeginMainFrameNotExpectedSoon();
172 test_hooks_->SendBeginMainFrameNotExpectedSoon();
173 }
174
175 void DidActivateSyncTree() override {
176 ThreadProxy::DidActivateSyncTree();
177 test_hooks_->DidActivateSyncTree();
178 }
179
180 void SetThrottleFrameProductionOnImpl(bool throttle) override {
181 test_hooks_->SetThrottleFrameProductionOnImpl(throttle);
182 ThreadProxy::SetThrottleFrameProductionOnImpl(throttle);
183 }
184
185 void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface) override {
186 test_hooks_->InitializeOutputSurfaceOnImpl(output_surface);
187 ThreadProxy::InitializeOutputSurfaceOnImpl(output_surface);
188 }
189
190 void MainThreadHasStoppedFlingingOnImpl() override {
191 test_hooks_->MainThreadHasStoppedFlingingOnImpl();
192 ThreadProxy::MainThreadHasStoppedFlingingOnImpl();
193 }
194
195 void SetInputThrottledUntilCommitOnImpl(bool is_throttled) override {
196 test_hooks_->SetInputThrottledUntilCommitOnImpl(is_throttled);
197 ThreadProxy::SetInputThrottledUntilCommitOnImpl(is_throttled);
198 }
199
200 void UpdateTopControlsStateOnImpl(TopControlsState constraints,
201 TopControlsState current,
202 bool animate) override {
203 test_hooks_->UpdateTopControlsStateOnImpl(constraints, current, animate);
204 ThreadProxy::UpdateTopControlsStateOnImpl(constraints, current, animate);
205 }
206
207 void SetDeferCommitsOnImpl(bool defer_commits) const override {
208 test_hooks_->SetDeferCommitsOnImpl(defer_commits);
209 ThreadProxy::SetDeferCommitsOnImpl(defer_commits);
210 }
211
212 void BeginMainFrameAbortedOnImpl(
213 CommitEarlyOutReason reason,
214 base::TimeTicks main_thread_start_time) override {
215 test_hooks_->BeginMainFrameAbortedOnImpl(reason);
216 ThreadProxy::BeginMainFrameAbortedOnImpl(reason, main_thread_start_time);
217 }
218
219 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) override {
220 test_hooks_->SetNeedsRedrawOnImpl(damage_rect);
221 ThreadProxy::SetNeedsRedrawOnImpl(damage_rect);
222 };
223
224 void SetNeedsCommitOnImpl() override {
225 test_hooks_->SetNeedsCommitOnImpl();
226 ThreadProxy::SetNeedsCommitOnImpl();
227 }
228
229 void FinishAllRenderingOnImpl(CompletionEvent* completion) override {
230 test_hooks_->FinishAllRenderingOnImpl();
231 ThreadProxy::FinishAllRenderingOnImpl(completion);
232 };
233
234 void SetVisibleOnImpl(bool visible) override {
235 test_hooks_->SetVisibleOnImpl(visible);
236 ThreadProxy::SetVisibleOnImpl(visible);
237 }
238
239 void ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) override {
240 test_hooks_->ReleaseOutputSurfaceOnImpl();
241 ThreadProxy::ReleaseOutputSurfaceOnImpl(completion);
242 }
243
244 void FinishGLOnImpl(CompletionEvent* completion) override {
245 test_hooks_->FinishGLOnImpl();
246 ThreadProxy::FinishGLOnImpl(completion);
247 }
248
249 void StartCommitOnImpl(CompletionEvent* completion,
250 LayerTreeHost* layer_tree_host,
251 base::TimeTicks main_thread_start_time,
252 bool hold_commit_for_activation) override {
253 test_hooks_->StartCommitOnImpl();
254 ThreadProxy::StartCommitOnImpl(completion, layer_tree_host,
255 main_thread_start_time,
256 hold_commit_for_activation);
257 }
258
259 void InitializeImplOnImpl(CompletionEvent* completion,
260 LayerTreeHost* layer_tree_host) override {
261 ThreadProxy::InitializeImplOnImpl(completion, layer_tree_host);
262 test_hooks_->InitializeImplOnImpl();
263 }
264
265 void LayerTreeHostClosedOnImpl(CompletionEvent* completion) override {
266 test_hooks_->WillCloseLayerTreeHostOnImpl();
267 ThreadProxy::LayerTreeHostClosedOnImpl(completion);
268 }
269
270 void DidCompleteSwapBuffers() override {
271 test_hooks_->ReceivedDidCompleteSwapBuffers();
272 ThreadProxy::DidCompleteSwapBuffers();
273 }
274
275 void SetRendererCapabilitiesMainCopy(
276 const RendererCapabilities& capabilities) override {
277 test_hooks_->ReceivedSetRendererCapabilitiesMainCopy(capabilities);
278 ThreadProxy::SetRendererCapabilitiesMainCopy(capabilities);
279 }
280
281 void BeginMainFrameNotExpectedSoon() override {
282 test_hooks_->ReceivedBeginMainFrameNotExpectedSoon();
283 ThreadProxy::BeginMainFrameNotExpectedSoon();
284 }
285
286 void DidCommitAndDrawFrame() override {
287 test_hooks_->ReceivedDidCommitAndDrawFrame();
288 ThreadProxy::DidCommitAndDrawFrame();
289 }
290
291 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events) override {
292 test_hooks_->ReceivedSetAnimationEvents();
293 ThreadProxy::SetAnimationEvents(std::move(events));
294 }
295
296 void DidLoseOutputSurface() override {
297 test_hooks_->ReceivedDidLoseOutputSurface();
298 ThreadProxy::DidLoseOutputSurface();
299 }
300
301 void RequestNewOutputSurface() override {
302 test_hooks_->ReceivedRequestNewOutputSurface();
303 ThreadProxy::RequestNewOutputSurface();
304 }
305
306 void DidInitializeOutputSurface(
307 bool success,
308 const RendererCapabilities& capabilities) override {
309 test_hooks_->ReceivedDidInitializeOutputSurface(success, capabilities);
310 ThreadProxy::DidInitializeOutputSurface(success, capabilities);
311 }
312
313 void DidCompletePageScaleAnimation() override {
314 test_hooks_->ReceivedDidCompletePageScaleAnimation();
315 ThreadProxy::DidCompletePageScaleAnimation();
316 }
317
318 void PostFrameTimingEventsOnMain(
319 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
320 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events)
321 override {
322 test_hooks_->ReceivedPostFrameTimingEventsOnMain();
323 ThreadProxy::PostFrameTimingEventsOnMain(std::move(composite_events),
324 std::move(main_frame_events));
325 }
326
327 void BeginMainFrame(scoped_ptr<BeginMainFrameAndCommitState>
328 begin_main_frame_state) override {
329 test_hooks_->ReceivedBeginMainFrame();
330 ThreadProxy::BeginMainFrame(std::move(begin_main_frame_state));
331 };
332
333 ThreadProxyForTest(TestHooks* test_hooks,
334 LayerTreeHost* host,
335 TaskRunnerProvider* task_runner_provider,
336 scoped_ptr<BeginFrameSource> external_begin_frame_source)
337 : ThreadProxy(host,
338 task_runner_provider,
339 std::move(external_begin_frame_source)),
340 test_hooks_(test_hooks) {}
341 };
342
343 // Adapts SingleThreadProxy for test. Injects test hooks for testing.
100 class SingleThreadProxyForTest : public SingleThreadProxy { 344 class SingleThreadProxyForTest : public SingleThreadProxy {
101 public: 345 public:
102 static scoped_ptr<Proxy> Create( 346 static scoped_ptr<Proxy> Create(
103 TestHooks* test_hooks, 347 TestHooks* test_hooks,
104 LayerTreeHost* host, 348 LayerTreeHost* host,
105 LayerTreeHostSingleThreadClient* client, 349 LayerTreeHostSingleThreadClient* client,
106 TaskRunnerProvider* task_runner_provider, 350 TaskRunnerProvider* task_runner_provider,
107 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 351 scoped_ptr<BeginFrameSource> external_begin_frame_source) {
108 return make_scoped_ptr(new SingleThreadProxyForTest( 352 return make_scoped_ptr(new SingleThreadProxyForTest(
109 test_hooks, host, client, task_runner_provider, 353 test_hooks, host, client, task_runner_provider,
110 std::move(external_begin_frame_source))); 354 std::move(external_begin_frame_source)));
111 } 355 }
112 356
113 ~SingleThreadProxyForTest() override {} 357 ~SingleThreadProxyForTest() override {}
114 358
115 private: 359 private:
360 TestHooks* test_hooks_;
361
362 void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override {
363 test_hooks_->ScheduledActionWillSendBeginMainFrame();
364 SingleThreadProxy::ScheduledActionSendBeginMainFrame(args);
365 test_hooks_->ScheduledActionSendBeginMainFrame();
366 }
367
368 DrawResult ScheduledActionDrawAndSwapIfPossible() override {
369 DrawResult result =
370 SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible();
371 test_hooks_->ScheduledActionDrawAndSwapIfPossible();
372 return result;
373 }
374
375 void ScheduledActionCommit() override {
376 SingleThreadProxy::ScheduledActionCommit();
377 test_hooks_->ScheduledActionCommit();
378 }
379
380 void ScheduledActionBeginOutputSurfaceCreation() override {
381 SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation();
382 test_hooks_->ScheduledActionBeginOutputSurfaceCreation();
383 }
384
385 void ScheduledActionPrepareTiles() override {
386 SingleThreadProxy::ScheduledActionPrepareTiles();
387 test_hooks_->ScheduledActionPrepareTiles();
388 }
389
390 void ScheduledActionInvalidateOutputSurface() override {
391 SingleThreadProxy::ScheduledActionInvalidateOutputSurface();
392 test_hooks_->ScheduledActionInvalidateOutputSurface();
393 }
394
395 void SendBeginMainFrameNotExpectedSoon() override {
396 SingleThreadProxy::SendBeginMainFrameNotExpectedSoon();
397 test_hooks_->SendBeginMainFrameNotExpectedSoon();
398 }
399
116 SingleThreadProxyForTest( 400 SingleThreadProxyForTest(
117 TestHooks* test_hooks, 401 TestHooks* test_hooks,
118 LayerTreeHost* host, 402 LayerTreeHost* host,
119 LayerTreeHostSingleThreadClient* client, 403 LayerTreeHostSingleThreadClient* client,
120 TaskRunnerProvider* task_runner_provider, 404 TaskRunnerProvider* task_runner_provider,
121 scoped_ptr<BeginFrameSource> external_begin_frame_source) 405 scoped_ptr<BeginFrameSource> external_begin_frame_source)
122 : SingleThreadProxy(host, 406 : SingleThreadProxy(host,
123 client, 407 client,
124 task_runner_provider, 408 task_runner_provider,
125 std::move(external_begin_frame_source)), 409 std::move(external_begin_frame_source)),
126 test_hooks_(test_hooks) {} 410 test_hooks_(test_hooks) {}
127
128 void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override {
129 test_hooks_->ScheduledActionWillSendBeginMainFrame();
130 SingleThreadProxy::ScheduledActionSendBeginMainFrame(args);
131 test_hooks_->ScheduledActionSendBeginMainFrame();
132 }
133
134 DrawResult ScheduledActionDrawAndSwapIfPossible() override {
135 DrawResult result =
136 SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible();
137 test_hooks_->ScheduledActionDrawAndSwapIfPossible();
138 return result;
139 }
140
141 void ScheduledActionCommit() override {
142 SingleThreadProxy::ScheduledActionCommit();
143 test_hooks_->ScheduledActionCommit();
144 }
145
146 void ScheduledActionBeginOutputSurfaceCreation() override {
147 SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation();
148 test_hooks_->ScheduledActionBeginOutputSurfaceCreation();
149 }
150
151 void ScheduledActionPrepareTiles() override {
152 SingleThreadProxy::ScheduledActionPrepareTiles();
153 test_hooks_->ScheduledActionPrepareTiles();
154 }
155
156 void ScheduledActionInvalidateOutputSurface() override {
157 SingleThreadProxy::ScheduledActionInvalidateOutputSurface();
158 test_hooks_->ScheduledActionInvalidateOutputSurface();
159 }
160
161 void SendBeginMainFrameNotExpectedSoon() override {
162 SingleThreadProxy::SendBeginMainFrameNotExpectedSoon();
163 test_hooks_->SendBeginMainFrameNotExpectedSoon();
164 }
165
166 TestHooks* test_hooks_;
167 }; 411 };
168 412
169 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. 413 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks.
170 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { 414 class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
171 public: 415 public:
172 static scoped_ptr<LayerTreeHostImplForTesting> Create( 416 static scoped_ptr<LayerTreeHostImplForTesting> Create(
173 TestHooks* test_hooks, 417 TestHooks* test_hooks,
174 const LayerTreeSettings& settings, 418 const LayerTreeSettings& settings,
175 LayerTreeHostImplClient* host_impl_client, 419 LayerTreeHostImplClient* host_impl_client,
176 TaskRunnerProvider* task_runner_provider, 420 TaskRunnerProvider* task_runner_provider,
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager; 693 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager;
450 params.task_graph_runner = task_graph_runner; 694 params.task_graph_runner = task_graph_runner;
451 params.settings = &settings; 695 params.settings = &settings;
452 scoped_ptr<LayerTreeHostForTesting> layer_tree_host( 696 scoped_ptr<LayerTreeHostForTesting> layer_tree_host(
453 new LayerTreeHostForTesting(test_hooks, &params, mode)); 697 new LayerTreeHostForTesting(test_hooks, &params, mode));
454 scoped_ptr<TaskRunnerProvider> task_runner_provider = 698 scoped_ptr<TaskRunnerProvider> task_runner_provider =
455 TaskRunnerProvider::Create(main_task_runner, impl_task_runner); 699 TaskRunnerProvider::Create(main_task_runner, impl_task_runner);
456 scoped_ptr<Proxy> proxy; 700 scoped_ptr<Proxy> proxy;
457 if (mode == CompositorMode::Threaded) { 701 if (mode == CompositorMode::Threaded) {
458 DCHECK(impl_task_runner.get()); 702 DCHECK(impl_task_runner.get());
459 scoped_ptr<ProxyMain> proxy_main = ProxyMainForTest::CreateThreaded( 703 proxy = ThreadProxyForTest::Create(
460 test_hooks, layer_tree_host.get(), task_runner_provider.get(), 704 test_hooks, layer_tree_host.get(), task_runner_provider.get(),
461 std::move(external_begin_frame_source)); 705 std::move(external_begin_frame_source));
462 proxy = std::move(proxy_main);
463 } else { 706 } else {
464 proxy = SingleThreadProxyForTest::Create( 707 proxy = SingleThreadProxyForTest::Create(
465 test_hooks, layer_tree_host.get(), client, task_runner_provider.get(), 708 test_hooks, layer_tree_host.get(), client, task_runner_provider.get(),
466 std::move(external_begin_frame_source)); 709 std::move(external_begin_frame_source));
467 } 710 }
468 layer_tree_host->InitializeForTesting(std::move(task_runner_provider), 711 layer_tree_host->InitializeForTesting(std::move(task_runner_provider),
469 std::move(proxy)); 712 std::move(proxy));
470 return layer_tree_host; 713 return layer_tree_host;
471 } 714 }
472 715
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 // We check for a null task_runner_provider here as we sometimes ask for the 1154 // We check for a null task_runner_provider here as we sometimes ask for the
912 // layer tree host when the task_runner_provider does not exist, often for 1155 // layer tree host when the task_runner_provider does not exist, often for
913 // checking settings after a test has completed. For example, 1156 // checking settings after a test has completed. For example,
914 // LTHPixelResourceTest::RunPixelResourceTest. See elsewhere in this file for 1157 // LTHPixelResourceTest::RunPixelResourceTest. See elsewhere in this file for
915 // other examples. 1158 // other examples.
916 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread() || 1159 DCHECK(!task_runner_provider() || task_runner_provider()->IsMainThread() ||
917 task_runner_provider()->IsMainThreadBlocked()); 1160 task_runner_provider()->IsMainThreadBlocked());
918 return layer_tree_host_.get(); 1161 return layer_tree_host_.get();
919 } 1162 }
920 1163
921 ProxyMainForTest* LayerTreeTest::GetProxyMainForTest() const {
922 DCHECK(HasImplThread());
923 return static_cast<ProxyMainForTest*>(proxy());
924 }
925
926 ProxyImplForTest* LayerTreeTest::GetProxyImplForTest() const {
927 DCHECK(HasImplThread());
928 ThreadedChannel* threaded_channel =
929 static_cast<ThreadedChannel*>(GetProxyMainForTest()->channel_main());
930 ProxyImpl* proxy_impl = threaded_channel->GetProxyImplForTesting();
931
932 // We check for null ProxyImpl since ProxyImpl exists in the ThreadedChannel
933 // only after it is initialized.
934 DCHECK(proxy_impl);
935 return static_cast<ProxyImplForTest*>(proxy_impl);
936 }
937
938 } // namespace cc 1164 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/test/proxy_impl_for_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698