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

Side by Side Diff: cc/trees/single_thread_proxy.cc

Issue 344743002: Make Android CompositorImpl use scheduled SingleThreadProxy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 | Annotate | Revision Log
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/trees/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 DCHECK(layer_tree_host); 42 DCHECK(layer_tree_host);
43 43
44 // Impl-side painting not supported without threaded compositing. 44 // Impl-side painting not supported without threaded compositing.
45 CHECK(!layer_tree_host->settings().impl_side_painting) 45 CHECK(!layer_tree_host->settings().impl_side_painting)
46 << "Threaded compositing must be enabled to use impl-side painting."; 46 << "Threaded compositing must be enabled to use impl-side painting.";
47 } 47 }
48 48
49 void SingleThreadProxy::Start() { 49 void SingleThreadProxy::Start() {
50 DebugScopedSetImplThread impl(this); 50 DebugScopedSetImplThread impl(this);
51 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); 51 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
52
53 SchedulerSettings scheduler_settings(layer_tree_host_->settings());
54 scheduler_on_impl_thread_ = Scheduler::Create(
55 this, scheduler_settings, layer_tree_host_->id(), MainThreadTaskRunner());
56 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
52 } 57 }
53 58
54 SingleThreadProxy::~SingleThreadProxy() { 59 SingleThreadProxy::~SingleThreadProxy() {
55 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); 60 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy");
56 DCHECK(Proxy::IsMainThread()); 61 DCHECK(Proxy::IsMainThread());
57 // Make sure Stop() got called or never Started. 62 // Make sure Stop() got called or never Started.
58 DCHECK(!layer_tree_host_impl_); 63 DCHECK(!layer_tree_host_impl_);
59 } 64 }
60 65
61 void SingleThreadProxy::FinishAllRendering() { 66 void SingleThreadProxy::FinishAllRendering() {
62 TRACE_EVENT0("cc", "SingleThreadProxy::FinishAllRendering"); 67 TRACE_EVENT0("cc", "SingleThreadProxy::FinishAllRendering");
63 DCHECK(Proxy::IsMainThread()); 68 DCHECK(Proxy::IsMainThread());
64 { 69 {
65 DebugScopedSetImplThread impl(this); 70 DebugScopedSetImplThread impl(this);
66 layer_tree_host_impl_->FinishAllRendering(); 71 layer_tree_host_impl_->FinishAllRendering();
67 } 72 }
68 } 73 }
69 74
70 bool SingleThreadProxy::IsStarted() const { 75 bool SingleThreadProxy::IsStarted() const {
71 DCHECK(Proxy::IsMainThread()); 76 DCHECK(Proxy::IsMainThread());
72 return layer_tree_host_impl_; 77 return layer_tree_host_impl_;
73 } 78 }
74 79
75 void SingleThreadProxy::SetLayerTreeHostClientReady() { 80 void SingleThreadProxy::SetLayerTreeHostClientReady() {
76 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady"); 81 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady");
77 // Scheduling is controlled by the embedder in the single thread case, so 82 // Scheduling is controlled by the embedder in the single thread case, so
78 // nothing to do. 83 // nothing to do.
79 DCHECK(Proxy::IsMainThread()); 84 DCHECK(Proxy::IsMainThread());
80 DebugScopedSetImplThread impl(this); 85 DebugScopedSetImplThread impl(this);
81 if (layer_tree_host_->settings().single_thread_proxy_scheduler && 86 scheduler_on_impl_thread_->SetCanStart();
82 !scheduler_on_impl_thread_) {
83 SchedulerSettings scheduler_settings(layer_tree_host_->settings());
84 scheduler_on_impl_thread_ = Scheduler::Create(this,
85 scheduler_settings,
86 layer_tree_host_->id(),
87 MainThreadTaskRunner());
88 scheduler_on_impl_thread_->SetCanStart();
89 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
90 }
91 } 87 }
92 88
93 void SingleThreadProxy::SetVisible(bool visible) { 89 void SingleThreadProxy::SetVisible(bool visible) {
94 TRACE_EVENT0("cc", "SingleThreadProxy::SetVisible"); 90 TRACE_EVENT0("cc", "SingleThreadProxy::SetVisible");
95 DebugScopedSetImplThread impl(this); 91 DebugScopedSetImplThread impl(this);
96 layer_tree_host_impl_->SetVisible(visible); 92 layer_tree_host_impl_->SetVisible(visible);
97 // Changing visibility could change ShouldComposite(). 93 // Changing visibility could change ShouldComposite().
98 UpdateBackgroundAnimateTicking(); 94 UpdateBackgroundAnimateTicking();
99 if (scheduler_on_impl_thread_) 95 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
100 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
101 } 96 }
102 97
103 void SingleThreadProxy::CreateAndInitializeOutputSurface() { 98 void SingleThreadProxy::CreateAndInitializeOutputSurface() {
104 TRACE_EVENT0( 99 TRACE_EVENT0(
105 "cc", "SingleThreadProxy::CreateAndInitializeOutputSurface"); 100 "cc", "SingleThreadProxy::CreateAndInitializeOutputSurface");
106 DCHECK(Proxy::IsMainThread()); 101 DCHECK(Proxy::IsMainThread());
107 DCHECK(layer_tree_host_->output_surface_lost()); 102 DCHECK(layer_tree_host_->output_surface_lost());
108 103
109 scoped_ptr<OutputSurface> output_surface = 104 scoped_ptr<OutputSurface> output_surface =
110 layer_tree_host_->CreateOutputSurface(); 105 layer_tree_host_->CreateOutputSurface();
111 106
112 renderer_capabilities_for_main_thread_ = RendererCapabilities(); 107 renderer_capabilities_for_main_thread_ = RendererCapabilities();
113 108
114 bool success = !!output_surface; 109 bool success = !!output_surface;
115 if (success) { 110 if (success) {
116 DebugScopedSetMainThreadBlocked main_thread_blocked(this); 111 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
117 DebugScopedSetImplThread impl(this); 112 DebugScopedSetImplThread impl(this);
118 layer_tree_host_->DeleteContentsTexturesOnImplThread( 113 layer_tree_host_->DeleteContentsTexturesOnImplThread(
119 layer_tree_host_impl_->resource_provider()); 114 layer_tree_host_impl_->resource_provider());
120 success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); 115 success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass());
121 } 116 }
122 117
123 layer_tree_host_->OnCreateAndInitializeOutputSurfaceAttempted(success); 118 layer_tree_host_->OnCreateAndInitializeOutputSurfaceAttempted(success);
124 119
125 if (success) { 120 if (success) {
126 if (scheduler_on_impl_thread_) 121 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface();
127 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface();
128 } else if (Proxy::MainThreadTaskRunner()) { 122 } else if (Proxy::MainThreadTaskRunner()) {
129 Proxy::MainThreadTaskRunner()->PostTask( 123 Proxy::MainThreadTaskRunner()->PostTask(
130 FROM_HERE, 124 FROM_HERE,
131 base::Bind(&SingleThreadProxy::CreateAndInitializeOutputSurface, 125 base::Bind(&SingleThreadProxy::CreateAndInitializeOutputSurface,
132 weak_factory_.GetWeakPtr())); 126 weak_factory_.GetWeakPtr()));
133 } 127 }
134 } 128 }
135 129
136 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { 130 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const {
137 DCHECK(Proxy::IsMainThread()); 131 DCHECK(Proxy::IsMainThread());
138 DCHECK(!layer_tree_host_->output_surface_lost()); 132 DCHECK(!layer_tree_host_->output_surface_lost());
139 return renderer_capabilities_for_main_thread_; 133 return renderer_capabilities_for_main_thread_;
140 } 134 }
141 135
142 void SingleThreadProxy::SetNeedsAnimate() { 136 void SingleThreadProxy::SetNeedsAnimate() {
143 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate"); 137 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate");
144 DCHECK(Proxy::IsMainThread()); 138 DCHECK(Proxy::IsMainThread());
145 client_->ScheduleAnimation();
146 SetNeedsCommit(); 139 SetNeedsCommit();
brianderson 2014/06/24 23:50:12 Until we have commit-less updates, we'll should in
147 } 140 }
148 141
149 void SingleThreadProxy::SetNeedsUpdateLayers() { 142 void SingleThreadProxy::SetNeedsUpdateLayers() {
150 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers"); 143 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers");
151 DCHECK(Proxy::IsMainThread()); 144 DCHECK(Proxy::IsMainThread());
152 client_->ScheduleComposite();
153 SetNeedsCommit(); 145 SetNeedsCommit();
154 } 146 }
155 147
156 void SingleThreadProxy::DoCommit(base::TimeTicks frame_begin_time) { 148 void SingleThreadProxy::DoCommit(base::TimeTicks frame_begin_time) {
157 TRACE_EVENT0("cc", "SingleThreadProxy::DoCommit"); 149 TRACE_EVENT0("cc", "SingleThreadProxy::DoCommit");
158 DCHECK(Proxy::IsMainThread()); 150 DCHECK(Proxy::IsMainThread());
159 layer_tree_host_->WillBeginMainFrame(); 151 layer_tree_host_->WillBeginMainFrame();
160 layer_tree_host_->Layout(); 152 layer_tree_host_->Layout();
161 layer_tree_host_->AnimateLayers(frame_begin_time); 153 layer_tree_host_->AnimateLayers(frame_begin_time);
162 154
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 layer_tree_host_->CommitComplete(); 221 layer_tree_host_->CommitComplete();
230 layer_tree_host_->DidBeginMainFrame(); 222 layer_tree_host_->DidBeginMainFrame();
231 timing_history_.DidCommit(); 223 timing_history_.DidCommit();
232 224
233 next_frame_is_newly_committed_frame_ = true; 225 next_frame_is_newly_committed_frame_ = true;
234 } 226 }
235 227
236 void SingleThreadProxy::SetNeedsCommit() { 228 void SingleThreadProxy::SetNeedsCommit() {
237 DCHECK(Proxy::IsMainThread()); 229 DCHECK(Proxy::IsMainThread());
238 DebugScopedSetImplThread impl(this); 230 DebugScopedSetImplThread impl(this);
239 client_->ScheduleComposite(); 231 scheduler_on_impl_thread_->SetNeedsCommit();
240 if (scheduler_on_impl_thread_)
241 scheduler_on_impl_thread_->SetNeedsCommit();
242 } 232 }
243 233
244 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { 234 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) {
245 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); 235 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw");
246 DCHECK(Proxy::IsMainThread()); 236 DCHECK(Proxy::IsMainThread());
247 DebugScopedSetImplThread impl(this); 237 DebugScopedSetImplThread impl(this);
248 client_->ScheduleComposite();
249 SetNeedsRedrawRectOnImplThread(damage_rect); 238 SetNeedsRedrawRectOnImplThread(damage_rect);
250 } 239 }
251 240
252 void SingleThreadProxy::SetNextCommitWaitsForActivation() { 241 void SingleThreadProxy::SetNextCommitWaitsForActivation() {
253 // There is no activation here other than commit. So do nothing. 242 // There is no activation here other than commit. So do nothing.
254 DCHECK(Proxy::IsMainThread()); 243 DCHECK(Proxy::IsMainThread());
255 } 244 }
256 245
257 void SingleThreadProxy::SetDeferCommits(bool defer_commits) { 246 void SingleThreadProxy::SetDeferCommits(bool defer_commits) {
258 DCHECK(Proxy::IsMainThread()); 247 DCHECK(Proxy::IsMainThread());
259 DCHECK(scheduler_on_impl_thread_);
brianderson 2014/06/24 23:50:12 Why is this DCHECK no longer valid?
260 if (defer_commits_ == defer_commits) 248 if (defer_commits_ == defer_commits)
261 return; 249 return;
262 250
263 if (defer_commits) 251 if (defer_commits)
264 TRACE_EVENT_ASYNC_BEGIN0("cc", "SingleThreadProxy::SetDeferCommits", this); 252 TRACE_EVENT_ASYNC_BEGIN0("cc", "SingleThreadProxy::SetDeferCommits", this);
265 else 253 else
266 TRACE_EVENT_ASYNC_END0("cc", "SingleThreadProxy::SetDeferCommits", this); 254 TRACE_EVENT_ASYNC_END0("cc", "SingleThreadProxy::SetDeferCommits", this);
267 255
268 defer_commits_ = defer_commits; 256 defer_commits_ = defer_commits;
269 if (!defer_commits_ && finish_commit_deferred_) { 257 if (!defer_commits_ && finish_commit_deferred_) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 layer_tree_host_impl_.reset(); 289 layer_tree_host_impl_.reset();
302 } 290 }
303 layer_tree_host_ = NULL; 291 layer_tree_host_ = NULL;
304 } 292 }
305 293
306 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { 294 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) {
307 TRACE_EVENT1( 295 TRACE_EVENT1(
308 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); 296 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
309 DCHECK(Proxy::IsImplThread()); 297 DCHECK(Proxy::IsImplThread());
310 UpdateBackgroundAnimateTicking(); 298 UpdateBackgroundAnimateTicking();
311 if (scheduler_on_impl_thread_) 299 scheduler_on_impl_thread_->SetCanDraw(can_draw);
312 scheduler_on_impl_thread_->SetCanDraw(can_draw);
313 } 300 }
314 301
315 void SingleThreadProxy::NotifyReadyToActivate() { 302 void SingleThreadProxy::NotifyReadyToActivate() {
316 // Impl-side painting only. 303 // Impl-side painting only.
317 NOTREACHED(); 304 NOTREACHED();
318 } 305 }
319 306
320 void SingleThreadProxy::SetNeedsRedrawOnImplThread() { 307 void SingleThreadProxy::SetNeedsRedrawOnImplThread() {
321 client_->ScheduleComposite(); 308 scheduler_on_impl_thread_->SetNeedsRedraw();
322 if (scheduler_on_impl_thread_)
323 scheduler_on_impl_thread_->SetNeedsRedraw();
324 } 309 }
325 310
326 void SingleThreadProxy::SetNeedsAnimateOnImplThread() { 311 void SingleThreadProxy::SetNeedsAnimateOnImplThread() {
327 SetNeedsRedrawOnImplThread(); 312 SetNeedsRedrawOnImplThread();
328 } 313 }
329 314
330 void SingleThreadProxy::SetNeedsManageTilesOnImplThread() { 315 void SingleThreadProxy::SetNeedsManageTilesOnImplThread() {
331 // Impl-side painting only. 316 // Impl-side painting only.
332 NOTREACHED(); 317 NOTREACHED();
333 } 318 }
334 319
335 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( 320 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread(
336 const gfx::Rect& damage_rect) { 321 const gfx::Rect& damage_rect) {
337 layer_tree_host_impl_->SetViewportDamage(damage_rect); 322 layer_tree_host_impl_->SetViewportDamage(damage_rect);
338 SetNeedsRedrawOnImplThread(); 323 SetNeedsRedrawOnImplThread();
339 } 324 }
340 325
341 void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() { 326 void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() {
342 // Impl-side painting only. 327 // Impl-side painting only.
343 NOTREACHED(); 328 NOTREACHED();
344 } 329 }
345 330
346 void SingleThreadProxy::SetNeedsCommitOnImplThread() { 331 void SingleThreadProxy::SetNeedsCommitOnImplThread() {
347 client_->ScheduleComposite(); 332 scheduler_on_impl_thread_->SetNeedsCommit();
348 if (scheduler_on_impl_thread_)
349 scheduler_on_impl_thread_->SetNeedsCommit();
350 } 333 }
351 334
352 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( 335 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread(
353 scoped_ptr<AnimationEventsVector> events) { 336 scoped_ptr<AnimationEventsVector> events) {
354 TRACE_EVENT0( 337 TRACE_EVENT0(
355 "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); 338 "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread");
356 DCHECK(Proxy::IsImplThread()); 339 DCHECK(Proxy::IsImplThread());
357 DebugScopedSetMainThread main(this); 340 DebugScopedSetMainThread main(this);
358 layer_tree_host_->SetAnimationEvents(events.Pass()); 341 layer_tree_host_->SetAnimationEvents(events.Pass());
359 } 342 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 393
411 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { 394 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() {
412 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); 395 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread");
413 { 396 {
414 DebugScopedSetMainThread main(this); 397 DebugScopedSetMainThread main(this);
415 // This must happen before we notify the scheduler as it may try to recreate 398 // This must happen before we notify the scheduler as it may try to recreate
416 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE. 399 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE.
417 layer_tree_host_->DidLoseOutputSurface(); 400 layer_tree_host_->DidLoseOutputSurface();
418 } 401 }
419 client_->DidAbortSwapBuffers(); 402 client_->DidAbortSwapBuffers();
420 if (scheduler_on_impl_thread_) 403 scheduler_on_impl_thread_->DidLoseOutputSurface();
421 scheduler_on_impl_thread_->DidLoseOutputSurface();
422 } 404 }
423 405
424 void SingleThreadProxy::DidSwapBuffersOnImplThread() { 406 void SingleThreadProxy::DidSwapBuffersOnImplThread() {
425 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersOnImplThread"); 407 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersOnImplThread");
426 if (scheduler_on_impl_thread_) 408 scheduler_on_impl_thread_->DidSwapBuffers();
427 scheduler_on_impl_thread_->DidSwapBuffers();
428 client_->DidPostSwapBuffers(); 409 client_->DidPostSwapBuffers();
429 } 410 }
430 411
431 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { 412 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() {
432 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); 413 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread");
433 if (scheduler_on_impl_thread_) 414 scheduler_on_impl_thread_->DidSwapBuffersComplete();
434 scheduler_on_impl_thread_->DidSwapBuffersComplete();
435 layer_tree_host_->DidCompleteSwapBuffers(); 415 layer_tree_host_->DidCompleteSwapBuffers();
436 } 416 }
437 417
438 void SingleThreadProxy::BeginFrame(const BeginFrameArgs& args) { 418 void SingleThreadProxy::BeginFrame(const BeginFrameArgs& args) {
439 TRACE_EVENT0("cc", "SingleThreadProxy::BeginFrame"); 419 TRACE_EVENT0("cc", "SingleThreadProxy::BeginFrame");
440 if (scheduler_on_impl_thread_) 420 scheduler_on_impl_thread_->BeginImplFrame(args);
441 scheduler_on_impl_thread_->BeginImplFrame(args);
442 } 421 }
443 422
444 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { 423 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) {
445 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately"); 424 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately");
446 DCHECK(Proxy::IsMainThread()); 425 DCHECK(Proxy::IsMainThread());
447 DCHECK(!layer_tree_host_->output_surface_lost()); 426 DCHECK(!layer_tree_host_->output_surface_lost());
448 427
449 DoCommit(frame_begin_time); 428 DoCommit(frame_begin_time);
450 429
451 LayerTreeHostImpl::FrameData frame; 430 LayerTreeHostImpl::FrameData frame;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 void SingleThreadProxy::ScheduledActionSendBeginMainFrame() { 557 void SingleThreadProxy::ScheduledActionSendBeginMainFrame() {
579 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame"); 558 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame");
580 if (defer_commits_) { 559 if (defer_commits_) {
581 DCHECK(!finish_commit_deferred_); 560 DCHECK(!finish_commit_deferred_);
582 finish_commit_deferred_ = true; 561 finish_commit_deferred_ = true;
583 layer_tree_host_->DidDeferCommit(); 562 layer_tree_host_->DidDeferCommit();
584 return; 563 return;
585 } 564 }
586 timing_history_.DidBeginMainFrame(); 565 timing_history_.DidBeginMainFrame();
587 566
588 DCHECK(scheduler_on_impl_thread_);
589 scheduler_on_impl_thread_->NotifyBeginMainFrameStarted(); 567 scheduler_on_impl_thread_->NotifyBeginMainFrameStarted();
590 scheduler_on_impl_thread_->NotifyReadyToCommit(); 568 scheduler_on_impl_thread_->NotifyReadyToCommit();
591 } 569 }
592 570
593 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() { 571 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() {
594 DebugScopedSetImplThread impl(this); 572 DebugScopedSetImplThread impl(this);
595 if (layer_tree_host_impl_->IsContextLost()) { 573 if (layer_tree_host_impl_->IsContextLost()) {
596 DidCommitAndDrawFrame(); 574 DidCommitAndDrawFrame();
597 return DRAW_SUCCESS; 575 return DRAW_SUCCESS;
598 } 576 }
(...skipping 23 matching lines...) Expand all
622 NOTREACHED(); 600 NOTREACHED();
623 } 601 }
624 602
625 void SingleThreadProxy::ScheduledActionActivatePendingTree() { 603 void SingleThreadProxy::ScheduledActionActivatePendingTree() {
626 // Impl-side painting only. 604 // Impl-side painting only.
627 NOTREACHED(); 605 NOTREACHED();
628 } 606 }
629 607
630 void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { 608 void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() {
631 DebugScopedSetMainThread main(this); 609 DebugScopedSetMainThread main(this);
632 DCHECK(scheduler_on_impl_thread_);
633 // If possible, create the output surface in a post task. Synchronously 610 // If possible, create the output surface in a post task. Synchronously
634 // creating the output surface makes tests more awkward since this differs 611 // creating the output surface makes tests more awkward since this differs
635 // from the ThreadProxy behavior. However, sometimes there is no 612 // from the ThreadProxy behavior. However, sometimes there is no
636 // task runner. 613 // task runner.
637 if (Proxy::MainThreadTaskRunner()) { 614 if (Proxy::MainThreadTaskRunner()) {
638 Proxy::MainThreadTaskRunner()->PostTask( 615 Proxy::MainThreadTaskRunner()->PostTask(
639 FROM_HERE, 616 FROM_HERE,
640 base::Bind(&SingleThreadProxy::CreateAndInitializeOutputSurface, 617 base::Bind(&SingleThreadProxy::CreateAndInitializeOutputSurface,
641 weak_factory_.GetWeakPtr())); 618 weak_factory_.GetWeakPtr()));
642 } else { 619 } else {
(...skipping 19 matching lines...) Expand all
662 639
663 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { 640 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() {
664 return timing_history_.CommitToActivateDurationEstimate(); 641 return timing_history_.CommitToActivateDurationEstimate();
665 } 642 }
666 643
667 void SingleThreadProxy::DidBeginImplFrameDeadline() { 644 void SingleThreadProxy::DidBeginImplFrameDeadline() {
668 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); 645 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame();
669 } 646 }
670 647
671 } // namespace cc 648 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698