| 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/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/debug/benchmark_instrumentation.h" | 10 #include "cc/debug/benchmark_instrumentation.h" |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 } | 553 } |
| 554 | 554 |
| 555 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { | 555 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
| 556 TRACE_EVENT0("cc,benchmark", | 556 TRACE_EVENT0("cc,benchmark", |
| 557 "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 557 "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
| 558 if (scheduler_on_impl_thread_) | 558 if (scheduler_on_impl_thread_) |
| 559 scheduler_on_impl_thread_->DidSwapBuffersComplete(); | 559 scheduler_on_impl_thread_->DidSwapBuffersComplete(); |
| 560 layer_tree_host_->DidCompleteSwapBuffers(); | 560 layer_tree_host_->DidCompleteSwapBuffers(); |
| 561 } | 561 } |
| 562 | 562 |
| 563 void SingleThreadProxy::OnDrawForOutputSurface() { |
| 564 NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor."; |
| 565 } |
| 566 |
| 563 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { | 567 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { |
| 564 TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); | 568 TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); |
| 565 DCHECK(Proxy::IsMainThread()); | 569 DCHECK(Proxy::IsMainThread()); |
| 566 base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true); | 570 base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true); |
| 567 | 571 |
| 568 if (layer_tree_host_->output_surface_lost()) { | 572 if (layer_tree_host_->output_surface_lost()) { |
| 569 RequestNewOutputSurface(); | 573 RequestNewOutputSurface(); |
| 570 // RequestNewOutputSurface could have synchronously created an output | 574 // RequestNewOutputSurface could have synchronously created an output |
| 571 // surface, so check again before returning. | 575 // surface, so check again before returning. |
| 572 if (layer_tree_host_->output_surface_lost()) | 576 if (layer_tree_host_->output_surface_lost()) |
| 573 return; | 577 return; |
| 574 } | 578 } |
| 575 | 579 |
| 576 { | 580 { |
| 577 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( | 581 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( |
| 578 BEGINFRAME_FROM_HERE, frame_begin_time, base::TimeTicks(), | 582 BEGINFRAME_FROM_HERE, frame_begin_time, base::TimeTicks(), |
| 579 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::SYNCHRONOUS)); | 583 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL)); |
| 580 DoBeginMainFrame(begin_frame_args); | 584 DoBeginMainFrame(begin_frame_args); |
| 581 DoCommit(); | 585 DoCommit(); |
| 582 | 586 |
| 583 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) | 587 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) |
| 584 << "Commit should always succeed and transfer promises."; | 588 << "Commit should always succeed and transfer promises."; |
| 585 } | 589 } |
| 586 | 590 |
| 587 { | 591 { |
| 588 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); | 592 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); |
| 589 if (layer_tree_host_impl_->settings().impl_side_painting) { | 593 if (layer_tree_host_impl_->settings().impl_side_painting) { |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 } | 907 } |
| 904 } | 908 } |
| 905 | 909 |
| 906 void SingleThreadProxy::ScheduledActionPrepareTiles() { | 910 void SingleThreadProxy::ScheduledActionPrepareTiles() { |
| 907 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles"); | 911 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles"); |
| 908 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 912 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 909 DebugScopedSetImplThread impl(this); | 913 DebugScopedSetImplThread impl(this); |
| 910 layer_tree_host_impl_->PrepareTiles(); | 914 layer_tree_host_impl_->PrepareTiles(); |
| 911 } | 915 } |
| 912 | 916 |
| 917 void SingleThreadProxy::ScheduledActionInvalidateOutputSurface() { |
| 918 NOTREACHED(); |
| 919 } |
| 920 |
| 913 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { | 921 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { |
| 914 } | 922 } |
| 915 | 923 |
| 916 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { | 924 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { |
| 917 return timing_history_.DrawDurationEstimate(); | 925 return timing_history_.DrawDurationEstimate(); |
| 918 } | 926 } |
| 919 | 927 |
| 920 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { | 928 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { |
| 921 return timing_history_.BeginMainFrameToCommitDurationEstimate(); | 929 return timing_history_.BeginMainFrameToCommitDurationEstimate(); |
| 922 } | 930 } |
| 923 | 931 |
| 924 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 932 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
| 925 return timing_history_.CommitToActivateDurationEstimate(); | 933 return timing_history_.CommitToActivateDurationEstimate(); |
| 926 } | 934 } |
| 927 | 935 |
| 928 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 936 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
| 929 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 937 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 930 } | 938 } |
| 931 | 939 |
| 932 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 940 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 933 layer_tree_host_->SendBeginFramesToChildren(args); | 941 layer_tree_host_->SendBeginFramesToChildren(args); |
| 934 } | 942 } |
| 935 | 943 |
| 936 } // namespace cc | 944 } // namespace cc |
| OLD | NEW |