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

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

Issue 20667002: cc: Add frame data to LTHI tracing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« cc/quads/draw_quad.cc ('K') | « cc/trees/layer_tree_host_impl.h ('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/containers/hash_tables.h"
10 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
11 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
12 #include "base/stl_util.h" 13 #include "base/stl_util.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "cc/animation/scrollbar_animation_controller.h" 15 #include "cc/animation/scrollbar_animation_controller.h"
15 #include "cc/animation/timing_function.h" 16 #include "cc/animation/timing_function.h"
16 #include "cc/base/math_util.h" 17 #include "cc/base/math_util.h"
17 #include "cc/base/util.h" 18 #include "cc/base/util.h"
18 #include "cc/debug/debug_rect_history.h" 19 #include "cc/debug/debug_rect_history.h"
19 #include "cc/debug/frame_rate_counter.h" 20 #include "cc/debug/frame_rate_counter.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 render_surface->layer_list(), 418 render_surface->layer_list(),
418 render_surface_layer->id(), 419 render_surface_layer->id(),
419 render_surface->SurfacePropertyChangedOnlyFromDescendant(), 420 render_surface->SurfacePropertyChangedOnlyFromDescendant(),
420 render_surface->content_rect(), 421 render_surface->content_rect(),
421 render_surface_layer->mask_layer(), 422 render_surface_layer->mask_layer(),
422 render_surface_layer->filters(), 423 render_surface_layer->filters(),
423 render_surface_layer->filter().get()); 424 render_surface_layer->filter().get());
424 } 425 }
425 } 426 }
426 427
428 scoped_ptr<base::Value> LayerTreeHostImpl::FrameData::AsValue() const {
429 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
430 scoped_ptr<base::ListValue> occluding_list(new base::ListValue());
431 for (size_t i = 0; i < occluding_screen_space_rects.size(); ++i) {
432 occluding_list->Append(MathUtil::AsValue(
433 occluding_screen_space_rects[i]).release());
434 }
435 value->Set("occluding_screen_space_rects", occluding_list.release());
danakj 2013/07/26 16:53:59 These 3 lists only exist when you are showing them
piman 2013/07/31 00:36:43 Removed those (2) lists.
436 scoped_ptr<base::ListValue> non_occluding_list(new base::ListValue());
437 for (size_t i = 0; i < non_occluding_screen_space_rects.size(); ++i) {
438 non_occluding_list->Append(MathUtil::AsValue(
439 non_occluding_screen_space_rects[i]).release());
440 }
441 value->Set("non_occluding_screen_space_rects", non_occluding_list.release());
442 scoped_ptr<base::ListValue> render_pass_list(new base::ListValue());
443 for (size_t i = 0; i < render_passes.size(); ++i)
444 render_pass_list->Append(render_passes[i]->AsValue().release());
445 value->Set("render_passes", render_pass_list.release());
446 value->SetBoolean("contains_incomplete_tile", contains_incomplete_tile);
447 value->SetBoolean("has_no_damage", has_no_damage);
448 return value.PassAs<base::Value>();
449 }
450
427 void LayerTreeHostImpl::FrameData::AppendRenderPass( 451 void LayerTreeHostImpl::FrameData::AppendRenderPass(
428 scoped_ptr<RenderPass> render_pass) { 452 scoped_ptr<RenderPass> render_pass) {
429 render_passes_by_id[render_pass->id] = render_pass.get(); 453 render_passes_by_id[render_pass->id] = render_pass.get();
430 render_passes.push_back(render_pass.Pass()); 454 render_passes.push_back(render_pass.Pass());
431 } 455 }
432 456
433 static DrawMode GetDrawMode(OutputSurface* output_surface) { 457 static DrawMode GetDrawMode(OutputSurface* output_surface) {
434 if (output_surface->ForcedDrawToSoftwareDevice()) { 458 if (output_surface->ForcedDrawToSoftwareDevice()) {
435 return DRAW_MODE_RESOURCELESS_SOFTWARE; 459 return DRAW_MODE_RESOURCELESS_SOFTWARE;
436 } else if (output_surface->context3d()) { 460 } else if (output_surface->context3d()) {
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 pending_tree_->root_layer(), 1244 pending_tree_->root_layer(),
1221 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); 1245 base::Bind(&LayerTreeHostImplDidBeginTracingCallback));
1222 } 1246 }
1223 LayerTreeHostCommon::CallFunctionForSubtree( 1247 LayerTreeHostCommon::CallFunctionForSubtree(
1224 active_tree_->root_layer(), 1248 active_tree_->root_layer(),
1225 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); 1249 base::Bind(&LayerTreeHostImplDidBeginTracingCallback));
1226 } 1250 }
1227 1251
1228 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( 1252 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
1229 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", this, 1253 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", this,
1230 TracedValue::FromValue(AsValue().release())); 1254 TracedValue::FromValue(AsValueWithFrame(frame).release()));
danakj 2013/07/26 16:53:59 If frame->has_no_damage, you don't get here. Also
piman 2013/07/31 00:36:43 For 2 reasons we want to leave it here: 1- we want
1231 1255
1232 // Because the contents of the HUD depend on everything else in the frame, the 1256 // Because the contents of the HUD depend on everything else in the frame, the
1233 // contents of its texture are updated as the last thing before the frame is 1257 // contents of its texture are updated as the last thing before the frame is
1234 // drawn. 1258 // drawn.
1235 if (active_tree_->hud_layer()) 1259 if (active_tree_->hud_layer())
1236 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); 1260 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get());
1237 1261
1238 if (output_surface_->ForcedDrawToSoftwareDevice()) { 1262 if (output_surface_->ForcedDrawToSoftwareDevice()) {
1239 scoped_ptr<SoftwareRenderer> temp_software_renderer = 1263 scoped_ptr<SoftwareRenderer> temp_software_renderer =
1240 SoftwareRenderer::Create(this, output_surface_.get(), NULL); 1264 SoftwareRenderer::Create(this, output_surface_.get(), NULL);
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 2395
2372 base::Time LayerTreeHostImpl::CurrentFrameTime() { 2396 base::Time LayerTreeHostImpl::CurrentFrameTime() {
2373 UpdateCurrentFrameTime(&current_frame_timeticks_, &current_frame_time_); 2397 UpdateCurrentFrameTime(&current_frame_timeticks_, &current_frame_time_);
2374 return current_frame_time_; 2398 return current_frame_time_;
2375 } 2399 }
2376 2400
2377 base::TimeTicks LayerTreeHostImpl::CurrentPhysicalTimeTicks() const { 2401 base::TimeTicks LayerTreeHostImpl::CurrentPhysicalTimeTicks() const {
2378 return base::TimeTicks::Now(); 2402 return base::TimeTicks::Now();
2379 } 2403 }
2380 2404
2381 scoped_ptr<base::Value> LayerTreeHostImpl::AsValue() const { 2405 scoped_ptr<base::Value> LayerTreeHostImpl::AsValueWithFrame(
2406 FrameData* frame) const {
2382 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 2407 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
2383 if (this->pending_tree_) 2408 if (this->pending_tree_)
2384 state->Set("activation_state", ActivationStateAsValue().release()); 2409 state->Set("activation_state", ActivationStateAsValue().release());
2385 state->Set("device_viewport_size", 2410 state->Set("device_viewport_size",
2386 MathUtil::AsValue(device_viewport_size_).release()); 2411 MathUtil::AsValue(device_viewport_size_).release());
2387 if (tile_manager_) 2412 if (tile_manager_)
2388 state->Set("tiles", tile_manager_->AllTilesAsValue().release()); 2413 state->Set("tiles", tile_manager_->AllTilesAsValue().release());
2389 state->Set("active_tree", active_tree_->AsValue().release()); 2414 state->Set("active_tree", active_tree_->AsValue().release());
2390 if (pending_tree_) 2415 if (pending_tree_)
2391 state->Set("pending_tree", pending_tree_->AsValue().release()); 2416 state->Set("pending_tree", pending_tree_->AsValue().release());
2417 if (frame)
2418 state->Set("frame", frame->AsValue().release());
2392 return state.PassAs<base::Value>(); 2419 return state.PassAs<base::Value>();
2393 } 2420 }
2394 2421
2395 scoped_ptr<base::Value> LayerTreeHostImpl::ActivationStateAsValue() const { 2422 scoped_ptr<base::Value> LayerTreeHostImpl::ActivationStateAsValue() const {
2396 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 2423 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
2397 state->Set("lthi", TracedValue::CreateIDRef(this).release()); 2424 state->Set("lthi", TracedValue::CreateIDRef(this).release());
2398 if (tile_manager_) 2425 if (tile_manager_)
2399 state->Set("tile_manager", tile_manager_->BasicStateAsValue().release()); 2426 state->Set("tile_manager", tile_manager_->BasicStateAsValue().release());
2400 return state.PassAs<base::Value>(); 2427 return state.PassAs<base::Value>();
2401 } 2428 }
2402 2429
2403 void LayerTreeHostImpl::SetDebugState( 2430 void LayerTreeHostImpl::SetDebugState(
2404 const LayerTreeDebugState& new_debug_state) { 2431 const LayerTreeDebugState& new_debug_state) {
2405 if (LayerTreeDebugState::Equal(debug_state_, new_debug_state)) 2432 if (LayerTreeDebugState::Equal(debug_state_, new_debug_state))
2406 return; 2433 return;
2407 if (debug_state_.continuous_painting != new_debug_state.continuous_painting) 2434 if (debug_state_.continuous_painting != new_debug_state.continuous_painting)
2408 paint_time_counter_->ClearHistory(); 2435 paint_time_counter_->ClearHistory();
2409 2436
2410 debug_state_ = new_debug_state; 2437 debug_state_ = new_debug_state;
2411 SetFullRootLayerDamage(); 2438 SetFullRootLayerDamage();
2412 } 2439 }
2413 2440
2414 } // namespace cc 2441 } // namespace cc
OLDNEW
« cc/quads/draw_quad.cc ('K') | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698