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

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

Issue 421183003: Revert of Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_impl.h » ('j') | 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 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/debug/trace_event_argument.h"
13 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
14 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
15 #include "base/stl_util.h" 14 #include "base/stl_util.h"
16 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
17 #include "cc/animation/animation_id_provider.h" 16 #include "cc/animation/animation_id_provider.h"
18 #include "cc/animation/scroll_offset_animation_curve.h" 17 #include "cc/animation/scroll_offset_animation_curve.h"
19 #include "cc/animation/scrollbar_animation_controller.h" 18 #include "cc/animation/scrollbar_animation_controller.h"
20 #include "cc/animation/timing_function.h" 19 #include "cc/animation/timing_function.h"
21 #include "cc/base/latency_info_swap_promise_monitor.h" 20 #include "cc/base/latency_info_swap_promise_monitor.h"
22 #include "cc/base/math_util.h" 21 #include "cc/base/math_util.h"
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 render_surface->damage_tracker()->UpdateDamageTrackingState( 521 render_surface->damage_tracker()->UpdateDamageTrackingState(
523 render_surface->layer_list(), 522 render_surface->layer_list(),
524 render_surface_layer->id(), 523 render_surface_layer->id(),
525 render_surface->SurfacePropertyChangedOnlyFromDescendant(), 524 render_surface->SurfacePropertyChangedOnlyFromDescendant(),
526 render_surface->content_rect(), 525 render_surface->content_rect(),
527 render_surface_layer->mask_layer(), 526 render_surface_layer->mask_layer(),
528 render_surface_layer->filters()); 527 render_surface_layer->filters());
529 } 528 }
530 } 529 }
531 530
532 void LayerTreeHostImpl::FrameData::AsValueInto( 531 scoped_ptr<base::Value> LayerTreeHostImpl::FrameData::AsValue() const {
533 base::debug::TracedValue* value) const { 532 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
534 value->SetBoolean("contains_incomplete_tile", contains_incomplete_tile); 533 value->SetBoolean("contains_incomplete_tile", contains_incomplete_tile);
535 value->SetBoolean("has_no_damage", has_no_damage); 534 value->SetBoolean("has_no_damage", has_no_damage);
536 535
537 // Quad data can be quite large, so only dump render passes if we select 536 // Quad data can be quite large, so only dump render passes if we select
538 // cc.debug.quads. 537 // cc.debug.quads.
539 bool quads_enabled; 538 bool quads_enabled;
540 TRACE_EVENT_CATEGORY_GROUP_ENABLED( 539 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
541 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), &quads_enabled); 540 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), &quads_enabled);
542 if (quads_enabled) { 541 if (quads_enabled) {
543 value->BeginArray("render_passes"); 542 scoped_ptr<base::ListValue> render_pass_list(new base::ListValue());
544 for (size_t i = 0; i < render_passes.size(); ++i) { 543 for (size_t i = 0; i < render_passes.size(); ++i)
545 value->BeginDictionary(); 544 render_pass_list->Append(render_passes[i]->AsValue().release());
546 render_passes[i]->AsValueInto(value); 545 value->Set("render_passes", render_pass_list.release());
547 value->EndDictionary();
548 }
549 value->EndArray();
550 } 546 }
547 return value.PassAs<base::Value>();
551 } 548 }
552 549
553 void LayerTreeHostImpl::FrameData::AppendRenderPass( 550 void LayerTreeHostImpl::FrameData::AppendRenderPass(
554 scoped_ptr<RenderPass> render_pass) { 551 scoped_ptr<RenderPass> render_pass) {
555 render_passes_by_id[render_pass->id] = render_pass.get(); 552 render_passes_by_id[render_pass->id] = render_pass.get();
556 render_passes.push_back(render_pass.Pass()); 553 render_passes.push_back(render_pass.Pass());
557 } 554 }
558 555
559 DrawMode LayerTreeHostImpl::GetDrawMode() const { 556 DrawMode LayerTreeHostImpl::GetDrawMode() const {
560 if (resourceless_software_draw_) { 557 if (resourceless_software_draw_) {
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 } 1536 }
1540 1537
1541 { 1538 {
1542 TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing"); 1539 TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing");
1543 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( 1540 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
1544 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," 1541 TRACE_DISABLED_BY_DEFAULT("cc.debug") ","
1545 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads") "," 1542 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads") ","
1546 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers"), 1543 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers"),
1547 "cc::LayerTreeHostImpl", 1544 "cc::LayerTreeHostImpl",
1548 id_, 1545 id_,
1549 AsValueWithFrame(frame)); 1546 TracedValue::FromValue(AsValueWithFrame(frame).release()));
1550 } 1547 }
1551 1548
1552 const DrawMode draw_mode = GetDrawMode(); 1549 const DrawMode draw_mode = GetDrawMode();
1553 1550
1554 // Because the contents of the HUD depend on everything else in the frame, the 1551 // Because the contents of the HUD depend on everything else in the frame, the
1555 // contents of its texture are updated as the last thing before the frame is 1552 // contents of its texture are updated as the last thing before the frame is
1556 // drawn. 1553 // drawn.
1557 if (active_tree_->hud_layer()) { 1554 if (active_tree_->hud_layer()) {
1558 TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture"); 1555 TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture");
1559 active_tree_->hud_layer()->UpdateHudTexture(draw_mode, 1556 active_tree_->hud_layer()->UpdateHudTexture(draw_mode,
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
3165 3162
3166 base::TimeTicks LayerTreeHostImpl::CurrentFrameTimeTicks() { 3163 base::TimeTicks LayerTreeHostImpl::CurrentFrameTimeTicks() {
3167 // Try to use the current frame time to keep animations non-jittery. But if 3164 // Try to use the current frame time to keep animations non-jittery. But if
3168 // we're not in a frame (because this is during an input event or a delayed 3165 // we're not in a frame (because this is during an input event or a delayed
3169 // task), fall back to physical time. This should still be monotonic. 3166 // task), fall back to physical time. This should still be monotonic.
3170 if (!current_frame_timeticks_.is_null()) 3167 if (!current_frame_timeticks_.is_null())
3171 return current_frame_timeticks_; 3168 return current_frame_timeticks_;
3172 return gfx::FrameTime::Now(); 3169 return gfx::FrameTime::Now();
3173 } 3170 }
3174 3171
3175 scoped_refptr<base::debug::ConvertableToTraceFormat> 3172 scoped_ptr<base::Value> LayerTreeHostImpl::AsValueWithFrame(
3176 LayerTreeHostImpl::AsValue() const { 3173 FrameData* frame) const {
3177 return AsValueWithFrame(NULL); 3174 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
3175 if (this->pending_tree_)
3176 state->Set("activation_state", ActivationStateAsValue().release());
3177 state->Set("device_viewport_size",
3178 MathUtil::AsValue(device_viewport_size_).release());
3179 if (tile_manager_)
3180 state->Set("tiles", tile_manager_->AllTilesAsValue().release());
3181 state->Set("active_tree", active_tree_->AsValue().release());
3182 if (pending_tree_)
3183 state->Set("pending_tree", pending_tree_->AsValue().release());
3184 if (frame)
3185 state->Set("frame", frame->AsValue().release());
3186 return state.PassAs<base::Value>();
3178 } 3187 }
3179 3188
3180 scoped_refptr<base::debug::ConvertableToTraceFormat> 3189 scoped_ptr<base::Value> LayerTreeHostImpl::ActivationStateAsValue() const {
3181 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { 3190 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
3182 scoped_refptr<base::debug::TracedValue> state = 3191 state->Set("lthi", TracedValue::CreateIDRef(this).release());
3183 new base::debug::TracedValue(); 3192 if (tile_manager_)
3184 AsValueWithFrameInto(frame, state.get()); 3193 state->Set("tile_manager", tile_manager_->BasicStateAsValue().release());
3185 return state; 3194 return state.PassAs<base::Value>();
3186 }
3187
3188 void LayerTreeHostImpl::AsValueWithFrameInto(
3189 FrameData* frame,
3190 base::debug::TracedValue* state) const {
3191 if (this->pending_tree_) {
3192 state->BeginDictionary("activation_state");
3193 ActivationStateAsValueInto(state);
3194 state->EndDictionary();
3195 }
3196 state->BeginDictionary("device_viewport_size");
3197 MathUtil::AddToTracedValue(device_viewport_size_, state);
3198 state->EndDictionary();
3199 if (tile_manager_) {
3200 state->BeginArray("tiles");
3201 tile_manager_->AllTilesAsValueInto(state);
3202 state->EndArray();
3203 }
3204 state->BeginDictionary("active_tree");
3205 active_tree_->AsValueInto(state);
3206 state->EndDictionary();
3207 if (pending_tree_) {
3208 state->BeginDictionary("pending_tree");
3209 pending_tree_->AsValueInto(state);
3210 state->EndDictionary();
3211 }
3212 if (frame) {
3213 state->BeginDictionary("frame");
3214 frame->AsValueInto(state);
3215 state->EndDictionary();
3216 }
3217 }
3218
3219 scoped_refptr<base::debug::ConvertableToTraceFormat>
3220 LayerTreeHostImpl::ActivationStateAsValue() const {
3221 scoped_refptr<base::debug::TracedValue> state =
3222 new base::debug::TracedValue();
3223 ActivationStateAsValueInto(state.get());
3224 return state;
3225 }
3226
3227 void LayerTreeHostImpl::ActivationStateAsValueInto(
3228 base::debug::TracedValue* state) const {
3229 TracedValue::SetIDRef(this, state, "lthi");
3230 if (tile_manager_) {
3231 state->BeginDictionary("tile_manager");
3232 tile_manager_->BasicStateAsValueInto(state);
3233 state->EndDictionary();
3234 }
3235 } 3195 }
3236 3196
3237 void LayerTreeHostImpl::SetDebugState( 3197 void LayerTreeHostImpl::SetDebugState(
3238 const LayerTreeDebugState& new_debug_state) { 3198 const LayerTreeDebugState& new_debug_state) {
3239 if (LayerTreeDebugState::Equal(debug_state_, new_debug_state)) 3199 if (LayerTreeDebugState::Equal(debug_state_, new_debug_state))
3240 return; 3200 return;
3241 if (debug_state_.continuous_painting != new_debug_state.continuous_painting) 3201 if (debug_state_.continuous_painting != new_debug_state.continuous_painting)
3242 paint_time_counter_->ClearHistory(); 3202 paint_time_counter_->ClearHistory();
3243 3203
3244 debug_state_ = new_debug_state; 3204 debug_state_ = new_debug_state;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 } 3331 }
3372 3332
3373 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3333 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3374 std::vector<PictureLayerImpl*>::iterator it = 3334 std::vector<PictureLayerImpl*>::iterator it =
3375 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3335 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3376 DCHECK(it != picture_layers_.end()); 3336 DCHECK(it != picture_layers_.end());
3377 picture_layers_.erase(it); 3337 picture_layers_.erase(it);
3378 } 3338 }
3379 3339
3380 } // namespace cc 3340 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698