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

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

Issue 15774010: Add TRACE_EVENT_IS_NEW_TRACE as a way to snapshot objects at start of recording (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 months 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
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 return metadata; 1100 return metadata;
1101 } 1101 }
1102 1102
1103 bool LayerTreeHostImpl::AllowPartialSwap() const { 1103 bool LayerTreeHostImpl::AllowPartialSwap() const {
1104 // We don't track damage on the HUD layer (it interacts with damage tracking 1104 // We don't track damage on the HUD layer (it interacts with damage tracking
1105 // visualizations), so disable partial swaps to make the HUD layer display 1105 // visualizations), so disable partial swaps to make the HUD layer display
1106 // properly. 1106 // properly.
1107 return !debug_state_.ShowHudRects(); 1107 return !debug_state_.ShowHudRects();
1108 } 1108 }
1109 1109
1110 class DidBeginTracingFunctor {
1111 public:
1112 void operator()(LayerImpl* layer) {
1113 layer->DidBeginTracing();
1114 }
1115 };
1116
1110 void LayerTreeHostImpl::DrawLayers(FrameData* frame, 1117 void LayerTreeHostImpl::DrawLayers(FrameData* frame,
1111 base::TimeTicks frame_begin_time) { 1118 base::TimeTicks frame_begin_time) {
1112 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); 1119 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers");
1113 DCHECK(CanDraw()); 1120 DCHECK(CanDraw());
1114 1121
1115 if (frame->has_no_damage) 1122 if (frame->has_no_damage)
1116 return; 1123 return;
1117 1124
1118 DCHECK(!frame->render_passes.empty()); 1125 DCHECK(!frame->render_passes.empty());
1119 1126
(...skipping 17 matching lines...) Expand all
1137 frame->non_occluding_screen_space_rects, 1144 frame->non_occluding_screen_space_rects,
1138 debug_state_); 1145 debug_state_);
1139 } 1146 }
1140 1147
1141 if (!settings_.impl_side_painting && debug_state_.continuous_painting) { 1148 if (!settings_.impl_side_painting && debug_state_.continuous_painting) {
1142 const RenderingStats& stats = 1149 const RenderingStats& stats =
1143 rendering_stats_instrumentation_->GetRenderingStats(); 1150 rendering_stats_instrumentation_->GetRenderingStats();
1144 paint_time_counter_->SavePaintTime(stats.total_paint_time); 1151 paint_time_counter_->SavePaintTime(stats.total_paint_time);
1145 } 1152 }
1146 1153
1154 bool is_new_trace;
1155 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace);
1156 if (is_new_trace) {
1157 if (pending_tree_)
1158 LayerTreeHostCommon::CallFunctionForSubtree<
1159 DidBeginTracingFunctor, LayerImpl>(
1160 pending_tree_->root_layer());
1161 LayerTreeHostCommon::CallFunctionForSubtree<
1162 DidBeginTracingFunctor, LayerImpl>(
1163 active_tree_->root_layer());
1164 }
1165
1147 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( 1166 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
1148 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", this, 1167 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", this,
1149 TracedValue::FromValue(AsValue().release())); 1168 TracedValue::FromValue(AsValue().release()));
1150 1169
1151 // Because the contents of the HUD depend on everything else in the frame, the 1170 // Because the contents of the HUD depend on everything else in the frame, the
1152 // contents of its texture are updated as the last thing before the frame is 1171 // contents of its texture are updated as the last thing before the frame is
1153 // drawn. 1172 // drawn.
1154 if (active_tree_->hud_layer()) 1173 if (active_tree_->hud_layer())
1155 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); 1174 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get());
1156 1175
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 } 2272 }
2254 2273
2255 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { 2274 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) {
2256 if (debug_state_.continuous_painting != debug_state.continuous_painting) 2275 if (debug_state_.continuous_painting != debug_state.continuous_painting)
2257 paint_time_counter_->ClearHistory(); 2276 paint_time_counter_->ClearHistory();
2258 2277
2259 debug_state_ = debug_state; 2278 debug_state_ = debug_state;
2260 } 2279 }
2261 2280
2262 } // namespace cc 2281 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698