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