OLD | NEW |
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" |
11 #include "cc/output/output_surface.h" | 11 #include "cc/output/output_surface.h" |
12 #include "cc/quads/draw_quad.h" | 12 #include "cc/quads/draw_quad.h" |
13 #include "cc/resources/prioritized_resource_manager.h" | 13 #include "cc/resources/prioritized_resource_manager.h" |
14 #include "cc/resources/resource_update_controller.h" | 14 #include "cc/resources/resource_update_controller.h" |
| 15 #include "cc/trees/blocking_task_runner.h" |
15 #include "cc/trees/layer_tree_host.h" | 16 #include "cc/trees/layer_tree_host.h" |
16 #include "cc/trees/layer_tree_host_single_thread_client.h" | 17 #include "cc/trees/layer_tree_host_single_thread_client.h" |
17 #include "cc/trees/layer_tree_impl.h" | 18 #include "cc/trees/layer_tree_impl.h" |
18 #include "cc/trees/scoped_abort_remaining_swap_promises.h" | 19 #include "cc/trees/scoped_abort_remaining_swap_promises.h" |
19 #include "ui/gfx/frame_time.h" | 20 #include "ui/gfx/frame_time.h" |
20 | 21 |
21 namespace cc { | 22 namespace cc { |
22 | 23 |
23 scoped_ptr<Proxy> SingleThreadProxy::Create( | 24 scoped_ptr<Proxy> SingleThreadProxy::Create( |
24 LayerTreeHost* layer_tree_host, | 25 LayerTreeHost* layer_tree_host, |
(...skipping 14 matching lines...) Expand all Loading... |
39 timing_history_(layer_tree_host->rendering_stats_instrumentation()), | 40 timing_history_(layer_tree_host->rendering_stats_instrumentation()), |
40 next_frame_is_newly_committed_frame_(false), | 41 next_frame_is_newly_committed_frame_(false), |
41 inside_draw_(false), | 42 inside_draw_(false), |
42 defer_commits_(false), | 43 defer_commits_(false), |
43 commit_was_deferred_(false), | 44 commit_was_deferred_(false), |
44 commit_requested_(false), | 45 commit_requested_(false), |
45 weak_factory_(this) { | 46 weak_factory_(this) { |
46 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); | 47 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
47 DCHECK(Proxy::IsMainThread()); | 48 DCHECK(Proxy::IsMainThread()); |
48 DCHECK(layer_tree_host); | 49 DCHECK(layer_tree_host); |
| 50 |
| 51 // Impl-side painting not supported without threaded compositing. |
| 52 CHECK(!layer_tree_host->settings().impl_side_painting) |
| 53 << "Threaded compositing must be enabled to use impl-side painting."; |
49 } | 54 } |
50 | 55 |
51 void SingleThreadProxy::Start() { | 56 void SingleThreadProxy::Start() { |
52 DebugScopedSetImplThread impl(this); | 57 DebugScopedSetImplThread impl(this); |
53 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); | 58 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); |
54 } | 59 } |
55 | 60 |
56 SingleThreadProxy::~SingleThreadProxy() { | 61 SingleThreadProxy::~SingleThreadProxy() { |
57 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); | 62 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); |
58 DCHECK(Proxy::IsMainThread()); | 63 DCHECK(Proxy::IsMainThread()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 layer_tree_host_->WillCommit(); | 185 layer_tree_host_->WillCommit(); |
181 | 186 |
182 // Commit immediately. | 187 // Commit immediately. |
183 { | 188 { |
184 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 189 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
185 DebugScopedSetImplThread impl(this); | 190 DebugScopedSetImplThread impl(this); |
186 | 191 |
187 // This CapturePostTasks should be destroyed before CommitComplete() is | 192 // This CapturePostTasks should be destroyed before CommitComplete() is |
188 // called since that goes out to the embedder, and we want the embedder | 193 // called since that goes out to the embedder, and we want the embedder |
189 // to receive its callbacks before that. | 194 // to receive its callbacks before that. |
190 commit_blocking_task_runner_.reset(new BlockingTaskRunner::CapturePostTasks( | 195 BlockingTaskRunner::CapturePostTasks blocked( |
191 blocking_main_thread_task_runner())); | 196 blocking_main_thread_task_runner()); |
192 | 197 |
193 layer_tree_host_impl_->BeginCommit(); | 198 layer_tree_host_impl_->BeginCommit(); |
194 | 199 |
195 if (PrioritizedResourceManager* contents_texture_manager = | 200 if (PrioritizedResourceManager* contents_texture_manager = |
196 layer_tree_host_->contents_texture_manager()) { | 201 layer_tree_host_->contents_texture_manager()) { |
197 contents_texture_manager->PushTexturePrioritiesToBackings(); | 202 contents_texture_manager->PushTexturePrioritiesToBackings(); |
198 } | 203 } |
199 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); | 204 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); |
200 | 205 |
201 scoped_ptr<ResourceUpdateController> update_controller = | 206 scoped_ptr<ResourceUpdateController> update_controller = |
(...skipping 21 matching lines...) Expand all Loading... |
223 DCHECK(!scroll_info->scrolls.size()); | 228 DCHECK(!scroll_info->scrolls.size()); |
224 DCHECK_EQ(1.f, scroll_info->page_scale_delta); | 229 DCHECK_EQ(1.f, scroll_info->page_scale_delta); |
225 #endif | 230 #endif |
226 | 231 |
227 RenderingStatsInstrumentation* stats_instrumentation = | 232 RenderingStatsInstrumentation* stats_instrumentation = |
228 layer_tree_host_->rendering_stats_instrumentation(); | 233 layer_tree_host_->rendering_stats_instrumentation(); |
229 benchmark_instrumentation::IssueMainThreadRenderingStatsEvent( | 234 benchmark_instrumentation::IssueMainThreadRenderingStatsEvent( |
230 stats_instrumentation->main_thread_rendering_stats()); | 235 stats_instrumentation->main_thread_rendering_stats()); |
231 stats_instrumentation->AccumulateAndClearMainThreadStats(); | 236 stats_instrumentation->AccumulateAndClearMainThreadStats(); |
232 } | 237 } |
233 | |
234 if (layer_tree_host_->settings().impl_side_painting) { | |
235 // TODO(enne): just commit directly to the active tree. | |
236 // | |
237 // Synchronously activate during commit to satisfy any potential | |
238 // SetNextCommitWaitsForActivation calls. Unfortunately, the tree | |
239 // might not be ready to draw, so DidActivateSyncTree must set | |
240 // the flag to force the tree to not draw until textures are ready. | |
241 NotifyReadyToActivate(); | |
242 } else { | |
243 CommitComplete(); | |
244 } | |
245 } | |
246 | |
247 void SingleThreadProxy::CommitComplete() { | |
248 DCHECK(!layer_tree_host_impl_->pending_tree()) | |
249 << "Activation is expected to have synchronously occurred by now."; | |
250 DCHECK(commit_blocking_task_runner_); | |
251 | |
252 DebugScopedSetMainThread main(this); | |
253 commit_blocking_task_runner_.reset(); | |
254 layer_tree_host_->CommitComplete(); | 238 layer_tree_host_->CommitComplete(); |
255 layer_tree_host_->DidBeginMainFrame(); | 239 layer_tree_host_->DidBeginMainFrame(); |
256 timing_history_.DidCommit(); | 240 timing_history_.DidCommit(); |
257 | 241 |
258 next_frame_is_newly_committed_frame_ = true; | 242 next_frame_is_newly_committed_frame_ = true; |
259 } | 243 } |
260 | 244 |
261 void SingleThreadProxy::SetNeedsCommit() { | 245 void SingleThreadProxy::SetNeedsCommit() { |
262 DCHECK(Proxy::IsMainThread()); | 246 DCHECK(Proxy::IsMainThread()); |
263 DebugScopedSetImplThread impl(this); | 247 DebugScopedSetImplThread impl(this); |
264 client_->ScheduleComposite(); | 248 client_->ScheduleComposite(); |
265 if (scheduler_on_impl_thread_) | 249 if (scheduler_on_impl_thread_) |
266 scheduler_on_impl_thread_->SetNeedsCommit(); | 250 scheduler_on_impl_thread_->SetNeedsCommit(); |
267 commit_requested_ = true; | 251 commit_requested_ = true; |
268 } | 252 } |
269 | 253 |
270 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { | 254 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { |
271 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); | 255 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); |
272 DCHECK(Proxy::IsMainThread()); | 256 DCHECK(Proxy::IsMainThread()); |
273 DebugScopedSetImplThread impl(this); | 257 DebugScopedSetImplThread impl(this); |
274 client_->ScheduleComposite(); | 258 client_->ScheduleComposite(); |
275 SetNeedsRedrawRectOnImplThread(damage_rect); | 259 SetNeedsRedrawRectOnImplThread(damage_rect); |
276 } | 260 } |
277 | 261 |
278 void SingleThreadProxy::SetNextCommitWaitsForActivation() { | 262 void SingleThreadProxy::SetNextCommitWaitsForActivation() { |
279 // Activation always forced in commit, so nothing to do. | 263 // There is no activation here other than commit. So do nothing. |
280 DCHECK(Proxy::IsMainThread()); | 264 DCHECK(Proxy::IsMainThread()); |
281 } | 265 } |
282 | 266 |
283 void SingleThreadProxy::SetDeferCommits(bool defer_commits) { | 267 void SingleThreadProxy::SetDeferCommits(bool defer_commits) { |
284 DCHECK(Proxy::IsMainThread()); | 268 DCHECK(Proxy::IsMainThread()); |
285 // Deferring commits only makes sense if there's a scheduler. | 269 // Deferring commits only makes sense if there's a scheduler. |
286 if (!scheduler_on_impl_thread_) | 270 if (!scheduler_on_impl_thread_) |
287 return; | 271 return; |
288 if (defer_commits_ == defer_commits) | 272 if (defer_commits_ == defer_commits) |
289 return; | 273 return; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 322 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
339 TRACE_EVENT1( | 323 TRACE_EVENT1( |
340 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 324 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
341 DCHECK(Proxy::IsImplThread()); | 325 DCHECK(Proxy::IsImplThread()); |
342 UpdateBackgroundAnimateTicking(); | 326 UpdateBackgroundAnimateTicking(); |
343 if (scheduler_on_impl_thread_) | 327 if (scheduler_on_impl_thread_) |
344 scheduler_on_impl_thread_->SetCanDraw(can_draw); | 328 scheduler_on_impl_thread_->SetCanDraw(can_draw); |
345 } | 329 } |
346 | 330 |
347 void SingleThreadProxy::NotifyReadyToActivate() { | 331 void SingleThreadProxy::NotifyReadyToActivate() { |
348 TRACE_EVENT0("cc", "SingleThreadProxy::NotifyReadyToActivate"); | 332 // Impl-side painting only. |
349 DebugScopedSetImplThread impl(this); | 333 NOTREACHED(); |
350 if (scheduler_on_impl_thread_) | |
351 scheduler_on_impl_thread_->NotifyReadyToActivate(); | |
352 } | 334 } |
353 | 335 |
354 void SingleThreadProxy::SetNeedsRedrawOnImplThread() { | 336 void SingleThreadProxy::SetNeedsRedrawOnImplThread() { |
355 client_->ScheduleComposite(); | 337 client_->ScheduleComposite(); |
356 if (scheduler_on_impl_thread_) | 338 if (scheduler_on_impl_thread_) |
357 scheduler_on_impl_thread_->SetNeedsRedraw(); | 339 scheduler_on_impl_thread_->SetNeedsRedraw(); |
358 } | 340 } |
359 | 341 |
360 void SingleThreadProxy::SetNeedsAnimateOnImplThread() { | 342 void SingleThreadProxy::SetNeedsAnimateOnImplThread() { |
361 SetNeedsRedrawOnImplThread(); | 343 SetNeedsRedrawOnImplThread(); |
362 } | 344 } |
363 | 345 |
364 void SingleThreadProxy::SetNeedsManageTilesOnImplThread() { | 346 void SingleThreadProxy::SetNeedsManageTilesOnImplThread() { |
365 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsManageTilesOnImplThread"); | 347 // Impl-side painting only. |
366 if (scheduler_on_impl_thread_) | 348 NOTREACHED(); |
367 scheduler_on_impl_thread_->SetNeedsManageTiles(); | |
368 } | 349 } |
369 | 350 |
370 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( | 351 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( |
371 const gfx::Rect& damage_rect) { | 352 const gfx::Rect& damage_rect) { |
372 layer_tree_host_impl_->SetViewportDamage(damage_rect); | 353 layer_tree_host_impl_->SetViewportDamage(damage_rect); |
373 SetNeedsRedrawOnImplThread(); | 354 SetNeedsRedrawOnImplThread(); |
374 } | 355 } |
375 | 356 |
376 void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() { | 357 void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() { |
377 TRACE_EVENT0("cc", "SingleThreadProxy::DidInitializeVisibleTileOnImplThread"); | 358 // Impl-side painting only. |
378 if (scheduler_on_impl_thread_) | 359 NOTREACHED(); |
379 scheduler_on_impl_thread_->SetNeedsRedraw(); | |
380 } | 360 } |
381 | 361 |
382 void SingleThreadProxy::SetNeedsCommitOnImplThread() { | 362 void SingleThreadProxy::SetNeedsCommitOnImplThread() { |
383 client_->ScheduleComposite(); | 363 client_->ScheduleComposite(); |
384 if (scheduler_on_impl_thread_) | 364 if (scheduler_on_impl_thread_) |
385 scheduler_on_impl_thread_->SetNeedsCommit(); | 365 scheduler_on_impl_thread_->SetNeedsCommit(); |
386 } | 366 } |
387 | 367 |
388 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( | 368 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( |
389 scoped_ptr<AnimationEventsVector> events) { | 369 scoped_ptr<AnimationEventsVector> events) { |
(...skipping 16 matching lines...) Expand all Loading... |
406 | 386 |
407 if (!contents_texture_manager || !resource_provider) | 387 if (!contents_texture_manager || !resource_provider) |
408 return false; | 388 return false; |
409 | 389 |
410 return contents_texture_manager->ReduceMemoryOnImplThread( | 390 return contents_texture_manager->ReduceMemoryOnImplThread( |
411 limit_bytes, priority_cutoff, resource_provider); | 391 limit_bytes, priority_cutoff, resource_provider); |
412 } | 392 } |
413 | 393 |
414 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } | 394 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } |
415 | 395 |
416 void SingleThreadProxy::DidActivateSyncTree() { | |
417 // Non-impl-side painting finishes commit in DoCommit. Impl-side painting | |
418 // defers until here to simulate SetNextCommitWaitsForActivation. | |
419 if (layer_tree_host_impl_->settings().impl_side_painting) { | |
420 // This is required because NotifyReadyToActivate gets called when | |
421 // the pending tree is not actually ready in the SingleThreadProxy. | |
422 layer_tree_host_impl_->active_tree()->SetRequiresHighResToDraw(); | |
423 | |
424 // Since activation could cause tasks to run, post CommitComplete | |
425 // separately so that it runs after these tasks. This is the loose | |
426 // equivalent of blocking commit until activation and also running | |
427 // all tasks posted during commit/activation before CommitComplete. | |
428 MainThreadTaskRunner()->PostTask( | |
429 FROM_HERE, | |
430 base::Bind(&SingleThreadProxy::CommitComplete, | |
431 weak_factory_.GetWeakPtr())); | |
432 } | |
433 | |
434 UpdateBackgroundAnimateTicking(); | |
435 timing_history_.DidActivateSyncTree(); | |
436 } | |
437 | |
438 void SingleThreadProxy::DidManageTiles() { | |
439 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | |
440 DCHECK(Proxy::IsImplThread()); | |
441 if (scheduler_on_impl_thread_) | |
442 scheduler_on_impl_thread_->DidManageTiles(); | |
443 } | |
444 | |
445 void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() { | 396 void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() { |
446 DCHECK(IsImplThread()); | 397 DCHECK(IsImplThread()); |
447 renderer_capabilities_for_main_thread_ = | 398 renderer_capabilities_for_main_thread_ = |
448 layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities(); | 399 layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities(); |
449 } | 400 } |
450 | 401 |
| 402 void SingleThreadProxy::DidManageTiles() { |
| 403 // Impl-side painting only. |
| 404 NOTREACHED(); |
| 405 } |
| 406 |
451 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { | 407 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { |
452 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); | 408 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); |
453 { | 409 { |
454 DebugScopedSetMainThread main(this); | 410 DebugScopedSetMainThread main(this); |
455 // This must happen before we notify the scheduler as it may try to recreate | 411 // This must happen before we notify the scheduler as it may try to recreate |
456 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE. | 412 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE. |
457 layer_tree_host_->DidLoseOutputSurface(); | 413 layer_tree_host_->DidLoseOutputSurface(); |
458 } | 414 } |
459 client_->DidAbortSwapBuffers(); | 415 client_->DidAbortSwapBuffers(); |
460 if (scheduler_on_impl_thread_) | 416 if (scheduler_on_impl_thread_) |
(...skipping 22 matching lines...) Expand all Loading... |
483 | 439 |
484 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { | 440 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { |
485 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately"); | 441 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately"); |
486 DCHECK(Proxy::IsMainThread()); | 442 DCHECK(Proxy::IsMainThread()); |
487 DCHECK(!layer_tree_host_->output_surface_lost()); | 443 DCHECK(!layer_tree_host_->output_surface_lost()); |
488 | 444 |
489 BeginFrameArgs begin_frame_args = BeginFrameArgs::Create( | 445 BeginFrameArgs begin_frame_args = BeginFrameArgs::Create( |
490 frame_begin_time, base::TimeTicks(), BeginFrameArgs::DefaultInterval()); | 446 frame_begin_time, base::TimeTicks(), BeginFrameArgs::DefaultInterval()); |
491 DoCommit(begin_frame_args); | 447 DoCommit(begin_frame_args); |
492 | 448 |
493 DCHECK(!layer_tree_host_impl_->settings().impl_side_painting) | |
494 << "Impl-side painting and synchronous compositing are not supported."; | |
495 | |
496 LayerTreeHostImpl::FrameData frame; | 449 LayerTreeHostImpl::FrameData frame; |
497 DoComposite(frame_begin_time, &frame); | 450 DoComposite(frame_begin_time, &frame); |
498 } | 451 } |
499 | 452 |
500 void SingleThreadProxy::AsValueInto(base::debug::TracedValue* state) const { | 453 void SingleThreadProxy::AsValueInto(base::debug::TracedValue* state) const { |
501 // The following line casts away const modifiers because it is just | 454 // The following line casts away const modifiers because it is just |
502 // setting debug state. We still want the AsValue() function and its | 455 // setting debug state. We still want the AsValue() function and its |
503 // call chain to be const throughout. | 456 // call chain to be const throughout. |
504 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); | 457 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); |
505 | 458 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 DoCommit(layer_tree_host_impl_->CurrentBeginFrameArgs()); | 640 DoCommit(layer_tree_host_impl_->CurrentBeginFrameArgs()); |
688 } | 641 } |
689 | 642 |
690 void SingleThreadProxy::ScheduledActionAnimate() { | 643 void SingleThreadProxy::ScheduledActionAnimate() { |
691 TRACE_EVENT0("cc", "ScheduledActionAnimate"); | 644 TRACE_EVENT0("cc", "ScheduledActionAnimate"); |
692 layer_tree_host_impl_->Animate( | 645 layer_tree_host_impl_->Animate( |
693 layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time); | 646 layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time); |
694 } | 647 } |
695 | 648 |
696 void SingleThreadProxy::ScheduledActionUpdateVisibleTiles() { | 649 void SingleThreadProxy::ScheduledActionUpdateVisibleTiles() { |
697 DebugScopedSetImplThread impl(this); | 650 // Impl-side painting only. |
698 layer_tree_host_impl_->UpdateVisibleTiles(); | 651 NOTREACHED(); |
699 } | 652 } |
700 | 653 |
701 void SingleThreadProxy::ScheduledActionActivateSyncTree() { | 654 void SingleThreadProxy::ScheduledActionActivateSyncTree() { |
702 DebugScopedSetImplThread impl(this); | |
703 layer_tree_host_impl_->ActivateSyncTree(); | |
704 } | 655 } |
705 | 656 |
706 void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { | 657 void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { |
707 DebugScopedSetMainThread main(this); | 658 DebugScopedSetMainThread main(this); |
708 DCHECK(scheduler_on_impl_thread_); | 659 DCHECK(scheduler_on_impl_thread_); |
709 // If possible, create the output surface in a post task. Synchronously | 660 // If possible, create the output surface in a post task. Synchronously |
710 // creating the output surface makes tests more awkward since this differs | 661 // creating the output surface makes tests more awkward since this differs |
711 // from the ThreadProxy behavior. However, sometimes there is no | 662 // from the ThreadProxy behavior. However, sometimes there is no |
712 // task runner. | 663 // task runner. |
713 if (Proxy::MainThreadTaskRunner()) { | 664 if (Proxy::MainThreadTaskRunner()) { |
714 MainThreadTaskRunner()->PostTask( | 665 MainThreadTaskRunner()->PostTask( |
715 FROM_HERE, | 666 FROM_HERE, |
716 base::Bind(&SingleThreadProxy::CreateAndInitializeOutputSurface, | 667 base::Bind(&SingleThreadProxy::CreateAndInitializeOutputSurface, |
717 weak_factory_.GetWeakPtr())); | 668 weak_factory_.GetWeakPtr())); |
718 } else { | 669 } else { |
719 CreateAndInitializeOutputSurface(); | 670 CreateAndInitializeOutputSurface(); |
720 } | 671 } |
721 } | 672 } |
722 | 673 |
723 void SingleThreadProxy::ScheduledActionManageTiles() { | 674 void SingleThreadProxy::ScheduledActionManageTiles() { |
724 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionManageTiles"); | 675 // Impl-side painting only. |
725 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 676 NOTREACHED(); |
726 DebugScopedSetImplThread impl(this); | |
727 layer_tree_host_impl_->ManageTiles(); | |
728 } | 677 } |
729 | 678 |
730 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { | 679 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { |
731 } | 680 } |
732 | 681 |
733 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { | 682 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { |
734 return timing_history_.DrawDurationEstimate(); | 683 return timing_history_.DrawDurationEstimate(); |
735 } | 684 } |
736 | 685 |
737 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { | 686 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { |
738 return timing_history_.BeginMainFrameToCommitDurationEstimate(); | 687 return timing_history_.BeginMainFrameToCommitDurationEstimate(); |
739 } | 688 } |
740 | 689 |
741 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 690 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
742 return timing_history_.CommitToActivateDurationEstimate(); | 691 return timing_history_.CommitToActivateDurationEstimate(); |
743 } | 692 } |
744 | 693 |
745 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 694 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
746 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 695 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
747 } | 696 } |
748 | 697 |
749 } // namespace cc | 698 } // namespace cc |
OLD | NEW |