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

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: Address David's comments. Created 7 years 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/base/swap_promise.h" 14 #include "cc/base/swap_promise.h"
14 #include "cc/debug/benchmark_instrumentation.h" 15 #include "cc/debug/benchmark_instrumentation.h"
15 #include "cc/input/input_handler.h" 16 #include "cc/input/input_handler.h"
16 #include "cc/output/context_provider.h" 17 #include "cc/output/context_provider.h"
17 #include "cc/output/output_surface.h" 18 #include "cc/output/output_surface.h"
18 #include "cc/quads/draw_quad.h" 19 #include "cc/quads/draw_quad.h"
19 #include "cc/resources/prioritized_resource_manager.h" 20 #include "cc/resources/prioritized_resource_manager.h"
20 #include "cc/scheduler/delay_based_time_source.h" 21 #include "cc/scheduler/delay_based_time_source.h"
21 #include "cc/scheduler/frame_rate_controller.h" 22 #include "cc/scheduler/frame_rate_controller.h"
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 if (begin_main_frame_sent_completion_event_on_impl_thread_) { 755 if (begin_main_frame_sent_completion_event_on_impl_thread_) {
755 begin_main_frame_sent_completion_event_on_impl_thread_->Signal(); 756 begin_main_frame_sent_completion_event_on_impl_thread_->Signal();
756 begin_main_frame_sent_completion_event_on_impl_thread_ = NULL; 757 begin_main_frame_sent_completion_event_on_impl_thread_ = NULL;
757 } 758 }
758 begin_main_frame_sent_time_ = base::TimeTicks::HighResNow(); 759 begin_main_frame_sent_time_ = base::TimeTicks::HighResNow();
759 } 760 }
760 761
761 void ThreadProxy::BeginMainFrame( 762 void ThreadProxy::BeginMainFrame(
762 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { 763 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) {
763 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame"); 764 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame");
765 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame");
764 DCHECK(IsMainThread()); 766 DCHECK(IsMainThread());
765 767
766 if (!layer_tree_host()) 768 if (!layer_tree_host())
767 return; 769 return;
768 770
769 if (defer_commits_) { 771 if (defer_commits_) {
770 pending_deferred_commit_ = begin_main_frame_state.Pass(); 772 pending_deferred_commit_ = begin_main_frame_state.Pass();
771 layer_tree_host()->DidDeferCommit(); 773 layer_tree_host()->DidDeferCommit();
772 TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); 774 TRACE_EVENT0("cc", "EarlyOut_DeferCommits");
773 return; 775 return;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 837
836 // Recreate all UI resources if there were evicted UI resources when the impl 838 // Recreate all UI resources if there were evicted UI resources when the impl
837 // thread initiated the commit. 839 // thread initiated the commit.
838 bool evicted_ui_resources = begin_main_frame_state 840 bool evicted_ui_resources = begin_main_frame_state
839 ? begin_main_frame_state->evicted_ui_resources 841 ? begin_main_frame_state->evicted_ui_resources
840 : false; 842 : false;
841 if (evicted_ui_resources) 843 if (evicted_ui_resources)
842 layer_tree_host()->RecreateUIResources(); 844 layer_tree_host()->RecreateUIResources();
843 845
844 layer_tree_host()->Layout(); 846 layer_tree_host()->Layout();
847 TRACE_EVENT_SYNTHETIC_DELAY_END("cc.BeginMainFrame");
845 848
846 // Clear the commit flag after updating animations and layout here --- objects 849 // Clear the commit flag after updating animations and layout here --- objects
847 // that only layout when painted will trigger another SetNeedsCommit inside 850 // that only layout when painted will trigger another SetNeedsCommit inside
848 // UpdateLayers. 851 // UpdateLayers.
849 commit_requested_ = false; 852 commit_requested_ = false;
850 commit_request_sent_to_impl_thread_ = false; 853 commit_request_sent_to_impl_thread_ = false;
851 bool can_cancel_this_commit = 854 bool can_cancel_this_commit =
852 can_cancel_commit_ && 855 can_cancel_commit_ &&
853 !in_composite_and_readback_ && 856 !in_composite_and_readback_ &&
854 !evicted_ui_resources; 857 !evicted_ui_resources;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 Proxy::MainThreadTaskRunner()->PostTask( 1076 Proxy::MainThreadTaskRunner()->PostTask(
1074 FROM_HERE, 1077 FROM_HERE,
1075 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface, 1078 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface,
1076 main_thread_weak_ptr_)); 1079 main_thread_weak_ptr_));
1077 } 1080 }
1078 1081
1079 DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal( 1082 DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
1080 bool forced_draw, 1083 bool forced_draw,
1081 bool swap_requested, 1084 bool swap_requested,
1082 bool readback_requested) { 1085 bool readback_requested) {
1086 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap");
1083 DrawSwapReadbackResult result; 1087 DrawSwapReadbackResult result;
1084 result.did_draw = false; 1088 result.did_draw = false;
1085 result.did_swap = false; 1089 result.did_swap = false;
1086 result.did_readback = false; 1090 result.did_readback = false;
1087 DCHECK(IsImplThread()); 1091 DCHECK(IsImplThread());
1088 DCHECK(layer_tree_host_impl_.get()); 1092 DCHECK(layer_tree_host_impl_.get());
1089 if (!layer_tree_host_impl_) 1093 if (!layer_tree_host_impl_)
1090 return result; 1094 return result;
1091 1095
1092 DCHECK(layer_tree_host_impl_->renderer()); 1096 DCHECK(layer_tree_host_impl_->renderer());
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 commit_to_activate_duration_history_.InsertSample( 1649 commit_to_activate_duration_history_.InsertSample(
1646 base::TimeTicks::HighResNow() - commit_complete_time_); 1650 base::TimeTicks::HighResNow() - commit_complete_time_);
1647 } 1651 }
1648 1652
1649 void ThreadProxy::DidManageTiles() { 1653 void ThreadProxy::DidManageTiles() {
1650 DCHECK(IsImplThread()); 1654 DCHECK(IsImplThread());
1651 scheduler_on_impl_thread_->DidManageTiles(); 1655 scheduler_on_impl_thread_->DidManageTiles();
1652 } 1656 }
1653 1657
1654 } // namespace cc 1658 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698