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