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
3 // found in the LICENSE file.
5 #include "cc/test/layer_tree_test.h"
7 #include "base/command_line.h"
8 #include "cc/animation/animation.h"
9 #include "cc/animation/animation_registrar.h"
10 #include "cc/animation/layer_animation_controller.h"
11 #include "cc/animation/timing_function.h"
12 #include "cc/base/switches.h"
13 #include "cc/input/input_handler.h"
14 #include "cc/layers/content_layer.h"
15 #include "cc/layers/layer.h"
16 #include "cc/layers/layer_impl.h"
17 #include "cc/test/animation_test_common.h"
18 #include "cc/test/fake_layer_tree_host_client.h"
19 #include "cc/test/fake_output_surface.h"
20 #include "cc/test/test_context_provider.h"
21 #include "cc/test/test_shared_bitmap_manager.h"
22 #include "cc/test/tiled_layer_test_common.h"
23 #include "cc/trees/layer_tree_host_client.h"
24 #include "cc/trees/layer_tree_host_impl.h"
25 #include "cc/trees/layer_tree_host_single_thread_client.h"
26 #include "cc/trees/layer_tree_impl.h"
27 #include "cc/trees/single_thread_proxy.h"
28 #include "cc/trees/thread_proxy.h"
29 #include "testing/gmock/include/gmock/gmock.h"
30 #include "ui/gfx/frame_time.h"
31 #include "ui/gfx/size_conversions.h"
35 TestHooks::TestHooks() {}
37 TestHooks::~TestHooks() {}
39 DrawResult
TestHooks::PrepareToDrawOnThread(
40 LayerTreeHostImpl
* host_impl
,
41 LayerTreeHostImpl::FrameData
* frame_data
,
42 DrawResult draw_result
) {
46 base::TimeDelta
TestHooks::LowFrequencyAnimationInterval() const {
47 return base::TimeDelta::FromMilliseconds(16);
50 // Adapts ThreadProxy for test. Injects test hooks for testing.
51 class ThreadProxyForTest
: public ThreadProxy
{
53 static scoped_ptr
<Proxy
> Create(
54 TestHooks
* test_hooks
,
56 scoped_refptr
<base::SingleThreadTaskRunner
> main_task_runner
,
57 scoped_refptr
<base::SingleThreadTaskRunner
> impl_task_runner
) {
58 return make_scoped_ptr(
59 new ThreadProxyForTest(
60 test_hooks
, host
, main_task_runner
, impl_task_runner
))
64 virtual ~ThreadProxyForTest() {}
67 test_hooks_
->Layout();
71 TestHooks
* test_hooks_
;
73 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE
{
74 test_hooks_
->ScheduledActionWillSendBeginMainFrame();
75 ThreadProxy::ScheduledActionSendBeginMainFrame();
76 test_hooks_
->ScheduledActionSendBeginMainFrame();
79 virtual DrawResult
ScheduledActionDrawAndSwapIfPossible() OVERRIDE
{
80 DrawResult result
= ThreadProxy::ScheduledActionDrawAndSwapIfPossible();
81 test_hooks_
->ScheduledActionDrawAndSwapIfPossible();
85 virtual void ScheduledActionAnimate() OVERRIDE
{
86 ThreadProxy::ScheduledActionAnimate();
87 test_hooks_
->ScheduledActionAnimate();
90 virtual void ScheduledActionCommit() OVERRIDE
{
91 ThreadProxy::ScheduledActionCommit();
92 test_hooks_
->ScheduledActionCommit();
95 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE
{
96 ThreadProxy::ScheduledActionBeginOutputSurfaceCreation();
97 test_hooks_
->ScheduledActionBeginOutputSurfaceCreation();
101 TestHooks
* test_hooks
,
103 scoped_refptr
<base::SingleThreadTaskRunner
> main_task_runner
,
104 scoped_refptr
<base::SingleThreadTaskRunner
> impl_task_runner
)
105 : ThreadProxy(host
, main_task_runner
, impl_task_runner
),
106 test_hooks_(test_hooks
) {}
109 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks.
110 class LayerTreeHostImplForTesting
: public LayerTreeHostImpl
{
112 static scoped_ptr
<LayerTreeHostImplForTesting
> Create(
113 TestHooks
* test_hooks
,
114 const LayerTreeSettings
& settings
,
115 LayerTreeHostImplClient
* host_impl_client
,
117 SharedBitmapManager
* manager
,
118 RenderingStatsInstrumentation
* stats_instrumentation
) {
119 return make_scoped_ptr(
120 new LayerTreeHostImplForTesting(test_hooks
,
125 stats_instrumentation
));
129 LayerTreeHostImplForTesting(
130 TestHooks
* test_hooks
,
131 const LayerTreeSettings
& settings
,
132 LayerTreeHostImplClient
* host_impl_client
,
134 SharedBitmapManager
* manager
,
135 RenderingStatsInstrumentation
* stats_instrumentation
)
136 : LayerTreeHostImpl(settings
,
139 stats_instrumentation
,
142 test_hooks_(test_hooks
),
143 block_notify_ready_to_activate_for_testing_(false),
144 notify_ready_to_activate_was_blocked_(false) {}
146 virtual void WillBeginImplFrame(const BeginFrameArgs
& args
) OVERRIDE
{
147 LayerTreeHostImpl::WillBeginImplFrame(args
);
148 test_hooks_
->WillBeginImplFrameOnThread(this, args
);
151 virtual void BeginMainFrameAborted(bool did_handle
) OVERRIDE
{
152 LayerTreeHostImpl::BeginMainFrameAborted(did_handle
);
153 test_hooks_
->BeginMainFrameAbortedOnThread(this, did_handle
);
156 virtual void BeginCommit() OVERRIDE
{
157 LayerTreeHostImpl::BeginCommit();
158 test_hooks_
->BeginCommitOnThread(this);
161 virtual void CommitComplete() OVERRIDE
{
162 LayerTreeHostImpl::CommitComplete();
163 test_hooks_
->CommitCompleteOnThread(this);
166 virtual DrawResult
PrepareToDraw(FrameData
* frame
) OVERRIDE
{
167 DrawResult draw_result
= LayerTreeHostImpl::PrepareToDraw(frame
);
168 return test_hooks_
->PrepareToDrawOnThread(this, frame
, draw_result
);
171 virtual void DrawLayers(FrameData
* frame
,
172 base::TimeTicks frame_begin_time
) OVERRIDE
{
173 LayerTreeHostImpl::DrawLayers(frame
, frame_begin_time
);
174 test_hooks_
->DrawLayersOnThread(this);
177 virtual bool SwapBuffers(const LayerTreeHostImpl::FrameData
& frame
) OVERRIDE
{
178 bool result
= LayerTreeHostImpl::SwapBuffers(frame
);
179 test_hooks_
->SwapBuffersOnThread(this, result
);
183 virtual void DidSwapBuffersComplete() OVERRIDE
{
184 LayerTreeHostImpl::DidSwapBuffersComplete();
185 test_hooks_
->SwapBuffersCompleteOnThread(this);
188 virtual void ReclaimResources(const CompositorFrameAck
* ack
) OVERRIDE
{
189 LayerTreeHostImpl::ReclaimResources(ack
);
192 virtual void UpdateVisibleTiles() OVERRIDE
{
193 LayerTreeHostImpl::UpdateVisibleTiles();
194 test_hooks_
->UpdateVisibleTilesOnThread(this);
197 virtual void NotifyReadyToActivate() OVERRIDE
{
198 if (block_notify_ready_to_activate_for_testing_
)
199 notify_ready_to_activate_was_blocked_
= true;
201 client_
->NotifyReadyToActivate();
204 virtual void BlockNotifyReadyToActivateForTesting(bool block
) OVERRIDE
{
205 block_notify_ready_to_activate_for_testing_
= block
;
206 if (!block
&& notify_ready_to_activate_was_blocked_
) {
207 NotifyReadyToActivate();
208 notify_ready_to_activate_was_blocked_
= false;
212 virtual void ActivateSyncTree() OVERRIDE
{
213 test_hooks_
->WillActivateTreeOnThread(this);
214 LayerTreeHostImpl::ActivateSyncTree();
215 DCHECK(!pending_tree());
216 test_hooks_
->DidActivateTreeOnThread(this);
219 virtual bool InitializeRenderer(scoped_ptr
<OutputSurface
> output_surface
)
221 bool success
= LayerTreeHostImpl::InitializeRenderer(output_surface
.Pass());
222 test_hooks_
->InitializedRendererOnThread(this, success
);
226 virtual void SetVisible(bool visible
) OVERRIDE
{
227 LayerTreeHostImpl::SetVisible(visible
);
228 test_hooks_
->DidSetVisibleOnImplTree(this, visible
);
231 virtual void AnimateLayers(base::TimeTicks monotonic_time
) OVERRIDE
{
232 test_hooks_
->WillAnimateLayers(this, monotonic_time
);
233 LayerTreeHostImpl::AnimateLayers(monotonic_time
);
234 test_hooks_
->AnimateLayers(this, monotonic_time
);
237 virtual void UpdateAnimationState(bool start_ready_animations
) OVERRIDE
{
238 LayerTreeHostImpl::UpdateAnimationState(start_ready_animations
);
239 bool has_unfinished_animation
= false;
240 AnimationRegistrar::AnimationControllerMap::const_iterator iter
=
241 active_animation_controllers().begin();
242 for (; iter
!= active_animation_controllers().end(); ++iter
) {
243 if (iter
->second
->HasActiveAnimation()) {
244 has_unfinished_animation
= true;
248 test_hooks_
->UpdateAnimationState(this, has_unfinished_animation
);
251 virtual base::TimeDelta
LowFrequencyAnimationInterval() const OVERRIDE
{
252 return test_hooks_
->LowFrequencyAnimationInterval();
256 TestHooks
* test_hooks_
;
257 bool block_notify_ready_to_activate_for_testing_
;
258 bool notify_ready_to_activate_was_blocked_
;
261 // Implementation of LayerTreeHost callback interface.
262 class LayerTreeHostClientForTesting
: public LayerTreeHostClient
,
263 public LayerTreeHostSingleThreadClient
{
265 static scoped_ptr
<LayerTreeHostClientForTesting
> Create(
266 TestHooks
* test_hooks
) {
267 return make_scoped_ptr(new LayerTreeHostClientForTesting(test_hooks
));
269 virtual ~LayerTreeHostClientForTesting() {}
271 virtual void WillBeginMainFrame(int frame_id
) OVERRIDE
{
272 test_hooks_
->WillBeginMainFrame();
275 virtual void DidBeginMainFrame() OVERRIDE
{
276 test_hooks_
->DidBeginMainFrame();
279 virtual void BeginMainFrame(const BeginFrameArgs
& args
) OVERRIDE
{
280 test_hooks_
->BeginMainFrame(args
);
283 virtual void Layout() OVERRIDE
{ test_hooks_
->Layout(); }
285 virtual void ApplyViewportDeltas(const gfx::Vector2d
& scroll_delta
,
287 float top_controls_delta
) OVERRIDE
{
288 test_hooks_
->ApplyViewportDeltas(scroll_delta
,
293 virtual scoped_ptr
<OutputSurface
> CreateOutputSurface(bool fallback
)
295 return test_hooks_
->CreateOutputSurface(fallback
);
298 virtual void DidInitializeOutputSurface() OVERRIDE
{
299 test_hooks_
->DidInitializeOutputSurface();
302 virtual void DidFailToInitializeOutputSurface() OVERRIDE
{
303 test_hooks_
->DidFailToInitializeOutputSurface();
306 virtual void WillCommit() OVERRIDE
{ test_hooks_
->WillCommit(); }
308 virtual void DidCommit() OVERRIDE
{ test_hooks_
->DidCommit(); }
310 virtual void DidCommitAndDrawFrame() OVERRIDE
{
311 test_hooks_
->DidCommitAndDrawFrame();
314 virtual void DidCompleteSwapBuffers() OVERRIDE
{
315 test_hooks_
->DidCompleteSwapBuffers();
318 virtual void DidPostSwapBuffers() OVERRIDE
{}
319 virtual void DidAbortSwapBuffers() OVERRIDE
{}
322 explicit LayerTreeHostClientForTesting(TestHooks
* test_hooks
)
323 : test_hooks_(test_hooks
) {}
325 TestHooks
* test_hooks_
;
328 // Adapts LayerTreeHost for test. Injects LayerTreeHostImplForTesting.
329 class LayerTreeHostForTesting
: public LayerTreeHost
{
331 static scoped_ptr
<LayerTreeHostForTesting
> Create(
332 TestHooks
* test_hooks
,
333 LayerTreeHostClientForTesting
* client
,
334 const LayerTreeSettings
& settings
,
335 scoped_refptr
<base::SingleThreadTaskRunner
> main_task_runner
,
336 scoped_refptr
<base::SingleThreadTaskRunner
> impl_task_runner
) {
337 scoped_ptr
<LayerTreeHostForTesting
> layer_tree_host(
338 new LayerTreeHostForTesting(test_hooks
, client
, settings
));
339 if (impl_task_runner
.get()) {
340 layer_tree_host
->InitializeForTesting(
341 ThreadProxyForTest::Create(test_hooks
,
342 layer_tree_host
.get(),
346 layer_tree_host
->InitializeForTesting(SingleThreadProxy::Create(
347 layer_tree_host
.get(), client
, main_task_runner
));
349 return layer_tree_host
.Pass();
352 virtual scoped_ptr
<LayerTreeHostImpl
> CreateLayerTreeHostImpl(
353 LayerTreeHostImplClient
* host_impl_client
) OVERRIDE
{
354 return LayerTreeHostImplForTesting::Create(
359 shared_bitmap_manager_
.get(),
360 rendering_stats_instrumentation()).PassAs
<LayerTreeHostImpl
>();
363 virtual void SetNeedsCommit() OVERRIDE
{
366 LayerTreeHost::SetNeedsCommit();
369 void set_test_started(bool started
) { test_started_
= started
; }
371 virtual void DidDeferCommit() OVERRIDE
{ test_hooks_
->DidDeferCommit(); }
374 LayerTreeHostForTesting(TestHooks
* test_hooks
,
375 LayerTreeHostClient
* client
,
376 const LayerTreeSettings
& settings
)
377 : LayerTreeHost(client
, NULL
, settings
),
378 shared_bitmap_manager_(new TestSharedBitmapManager()),
379 test_hooks_(test_hooks
),
380 test_started_(false) {}
382 scoped_ptr
<SharedBitmapManager
> shared_bitmap_manager_
;
383 TestHooks
* test_hooks_
;
387 LayerTreeTest::LayerTreeTest()
389 end_when_begin_returns_(false),
394 delegating_renderer_(false),
396 weak_factory_(this) {
397 main_thread_weak_ptr_
= weak_factory_
.GetWeakPtr();
399 // Tests should timeout quickly unless --cc-layer-tree-test-no-timeout was
400 // specified (for running in a debugger).
401 CommandLine
* command_line
= CommandLine::ForCurrentProcess();
402 if (!command_line
->HasSwitch(switches::kCCLayerTreeTestNoTimeout
))
403 timeout_seconds_
= 5;
406 LayerTreeTest::~LayerTreeTest() {}
408 void LayerTreeTest::EndTest() {
413 // For the case where we EndTest during BeginTest(), set a flag to indicate
414 // that the test should end the second BeginTest regains control.
416 end_when_begin_returns_
= true;
418 main_task_runner_
->PostTask(
420 base::Bind(&LayerTreeTest::RealEndTest
, main_thread_weak_ptr_
));
424 void LayerTreeTest::EndTestAfterDelay(int delay_milliseconds
) {
425 main_task_runner_
->PostDelayedTask(
427 base::Bind(&LayerTreeTest::EndTest
, main_thread_weak_ptr_
),
428 base::TimeDelta::FromMilliseconds(delay_milliseconds
));
431 void LayerTreeTest::PostAddAnimationToMainThread(
432 Layer
* layer_to_receive_animation
) {
433 main_task_runner_
->PostTask(
435 base::Bind(&LayerTreeTest::DispatchAddAnimation
,
436 main_thread_weak_ptr_
,
437 base::Unretained(layer_to_receive_animation
),
441 void LayerTreeTest::PostAddInstantAnimationToMainThread(
442 Layer
* layer_to_receive_animation
) {
443 main_task_runner_
->PostTask(
445 base::Bind(&LayerTreeTest::DispatchAddAnimation
,
446 main_thread_weak_ptr_
,
447 base::Unretained(layer_to_receive_animation
),
451 void LayerTreeTest::PostAddLongAnimationToMainThread(
452 Layer
* layer_to_receive_animation
) {
453 main_task_runner_
->PostTask(
455 base::Bind(&LayerTreeTest::DispatchAddAnimation
,
456 main_thread_weak_ptr_
,
457 base::Unretained(layer_to_receive_animation
),
461 void LayerTreeTest::PostSetNeedsCommitToMainThread() {
462 main_task_runner_
->PostTask(FROM_HERE
,
463 base::Bind(&LayerTreeTest::DispatchSetNeedsCommit
,
464 main_thread_weak_ptr_
));
467 void LayerTreeTest::PostSetNeedsUpdateLayersToMainThread() {
468 main_task_runner_
->PostTask(
470 base::Bind(&LayerTreeTest::DispatchSetNeedsUpdateLayers
,
471 main_thread_weak_ptr_
));
474 void LayerTreeTest::PostSetNeedsRedrawToMainThread() {
475 main_task_runner_
->PostTask(FROM_HERE
,
476 base::Bind(&LayerTreeTest::DispatchSetNeedsRedraw
,
477 main_thread_weak_ptr_
));
480 void LayerTreeTest::PostSetNeedsRedrawRectToMainThread(
481 const gfx::Rect
& damage_rect
) {
482 main_task_runner_
->PostTask(
484 base::Bind(&LayerTreeTest::DispatchSetNeedsRedrawRect
,
485 main_thread_weak_ptr_
,
489 void LayerTreeTest::PostSetVisibleToMainThread(bool visible
) {
490 main_task_runner_
->PostTask(
493 &LayerTreeTest::DispatchSetVisible
, main_thread_weak_ptr_
, visible
));
496 void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() {
497 main_task_runner_
->PostTask(
499 base::Bind(&LayerTreeTest::DispatchSetNextCommitForcesRedraw
,
500 main_thread_weak_ptr_
));
503 void LayerTreeTest::WillBeginTest() {
504 layer_tree_host_
->SetLayerTreeHostClientReady();
507 void LayerTreeTest::DoBeginTest() {
508 client_
= LayerTreeHostClientForTesting::Create(this);
510 DCHECK(!impl_thread_
|| impl_thread_
->message_loop_proxy().get());
511 layer_tree_host_
= LayerTreeHostForTesting::Create(
515 base::MessageLoopProxy::current(),
516 impl_thread_
? impl_thread_
->message_loop_proxy() : NULL
);
517 ASSERT_TRUE(layer_tree_host_
);
525 if (end_when_begin_returns_
)
528 // Allow commits to happen once BeginTest() has had a chance to post tasks
529 // so that those tasks will happen before the first commit.
530 if (layer_tree_host_
) {
531 static_cast<LayerTreeHostForTesting
*>(layer_tree_host_
.get())
532 ->set_test_started(true);
536 void LayerTreeTest::SetupTree() {
537 if (!layer_tree_host_
->root_layer()) {
538 scoped_refptr
<Layer
> root_layer
= Layer::Create();
539 root_layer
->SetBounds(gfx::Size(1, 1));
540 root_layer
->SetIsDrawable(true);
541 layer_tree_host_
->SetRootLayer(root_layer
);
544 gfx::Size root_bounds
= layer_tree_host_
->root_layer()->bounds();
545 gfx::Size device_root_bounds
= gfx::ToCeiledSize(
546 gfx::ScaleSize(root_bounds
, layer_tree_host_
->device_scale_factor()));
547 layer_tree_host_
->SetViewportSize(device_root_bounds
);
550 void LayerTreeTest::Timeout() {
555 void LayerTreeTest::RealEndTest() {
556 if (layer_tree_host_
&& !timed_out_
&&
557 proxy()->MainFrameWillHappenForTesting()) {
558 main_task_runner_
->PostTask(
560 base::Bind(&LayerTreeTest::RealEndTest
, main_thread_weak_ptr_
));
564 base::MessageLoop::current()->Quit();
567 void LayerTreeTest::DispatchAddAnimation(Layer
* layer_to_receive_animation
,
568 double animation_duration
) {
569 DCHECK(!proxy() || proxy()->IsMainThread());
571 if (layer_to_receive_animation
) {
572 AddOpacityTransitionToLayer(
573 layer_to_receive_animation
, animation_duration
, 0, 0.5, true);
577 void LayerTreeTest::DispatchSetNeedsCommit() {
578 DCHECK(!proxy() || proxy()->IsMainThread());
580 if (layer_tree_host_
)
581 layer_tree_host_
->SetNeedsCommit();
584 void LayerTreeTest::DispatchSetNeedsUpdateLayers() {
585 DCHECK(!proxy() || proxy()->IsMainThread());
587 if (layer_tree_host_
)
588 layer_tree_host_
->SetNeedsUpdateLayers();
591 void LayerTreeTest::DispatchSetNeedsRedraw() {
592 DCHECK(!proxy() || proxy()->IsMainThread());
594 if (layer_tree_host_
)
595 layer_tree_host_
->SetNeedsRedraw();
598 void LayerTreeTest::DispatchSetNeedsRedrawRect(const gfx::Rect
& damage_rect
) {
599 DCHECK(!proxy() || proxy()->IsMainThread());
601 if (layer_tree_host_
)
602 layer_tree_host_
->SetNeedsRedrawRect(damage_rect
);
605 void LayerTreeTest::DispatchSetVisible(bool visible
) {
606 DCHECK(!proxy() || proxy()->IsMainThread());
607 if (layer_tree_host_
)
608 layer_tree_host_
->SetVisible(visible
);
611 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() {
612 DCHECK(!proxy() || proxy()->IsMainThread());
614 if (layer_tree_host_
)
615 layer_tree_host_
->SetNextCommitForcesRedraw();
618 void LayerTreeTest::RunTest(bool threaded
,
619 bool delegating_renderer
,
620 bool impl_side_painting
) {
622 impl_thread_
.reset(new base::Thread("Compositor"));
623 ASSERT_TRUE(impl_thread_
->Start());
626 main_task_runner_
= base::MessageLoopProxy::current();
628 delegating_renderer_
= delegating_renderer
;
630 // Spend less time waiting for BeginFrame because the output is
632 settings_
.refresh_rate
= 200.0;
633 if (impl_side_painting
) {
635 << "Don't run single thread + impl side painting, it doesn't exist.";
636 settings_
.impl_side_painting
= true;
638 InitializeSettings(&settings_
);
640 main_task_runner_
->PostTask(
642 base::Bind(&LayerTreeTest::DoBeginTest
, base::Unretained(this)));
644 if (timeout_seconds_
) {
645 timeout_
.Reset(base::Bind(&LayerTreeTest::Timeout
, base::Unretained(this)));
646 main_task_runner_
->PostDelayedTask(
649 base::TimeDelta::FromSeconds(timeout_seconds_
));
652 base::MessageLoop::current()->Run();
653 DestroyLayerTreeHost();
657 ASSERT_FALSE(layer_tree_host_
.get());
660 FAIL() << "Test timed out";
666 void LayerTreeTest::RunTestWithImplSidePainting() {
667 RunTest(true, false, true);
670 scoped_ptr
<OutputSurface
> LayerTreeTest::CreateOutputSurface(bool fallback
) {
671 scoped_ptr
<FakeOutputSurface
> output_surface
=
672 CreateFakeOutputSurface(fallback
);
673 if (output_surface
) {
674 DCHECK_EQ(delegating_renderer_
,
675 output_surface
->capabilities().delegated_rendering
);
677 output_surface_
= output_surface
.get();
678 return output_surface
.PassAs
<OutputSurface
>();
681 scoped_ptr
<FakeOutputSurface
> LayerTreeTest::CreateFakeOutputSurface(
683 if (delegating_renderer_
)
684 return FakeOutputSurface::CreateDelegating3d();
686 return FakeOutputSurface::Create3d();
689 TestWebGraphicsContext3D
* LayerTreeTest::TestContext() {
690 return static_cast<TestContextProvider
*>(output_surface_
->context_provider())
694 int LayerTreeTest::LastCommittedSourceFrameNumber(LayerTreeHostImpl
* impl
)
696 if (impl
->pending_tree())
697 return impl
->pending_tree()->source_frame_number();
698 if (impl
->active_tree())
699 return impl
->active_tree()->source_frame_number();
700 // Source frames start at 0, so this is invalid.
704 void LayerTreeTest::DestroyLayerTreeHost() {
705 if (layer_tree_host_
&& layer_tree_host_
->root_layer())
706 layer_tree_host_
->root_layer()->SetLayerTreeHost(NULL
);
707 layer_tree_host_
.reset();