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" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 if (scheduler_on_impl_thread_) | 365 if (scheduler_on_impl_thread_) |
366 scheduler_on_impl_thread_->SetNeedsRedraw(); | 366 scheduler_on_impl_thread_->SetNeedsRedraw(); |
367 } | 367 } |
368 | 368 |
369 void SingleThreadProxy::SetNeedsAnimateOnImplThread() { | 369 void SingleThreadProxy::SetNeedsAnimateOnImplThread() { |
370 client_->ScheduleComposite(); | 370 client_->ScheduleComposite(); |
371 if (scheduler_on_impl_thread_) | 371 if (scheduler_on_impl_thread_) |
372 scheduler_on_impl_thread_->SetNeedsAnimate(); | 372 scheduler_on_impl_thread_->SetNeedsAnimate(); |
373 } | 373 } |
374 | 374 |
375 void SingleThreadProxy::SetNeedsManageTilesOnImplThread() { | 375 void SingleThreadProxy::SetNeedsPrepareTilesOnImplThread() { |
376 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsManageTilesOnImplThread"); | 376 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsPrepareTilesOnImplThread"); |
377 if (scheduler_on_impl_thread_) | 377 if (scheduler_on_impl_thread_) |
378 scheduler_on_impl_thread_->SetNeedsManageTiles(); | 378 scheduler_on_impl_thread_->SetNeedsPrepareTiles(); |
379 } | 379 } |
380 | 380 |
381 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( | 381 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( |
382 const gfx::Rect& damage_rect) { | 382 const gfx::Rect& damage_rect) { |
383 layer_tree_host_impl_->SetViewportDamage(damage_rect); | 383 layer_tree_host_impl_->SetViewportDamage(damage_rect); |
384 SetNeedsRedrawOnImplThread(); | 384 SetNeedsRedrawOnImplThread(); |
385 } | 385 } |
386 | 386 |
387 void SingleThreadProxy::SetNeedsCommitOnImplThread() { | 387 void SingleThreadProxy::SetNeedsCommitOnImplThread() { |
388 client_->ScheduleComposite(); | 388 client_->ScheduleComposite(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 // equivalent of blocking commit until activation and also running | 431 // equivalent of blocking commit until activation and also running |
432 // all tasks posted during commit/activation before CommitComplete. | 432 // all tasks posted during commit/activation before CommitComplete. |
433 MainThreadTaskRunner()->PostTask( | 433 MainThreadTaskRunner()->PostTask( |
434 FROM_HERE, base::Bind(&SingleThreadProxy::CommitComplete, | 434 FROM_HERE, base::Bind(&SingleThreadProxy::CommitComplete, |
435 weak_factory_.GetWeakPtr())); | 435 weak_factory_.GetWeakPtr())); |
436 } | 436 } |
437 | 437 |
438 timing_history_.DidActivateSyncTree(); | 438 timing_history_.DidActivateSyncTree(); |
439 } | 439 } |
440 | 440 |
441 void SingleThreadProxy::DidManageTiles() { | 441 void SingleThreadProxy::DidPrepareTiles() { |
442 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 442 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
443 DCHECK(Proxy::IsImplThread()); | 443 DCHECK(Proxy::IsImplThread()); |
444 if (scheduler_on_impl_thread_) | 444 if (scheduler_on_impl_thread_) |
445 scheduler_on_impl_thread_->DidManageTiles(); | 445 scheduler_on_impl_thread_->DidPrepareTiles(); |
446 } | 446 } |
447 | 447 |
448 void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() { | 448 void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() { |
449 DCHECK(IsImplThread()); | 449 DCHECK(IsImplThread()); |
450 renderer_capabilities_for_main_thread_ = | 450 renderer_capabilities_for_main_thread_ = |
451 layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities(); | 451 layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities(); |
452 } | 452 } |
453 | 453 |
454 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { | 454 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { |
455 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); | 455 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 500 |
501 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) | 501 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) |
502 << "Commit should always succeed and transfer promises."; | 502 << "Commit should always succeed and transfer promises."; |
503 } | 503 } |
504 | 504 |
505 { | 505 { |
506 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); | 506 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); |
507 if (layer_tree_host_impl_->settings().impl_side_painting) { | 507 if (layer_tree_host_impl_->settings().impl_side_painting) { |
508 layer_tree_host_impl_->ActivateSyncTree(); | 508 layer_tree_host_impl_->ActivateSyncTree(); |
509 layer_tree_host_impl_->active_tree()->UpdateDrawProperties(); | 509 layer_tree_host_impl_->active_tree()->UpdateDrawProperties(); |
510 layer_tree_host_impl_->ManageTiles(); | 510 layer_tree_host_impl_->PrepareTiles(); |
511 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); | 511 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); |
512 } | 512 } |
513 | 513 |
514 DoAnimate(); | 514 DoAnimate(); |
515 | 515 |
516 LayerTreeHostImpl::FrameData frame; | 516 LayerTreeHostImpl::FrameData frame; |
517 DoComposite(frame_begin_time, &frame); | 517 DoComposite(frame_begin_time, &frame); |
518 | 518 |
519 // DoComposite could abort, but because this is a synchronous composite | 519 // DoComposite could abort, but because this is a synchronous composite |
520 // another draw will never be scheduled, so break remaining promises. | 520 // another draw will never be scheduled, so break remaining promises. |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 // creating the output surface makes tests more awkward since this differs | 764 // creating the output surface makes tests more awkward since this differs |
765 // from the ThreadProxy behavior. However, sometimes there is no | 765 // from the ThreadProxy behavior. However, sometimes there is no |
766 // task runner. | 766 // task runner. |
767 if (Proxy::MainThreadTaskRunner()) { | 767 if (Proxy::MainThreadTaskRunner()) { |
768 ScheduleRequestNewOutputSurface(); | 768 ScheduleRequestNewOutputSurface(); |
769 } else { | 769 } else { |
770 RequestNewOutputSurface(); | 770 RequestNewOutputSurface(); |
771 } | 771 } |
772 } | 772 } |
773 | 773 |
774 void SingleThreadProxy::ScheduledActionManageTiles() { | 774 void SingleThreadProxy::ScheduledActionPrepareTiles() { |
775 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionManageTiles"); | 775 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles"); |
776 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 776 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
777 DebugScopedSetImplThread impl(this); | 777 DebugScopedSetImplThread impl(this); |
778 layer_tree_host_impl_->ManageTiles(); | 778 layer_tree_host_impl_->PrepareTiles(); |
779 } | 779 } |
780 | 780 |
781 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { | 781 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { |
782 } | 782 } |
783 | 783 |
784 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { | 784 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { |
785 return timing_history_.DrawDurationEstimate(); | 785 return timing_history_.DrawDurationEstimate(); |
786 } | 786 } |
787 | 787 |
788 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { | 788 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { |
789 return timing_history_.BeginMainFrameToCommitDurationEstimate(); | 789 return timing_history_.BeginMainFrameToCommitDurationEstimate(); |
790 } | 790 } |
791 | 791 |
792 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 792 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
793 return timing_history_.CommitToActivateDurationEstimate(); | 793 return timing_history_.CommitToActivateDurationEstimate(); |
794 } | 794 } |
795 | 795 |
796 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 796 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
797 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 797 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
798 } | 798 } |
799 | 799 |
800 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 800 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
801 layer_tree_host_->SendBeginFramesToChildren(args); | 801 layer_tree_host_->SendBeginFramesToChildren(args); |
802 } | 802 } |
803 | 803 |
804 } // namespace cc | 804 } // namespace cc |
OLD | NEW |