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/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_->Signal(); | 688 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_->Signal(); |
689 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_ = NULL; | 689 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_ = NULL; |
690 } | 690 } |
691 begin_frame_sent_to_main_thread_time_ = base::TimeTicks::HighResNow(); | 691 begin_frame_sent_to_main_thread_time_ = base::TimeTicks::HighResNow(); |
692 } | 692 } |
693 | 693 |
694 void ThreadProxy::BeginFrameOnMainThread( | 694 void ThreadProxy::BeginFrameOnMainThread( |
695 scoped_ptr<BeginFrameAndCommitState> begin_frame_state) { | 695 scoped_ptr<BeginFrameAndCommitState> begin_frame_state) { |
696 TRACE_EVENT0("cc", "ThreadProxy::BeginFrameOnMainThread"); | 696 TRACE_EVENT0("cc", "ThreadProxy::BeginFrameOnMainThread"); |
697 DCHECK(IsMainThread()); | 697 DCHECK(IsMainThread()); |
| 698 |
698 if (!layer_tree_host_) | 699 if (!layer_tree_host_) |
699 return; | 700 return; |
700 | 701 |
701 if (defer_commits_) { | 702 if (defer_commits_) { |
702 pending_deferred_commit_ = begin_frame_state.Pass(); | 703 pending_deferred_commit_ = begin_frame_state.Pass(); |
703 layer_tree_host_->DidDeferCommit(); | 704 layer_tree_host_->DidDeferCommit(); |
704 TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); | 705 TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); |
705 return; | 706 return; |
706 } | 707 } |
707 | 708 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 OffscreenContextProviderForCompositorThread(); | 810 OffscreenContextProviderForCompositorThread(); |
810 if (offscreen_context_provider.get()) | 811 if (offscreen_context_provider.get()) |
811 created_offscreen_context_provider_ = true; | 812 created_offscreen_context_provider_ = true; |
812 } | 813 } |
813 | 814 |
814 // Notify the impl thread that the main thread is ready to commit. This will | 815 // Notify the impl thread that the main thread is ready to commit. This will |
815 // begin the commit process, which is blocking from the main thread's | 816 // begin the commit process, which is blocking from the main thread's |
816 // point of view, but asynchronously performed on the impl thread, | 817 // point of view, but asynchronously performed on the impl thread, |
817 // coordinated by the Scheduler. | 818 // coordinated by the Scheduler. |
818 { | 819 { |
819 TRACE_EVENT0("cc", "ThreadProxy::BeginFrameOnMainThread::commit"); | 820 TRACE_EVENT_BEGIN0("cc", "ThreadProxy::BeginFrameOnMainThread::commit"); |
820 | 821 |
821 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 822 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
822 | 823 |
823 RenderingStatsInstrumentation* stats_instrumentation = | 824 RenderingStatsInstrumentation* stats_instrumentation = |
824 layer_tree_host_->rendering_stats_instrumentation(); | 825 layer_tree_host_->rendering_stats_instrumentation(); |
825 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 826 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
826 | 827 |
827 CompletionEvent completion; | 828 CompletionEvent completion; |
828 Proxy::ImplThreadTaskRunner()->PostTask( | 829 Proxy::ImplThreadTaskRunner()->PostTask( |
829 FROM_HERE, | 830 FROM_HERE, |
830 base::Bind(&ThreadProxy::StartCommitOnImplThread, | 831 base::Bind(&ThreadProxy::StartCommitOnImplThread, |
831 impl_thread_weak_ptr_, | 832 impl_thread_weak_ptr_, |
832 &completion, | 833 &completion, |
833 queue.release(), | 834 queue.release(), |
834 offscreen_context_provider)); | 835 offscreen_context_provider)); |
835 completion.Wait(); | 836 completion.Wait(); |
836 | 837 |
837 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); | 838 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); |
838 stats_instrumentation->AddCommit(duration); | 839 stats_instrumentation->AddCommit(duration); |
| 840 TRACE_EVENT_END1("cc", "ThreadProxy::BeginFrameOnMainThread::commit", |
| 841 "data", stats_instrumentation-> |
| 842 GetMainThreadRenderingStats().AsTraceableData()); |
| 843 stats_instrumentation->AccumulateAndClearMainThreadStats(); |
839 } | 844 } |
840 | 845 |
841 layer_tree_host_->CommitComplete(); | 846 layer_tree_host_->CommitComplete(); |
842 layer_tree_host_->DidBeginFrame(); | 847 layer_tree_host_->DidBeginFrame(); |
843 } | 848 } |
844 | 849 |
845 void ThreadProxy::StartCommitOnImplThread( | 850 void ThreadProxy::StartCommitOnImplThread( |
846 CompletionEvent* completion, | 851 CompletionEvent* completion, |
847 ResourceUpdateQueue* raw_queue, | 852 ResourceUpdateQueue* raw_queue, |
848 scoped_refptr<cc::ContextProvider> offscreen_context_provider) { | 853 scoped_refptr<cc::ContextProvider> offscreen_context_provider) { |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1515 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
1511 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1516 completion_event_for_commit_held_on_tree_activation_->Signal(); |
1512 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1517 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1513 } | 1518 } |
1514 | 1519 |
1515 commit_to_activate_duration_history_.InsertSample( | 1520 commit_to_activate_duration_history_.InsertSample( |
1516 base::TimeTicks::HighResNow() - commit_complete_time_); | 1521 base::TimeTicks::HighResNow() - commit_complete_time_); |
1517 } | 1522 } |
1518 | 1523 |
1519 } // namespace cc | 1524 } // namespace cc |
OLD | NEW |