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