| 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/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
| 10 #include "cc/debug/devtools_instrumentation.h" | 10 #include "cc/debug/devtools_instrumentation.h" |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } | 502 } |
| 503 | 503 |
| 504 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { | 504 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
| 505 TRACE_EVENT0("cc,benchmark", | 505 TRACE_EVENT0("cc,benchmark", |
| 506 "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 506 "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
| 507 if (scheduler_on_impl_thread_) | 507 if (scheduler_on_impl_thread_) |
| 508 scheduler_on_impl_thread_->DidSwapBuffersComplete(); | 508 scheduler_on_impl_thread_->DidSwapBuffersComplete(); |
| 509 layer_tree_host_->DidCompleteSwapBuffers(); | 509 layer_tree_host_->DidCompleteSwapBuffers(); |
| 510 } | 510 } |
| 511 | 511 |
| 512 void SingleThreadProxy::OnDrawForOutputSurface() { |
| 513 NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor."; |
| 514 } |
| 515 |
| 512 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { | 516 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { |
| 513 TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); | 517 TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); |
| 514 DCHECK(Proxy::IsMainThread()); | 518 DCHECK(Proxy::IsMainThread()); |
| 515 base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true); | 519 base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true); |
| 516 | 520 |
| 517 if (layer_tree_host_->output_surface_lost()) { | 521 if (layer_tree_host_->output_surface_lost()) { |
| 518 RequestNewOutputSurface(); | 522 RequestNewOutputSurface(); |
| 519 // RequestNewOutputSurface could have synchronously created an output | 523 // RequestNewOutputSurface could have synchronously created an output |
| 520 // surface, so check again before returning. | 524 // surface, so check again before returning. |
| 521 if (layer_tree_host_->output_surface_lost()) | 525 if (layer_tree_host_->output_surface_lost()) |
| 522 return; | 526 return; |
| 523 } | 527 } |
| 524 | 528 |
| 525 { | 529 { |
| 526 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( | 530 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( |
| 527 BEGINFRAME_FROM_HERE, frame_begin_time, base::TimeTicks(), | 531 BEGINFRAME_FROM_HERE, frame_begin_time, base::TimeTicks(), |
| 528 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::SYNCHRONOUS)); | 532 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL)); |
| 529 DoBeginMainFrame(begin_frame_args); | 533 DoBeginMainFrame(begin_frame_args); |
| 530 DoCommit(); | 534 DoCommit(); |
| 531 | 535 |
| 532 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) | 536 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) |
| 533 << "Commit should always succeed and transfer promises."; | 537 << "Commit should always succeed and transfer promises."; |
| 534 } | 538 } |
| 535 | 539 |
| 536 { | 540 { |
| 537 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); | 541 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); |
| 538 if (layer_tree_host_impl_->settings().impl_side_painting) { | 542 if (layer_tree_host_impl_->settings().impl_side_painting) { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 } | 804 } |
| 801 } | 805 } |
| 802 | 806 |
| 803 void SingleThreadProxy::ScheduledActionPrepareTiles() { | 807 void SingleThreadProxy::ScheduledActionPrepareTiles() { |
| 804 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles"); | 808 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles"); |
| 805 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 809 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 806 DebugScopedSetImplThread impl(this); | 810 DebugScopedSetImplThread impl(this); |
| 807 layer_tree_host_impl_->PrepareTiles(); | 811 layer_tree_host_impl_->PrepareTiles(); |
| 808 } | 812 } |
| 809 | 813 |
| 814 void SingleThreadProxy::ScheduledActionInvalidateOutputSurface() { |
| 815 DCHECK(layer_tree_host_impl_->output_surface()); |
| 816 layer_tree_host_impl_->output_surface()->Invalidate(); |
| 817 } |
| 818 |
| 810 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { | 819 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { |
| 811 } | 820 } |
| 812 | 821 |
| 813 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { | 822 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { |
| 814 return timing_history_.DrawDurationEstimate(); | 823 return timing_history_.DrawDurationEstimate(); |
| 815 } | 824 } |
| 816 | 825 |
| 817 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { | 826 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { |
| 818 return timing_history_.BeginMainFrameToCommitDurationEstimate(); | 827 return timing_history_.BeginMainFrameToCommitDurationEstimate(); |
| 819 } | 828 } |
| 820 | 829 |
| 821 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 830 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
| 822 return timing_history_.CommitToActivateDurationEstimate(); | 831 return timing_history_.CommitToActivateDurationEstimate(); |
| 823 } | 832 } |
| 824 | 833 |
| 825 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 834 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
| 826 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 835 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 827 } | 836 } |
| 828 | 837 |
| 829 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 838 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 830 layer_tree_host_->SendBeginFramesToChildren(args); | 839 layer_tree_host_->SendBeginFramesToChildren(args); |
| 831 } | 840 } |
| 832 | 841 |
| 833 } // namespace cc | 842 } // namespace cc |
| OLD | NEW |