| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 layer_tree_host_->id(), | 96 layer_tree_host_->id(), |
| 97 MainThreadTaskRunner(), | 97 MainThreadTaskRunner(), |
| 98 base::PowerMonitor::Get(), | 98 base::PowerMonitor::Get(), |
| 99 external_begin_frame_source_.Pass()); | 99 external_begin_frame_source_.Pass()); |
| 100 scheduler_on_impl_thread_->SetCanStart(); | 100 scheduler_on_impl_thread_->SetCanStart(); |
| 101 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 101 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 void SingleThreadProxy::SetVisible(bool visible) { | 105 void SingleThreadProxy::SetVisible(bool visible) { |
| 106 TRACE_EVENT0("cc", "SingleThreadProxy::SetVisible"); | 106 TRACE_EVENT1("cc", "SingleThreadProxy::SetVisible", "visible", visible); |
| 107 DebugScopedSetImplThread impl(this); | 107 DebugScopedSetImplThread impl(this); |
| 108 layer_tree_host_impl_->SetVisible(visible); | 108 layer_tree_host_impl_->SetVisible(visible); |
| 109 if (scheduler_on_impl_thread_) | 109 if (scheduler_on_impl_thread_) |
| 110 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 110 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
| 111 // Changing visibility could change ShouldComposite(). | 111 // Changing visibility could change ShouldComposite(). |
| 112 } | 112 } |
| 113 | 113 |
| 114 void SingleThreadProxy::RequestNewOutputSurface() { | 114 void SingleThreadProxy::RequestNewOutputSurface() { |
| 115 DCHECK(Proxy::IsMainThread()); | 115 DCHECK(Proxy::IsMainThread()); |
| 116 DCHECK(layer_tree_host_->output_surface_lost()); | 116 DCHECK(layer_tree_host_->output_surface_lost()); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 485 |
| 486 if (layer_tree_host_->output_surface_lost()) { | 486 if (layer_tree_host_->output_surface_lost()) { |
| 487 RequestNewOutputSurface(); | 487 RequestNewOutputSurface(); |
| 488 // RequestNewOutputSurface could have synchronously created an output | 488 // RequestNewOutputSurface could have synchronously created an output |
| 489 // surface, so check again before returning. | 489 // surface, so check again before returning. |
| 490 if (layer_tree_host_->output_surface_lost()) | 490 if (layer_tree_host_->output_surface_lost()) |
| 491 return; | 491 return; |
| 492 } | 492 } |
| 493 | 493 |
| 494 { | 494 { |
| 495 BeginFrameArgs begin_frame_args( | 495 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( |
| 496 BeginFrameArgs::Create(frame_begin_time, | 496 frame_begin_time, base::TimeTicks(), BeginFrameArgs::DefaultInterval(), |
| 497 base::TimeTicks(), | 497 BeginFrameArgs::SYNCHRONOUS)); |
| 498 BeginFrameArgs::DefaultInterval())); | |
| 499 DoBeginMainFrame(begin_frame_args); | 498 DoBeginMainFrame(begin_frame_args); |
| 500 DoCommit(); | 499 DoCommit(); |
| 501 | 500 |
| 502 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) | 501 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) |
| 503 << "Commit should always succeed and transfer promises."; | 502 << "Commit should always succeed and transfer promises."; |
| 504 } | 503 } |
| 505 | 504 |
| 506 { | 505 { |
| 507 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); | 506 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); |
| 508 if (layer_tree_host_impl_->settings().impl_side_painting) { | 507 if (layer_tree_host_impl_->settings().impl_side_painting) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 DebugScopedSetMainThread main(this); | 626 DebugScopedSetMainThread main(this); |
| 628 next_frame_is_newly_committed_frame_ = false; | 627 next_frame_is_newly_committed_frame_ = false; |
| 629 layer_tree_host_->DidCommitAndDrawFrame(); | 628 layer_tree_host_->DidCommitAndDrawFrame(); |
| 630 } | 629 } |
| 631 } | 630 } |
| 632 | 631 |
| 633 bool SingleThreadProxy::MainFrameWillHappenForTesting() { | 632 bool SingleThreadProxy::MainFrameWillHappenForTesting() { |
| 634 return false; | 633 return false; |
| 635 } | 634 } |
| 636 | 635 |
| 636 void SingleThreadProxy::SetChildrenNeedBeginFrames( |
| 637 bool children_need_begin_frames) { |
| 638 scheduler_on_impl_thread_->SetChildrenNeedBeginFrames( |
| 639 children_need_begin_frames); |
| 640 } |
| 641 |
| 637 void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { | 642 void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 638 layer_tree_host_impl_->WillBeginImplFrame(args); | 643 layer_tree_host_impl_->WillBeginImplFrame(args); |
| 639 } | 644 } |
| 640 | 645 |
| 641 void SingleThreadProxy::ScheduledActionSendBeginMainFrame() { | 646 void SingleThreadProxy::ScheduledActionSendBeginMainFrame() { |
| 642 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame"); | 647 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame"); |
| 643 // Although this proxy is single-threaded, it's problematic to synchronously | 648 // Although this proxy is single-threaded, it's problematic to synchronously |
| 644 // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This | 649 // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This |
| 645 // could cause a commit to occur in between a series of SetNeedsCommit calls | 650 // could cause a commit to occur in between a series of SetNeedsCommit calls |
| 646 // (i.e. property modifications) causing some to fall on one frame and some to | 651 // (i.e. property modifications) causing some to fall on one frame and some to |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 } | 790 } |
| 786 | 791 |
| 787 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 792 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
| 788 return timing_history_.CommitToActivateDurationEstimate(); | 793 return timing_history_.CommitToActivateDurationEstimate(); |
| 789 } | 794 } |
| 790 | 795 |
| 791 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 796 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
| 792 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 797 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 793 } | 798 } |
| 794 | 799 |
| 800 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 801 layer_tree_host_->SendBeginFramesToChildren(args); |
| 802 } |
| 803 |
| 795 } // namespace cc | 804 } // namespace cc |
| OLD | NEW |