Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: cc/trees/thread_proxy.cc

Issue 83183005: Add synthetic delay points for latency testing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/debug/trace_event_synthetic_delay.h"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "cc/debug/benchmark_instrumentation.h" 14 #include "cc/debug/benchmark_instrumentation.h"
14 #include "cc/input/input_handler.h" 15 #include "cc/input/input_handler.h"
15 #include "cc/output/context_provider.h" 16 #include "cc/output/context_provider.h"
16 #include "cc/output/output_surface.h" 17 #include "cc/output/output_surface.h"
17 #include "cc/quads/draw_quad.h" 18 #include "cc/quads/draw_quad.h"
18 #include "cc/resources/prioritized_resource_manager.h" 19 #include "cc/resources/prioritized_resource_manager.h"
19 #include "cc/scheduler/delay_based_time_source.h" 20 #include "cc/scheduler/delay_based_time_source.h"
20 #include "cc/scheduler/frame_rate_controller.h" 21 #include "cc/scheduler/frame_rate_controller.h"
21 #include "cc/scheduler/scheduler.h" 22 #include "cc/scheduler/scheduler.h"
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 if (begin_main_frame_sent_completion_event_on_impl_thread_) { 736 if (begin_main_frame_sent_completion_event_on_impl_thread_) {
736 begin_main_frame_sent_completion_event_on_impl_thread_->Signal(); 737 begin_main_frame_sent_completion_event_on_impl_thread_->Signal();
737 begin_main_frame_sent_completion_event_on_impl_thread_ = NULL; 738 begin_main_frame_sent_completion_event_on_impl_thread_ = NULL;
738 } 739 }
739 begin_main_frame_sent_time_ = base::TimeTicks::HighResNow(); 740 begin_main_frame_sent_time_ = base::TimeTicks::HighResNow();
740 } 741 }
741 742
742 void ThreadProxy::BeginMainFrame( 743 void ThreadProxy::BeginMainFrame(
743 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { 744 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) {
744 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame"); 745 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame");
746 TRACE_EVENT_SYNTHETIC_DELAY_ACTIVATE("cc.BeginMainFrame");
745 DCHECK(IsMainThread()); 747 DCHECK(IsMainThread());
746 748
747 if (!layer_tree_host()) 749 if (!layer_tree_host())
748 return; 750 return;
749 751
750 if (defer_commits_) { 752 if (defer_commits_) {
751 pending_deferred_commit_ = begin_main_frame_state.Pass(); 753 pending_deferred_commit_ = begin_main_frame_state.Pass();
752 layer_tree_host()->DidDeferCommit(); 754 layer_tree_host()->DidDeferCommit();
753 TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); 755 TRACE_EVENT0("cc", "EarlyOut_DeferCommits");
754 return; 756 return;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 813
812 // Recreate all UI resources if there were evicted UI resources when the impl 814 // Recreate all UI resources if there were evicted UI resources when the impl
813 // thread initiated the commit. 815 // thread initiated the commit.
814 bool evicted_ui_resources = begin_main_frame_state 816 bool evicted_ui_resources = begin_main_frame_state
815 ? begin_main_frame_state->evicted_ui_resources 817 ? begin_main_frame_state->evicted_ui_resources
816 : false; 818 : false;
817 if (evicted_ui_resources) 819 if (evicted_ui_resources)
818 layer_tree_host()->RecreateUIResources(); 820 layer_tree_host()->RecreateUIResources();
819 821
820 layer_tree_host()->Layout(); 822 layer_tree_host()->Layout();
823 TRACE_EVENT_SYNTHETIC_DELAY_APPLY("cc.BeginMainFrame");
821 824
822 // Clear the commit flag after updating animations and layout here --- objects 825 // Clear the commit flag after updating animations and layout here --- objects
823 // that only layout when painted will trigger another SetNeedsCommit inside 826 // that only layout when painted will trigger another SetNeedsCommit inside
824 // UpdateLayers. 827 // UpdateLayers.
825 commit_requested_ = false; 828 commit_requested_ = false;
826 commit_request_sent_to_impl_thread_ = false; 829 commit_request_sent_to_impl_thread_ = false;
827 bool can_cancel_this_commit = 830 bool can_cancel_this_commit =
828 can_cancel_commit_ && 831 can_cancel_commit_ &&
829 !in_composite_and_readback_ && 832 !in_composite_and_readback_ &&
830 !evicted_ui_resources; 833 !evicted_ui_resources;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 Proxy::MainThreadTaskRunner()->PostTask( 1058 Proxy::MainThreadTaskRunner()->PostTask(
1056 FROM_HERE, 1059 FROM_HERE,
1057 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface, 1060 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface,
1058 main_thread_weak_ptr_)); 1061 main_thread_weak_ptr_));
1059 } 1062 }
1060 1063
1061 DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal( 1064 DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
1062 bool forced_draw, 1065 bool forced_draw,
1063 bool swap_requested, 1066 bool swap_requested,
1064 bool readback_requested) { 1067 bool readback_requested) {
1068 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap");
1065 DrawSwapReadbackResult result; 1069 DrawSwapReadbackResult result;
1066 result.did_draw = false; 1070 result.did_draw = false;
1067 result.did_swap = false; 1071 result.did_swap = false;
1068 result.did_readback = false; 1072 result.did_readback = false;
1069 DCHECK(IsImplThread()); 1073 DCHECK(IsImplThread());
1070 DCHECK(layer_tree_host_impl_.get()); 1074 DCHECK(layer_tree_host_impl_.get());
1071 if (!layer_tree_host_impl_) 1075 if (!layer_tree_host_impl_)
1072 return result; 1076 return result;
1073 1077
1074 DCHECK(layer_tree_host_impl_->renderer()); 1078 DCHECK(layer_tree_host_impl_->renderer());
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 commit_to_activate_duration_history_.InsertSample( 1630 commit_to_activate_duration_history_.InsertSample(
1627 base::TimeTicks::HighResNow() - commit_complete_time_); 1631 base::TimeTicks::HighResNow() - commit_complete_time_);
1628 } 1632 }
1629 1633
1630 void ThreadProxy::DidManageTiles() { 1634 void ThreadProxy::DidManageTiles() {
1631 DCHECK(IsImplThread()); 1635 DCHECK(IsImplThread());
1632 scheduler_on_impl_thread_->DidManageTiles(); 1636 scheduler_on_impl_thread_->DidManageTiles();
1633 } 1637 }
1634 1638
1635 } // namespace cc 1639 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698