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 #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/traced_value.h" |
12 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
16 #include "cc/animation/scrollbar_animation_controller.h" | 17 #include "cc/animation/scrollbar_animation_controller.h" |
17 #include "cc/animation/timing_function.h" | 18 #include "cc/animation/timing_function.h" |
18 #include "cc/base/latency_info_swap_promise_monitor.h" | 19 #include "cc/base/latency_info_swap_promise_monitor.h" |
19 #include "cc/base/math_util.h" | 20 #include "cc/base/math_util.h" |
20 #include "cc/base/util.h" | 21 #include "cc/base/util.h" |
21 #include "cc/debug/benchmark_instrumentation.h" | 22 #include "cc/debug/benchmark_instrumentation.h" |
22 #include "cc/debug/debug_rect_history.h" | 23 #include "cc/debug/debug_rect_history.h" |
23 #include "cc/debug/devtools_instrumentation.h" | 24 #include "cc/debug/devtools_instrumentation.h" |
24 #include "cc/debug/frame_rate_counter.h" | 25 #include "cc/debug/frame_rate_counter.h" |
25 #include "cc/debug/paint_time_counter.h" | 26 #include "cc/debug/paint_time_counter.h" |
26 #include "cc/debug/rendering_stats_instrumentation.h" | 27 #include "cc/debug/rendering_stats_instrumentation.h" |
27 #include "cc/debug/traced_value.h" | |
28 #include "cc/input/page_scale_animation.h" | 28 #include "cc/input/page_scale_animation.h" |
29 #include "cc/input/top_controls_manager.h" | 29 #include "cc/input/top_controls_manager.h" |
30 #include "cc/layers/append_quads_data.h" | 30 #include "cc/layers/append_quads_data.h" |
31 #include "cc/layers/heads_up_display_layer_impl.h" | 31 #include "cc/layers/heads_up_display_layer_impl.h" |
32 #include "cc/layers/layer_impl.h" | 32 #include "cc/layers/layer_impl.h" |
33 #include "cc/layers/layer_iterator.h" | 33 #include "cc/layers/layer_iterator.h" |
34 #include "cc/layers/painted_scrollbar_layer_impl.h" | 34 #include "cc/layers/painted_scrollbar_layer_impl.h" |
35 #include "cc/layers/render_surface_impl.h" | 35 #include "cc/layers/render_surface_impl.h" |
36 #include "cc/layers/scrollbar_layer_impl_base.h" | 36 #include "cc/layers/scrollbar_layer_impl_base.h" |
37 #include "cc/output/compositor_frame_metadata.h" | 37 #include "cc/output/compositor_frame_metadata.h" |
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 LayerTreeHostCommon::CallFunctionForSubtree( | 1444 LayerTreeHostCommon::CallFunctionForSubtree( |
1445 pending_tree_->root_layer(), | 1445 pending_tree_->root_layer(), |
1446 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); | 1446 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); |
1447 } | 1447 } |
1448 LayerTreeHostCommon::CallFunctionForSubtree( | 1448 LayerTreeHostCommon::CallFunctionForSubtree( |
1449 active_tree_->root_layer(), | 1449 active_tree_->root_layer(), |
1450 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); | 1450 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); |
1451 } | 1451 } |
1452 | 1452 |
1453 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 1453 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
1454 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," | 1454 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( |
1455 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), "cc::LayerTreeHostImpl", | 1455 "cc.debug.quads"), |
1456 this, TracedValue::FromValue(AsValueWithFrame(frame).release())); | 1456 "cc::LayerTreeHostImpl", |
| 1457 this, |
| 1458 base::debug::TracedValue::FromValue(AsValueWithFrame(frame).release())); |
1457 | 1459 |
1458 // Because the contents of the HUD depend on everything else in the frame, the | 1460 // Because the contents of the HUD depend on everything else in the frame, the |
1459 // contents of its texture are updated as the last thing before the frame is | 1461 // contents of its texture are updated as the last thing before the frame is |
1460 // drawn. | 1462 // drawn. |
1461 if (active_tree_->hud_layer()) { | 1463 if (active_tree_->hud_layer()) { |
1462 TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture"); | 1464 TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture"); |
1463 active_tree_->hud_layer()->UpdateHudTexture( | 1465 active_tree_->hud_layer()->UpdateHudTexture( |
1464 GetDrawMode(output_surface_.get()), resource_provider_.get()); | 1466 GetDrawMode(output_surface_.get()), resource_provider_.get()); |
1465 } | 1467 } |
1466 | 1468 |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3009 state->Set("active_tree", active_tree_->AsValue().release()); | 3011 state->Set("active_tree", active_tree_->AsValue().release()); |
3010 if (pending_tree_) | 3012 if (pending_tree_) |
3011 state->Set("pending_tree", pending_tree_->AsValue().release()); | 3013 state->Set("pending_tree", pending_tree_->AsValue().release()); |
3012 if (frame) | 3014 if (frame) |
3013 state->Set("frame", frame->AsValue().release()); | 3015 state->Set("frame", frame->AsValue().release()); |
3014 return state.PassAs<base::Value>(); | 3016 return state.PassAs<base::Value>(); |
3015 } | 3017 } |
3016 | 3018 |
3017 scoped_ptr<base::Value> LayerTreeHostImpl::ActivationStateAsValue() const { | 3019 scoped_ptr<base::Value> LayerTreeHostImpl::ActivationStateAsValue() const { |
3018 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 3020 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
3019 state->Set("lthi", TracedValue::CreateIDRef(this).release()); | 3021 state->Set("lthi", base::debug::TracedValue::CreateIDRef(this).release()); |
3020 if (tile_manager_) | 3022 if (tile_manager_) |
3021 state->Set("tile_manager", tile_manager_->BasicStateAsValue().release()); | 3023 state->Set("tile_manager", tile_manager_->BasicStateAsValue().release()); |
3022 return state.PassAs<base::Value>(); | 3024 return state.PassAs<base::Value>(); |
3023 } | 3025 } |
3024 | 3026 |
3025 void LayerTreeHostImpl::SetDebugState( | 3027 void LayerTreeHostImpl::SetDebugState( |
3026 const LayerTreeDebugState& new_debug_state) { | 3028 const LayerTreeDebugState& new_debug_state) { |
3027 if (LayerTreeDebugState::Equal(debug_state_, new_debug_state)) | 3029 if (LayerTreeDebugState::Equal(debug_state_, new_debug_state)) |
3028 return; | 3030 return; |
3029 if (debug_state_.continuous_painting != new_debug_state.continuous_painting) | 3031 if (debug_state_.continuous_painting != new_debug_state.continuous_painting) |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 swap_promise_monitor_.erase(monitor); | 3148 swap_promise_monitor_.erase(monitor); |
3147 } | 3149 } |
3148 | 3150 |
3149 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3151 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3150 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3152 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3151 for (; it != swap_promise_monitor_.end(); it++) | 3153 for (; it != swap_promise_monitor_.end(); it++) |
3152 (*it)->OnSetNeedsRedrawOnImpl(); | 3154 (*it)->OnSetNeedsRedrawOnImpl(); |
3153 } | 3155 } |
3154 | 3156 |
3155 } // namespace cc | 3157 } // namespace cc |
OLD | NEW |