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/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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 return metadata; | 1089 return metadata; |
1090 } | 1090 } |
1091 | 1091 |
1092 bool LayerTreeHostImpl::AllowPartialSwap() const { | 1092 bool LayerTreeHostImpl::AllowPartialSwap() const { |
1093 // We don't track damage on the HUD layer (it interacts with damage tracking | 1093 // We don't track damage on the HUD layer (it interacts with damage tracking |
1094 // visualizations), so disable partial swaps to make the HUD layer display | 1094 // visualizations), so disable partial swaps to make the HUD layer display |
1095 // properly. | 1095 // properly. |
1096 return !debug_state_.ShowHudRects(); | 1096 return !debug_state_.ShowHudRects(); |
1097 } | 1097 } |
1098 | 1098 |
| 1099 class DidBeginTracingFunctor { |
| 1100 public: |
| 1101 void operator()(LayerImpl* layer) { |
| 1102 layer->DidBeginTracing(); |
| 1103 } |
| 1104 }; |
| 1105 |
1099 void LayerTreeHostImpl::DrawLayers(FrameData* frame, | 1106 void LayerTreeHostImpl::DrawLayers(FrameData* frame, |
1100 base::TimeTicks frame_begin_time) { | 1107 base::TimeTicks frame_begin_time) { |
1101 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); | 1108 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); |
1102 DCHECK(CanDraw()); | 1109 DCHECK(CanDraw()); |
1103 | 1110 |
1104 if (frame->has_no_damage) | 1111 if (frame->has_no_damage) |
1105 return; | 1112 return; |
1106 | 1113 |
1107 DCHECK(!frame->render_passes.empty()); | 1114 DCHECK(!frame->render_passes.empty()); |
1108 | 1115 |
(...skipping 17 matching lines...) Expand all Loading... |
1126 frame->non_occluding_screen_space_rects, | 1133 frame->non_occluding_screen_space_rects, |
1127 debug_state_); | 1134 debug_state_); |
1128 } | 1135 } |
1129 | 1136 |
1130 if (!settings_.impl_side_painting && debug_state_.continuous_painting) { | 1137 if (!settings_.impl_side_painting && debug_state_.continuous_painting) { |
1131 const RenderingStats& stats = | 1138 const RenderingStats& stats = |
1132 rendering_stats_instrumentation_->GetRenderingStats(); | 1139 rendering_stats_instrumentation_->GetRenderingStats(); |
1133 paint_time_counter_->SavePaintTime(stats.total_paint_time); | 1140 paint_time_counter_->SavePaintTime(stats.total_paint_time); |
1134 } | 1141 } |
1135 | 1142 |
| 1143 bool is_new_trace; |
| 1144 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); |
| 1145 if (is_new_trace) { |
| 1146 if (pending_tree_) |
| 1147 LayerTreeHostCommon::CallFunctionForSubtree< |
| 1148 DidBeginTracingFunctor, LayerImpl>( |
| 1149 pending_tree_->root_layer()); |
| 1150 LayerTreeHostCommon::CallFunctionForSubtree< |
| 1151 DidBeginTracingFunctor, LayerImpl>( |
| 1152 active_tree_->root_layer()); |
| 1153 } |
| 1154 |
1136 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 1155 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
1137 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", this, | 1156 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", this, |
1138 TracedValue::FromValue(AsValue().release())); | 1157 TracedValue::FromValue(AsValue().release())); |
1139 | 1158 |
1140 // Because the contents of the HUD depend on everything else in the frame, the | 1159 // Because the contents of the HUD depend on everything else in the frame, the |
1141 // contents of its texture are updated as the last thing before the frame is | 1160 // contents of its texture are updated as the last thing before the frame is |
1142 // drawn. | 1161 // drawn. |
1143 if (active_tree_->hud_layer()) | 1162 if (active_tree_->hud_layer()) |
1144 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); | 1163 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); |
1145 | 1164 |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2242 } | 2261 } |
2243 | 2262 |
2244 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2263 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
2245 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2264 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
2246 paint_time_counter_->ClearHistory(); | 2265 paint_time_counter_->ClearHistory(); |
2247 | 2266 |
2248 debug_state_ = debug_state; | 2267 debug_state_ = debug_state; |
2249 } | 2268 } |
2250 | 2269 |
2251 } // namespace cc | 2270 } // namespace cc |
OLD | NEW |