| 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/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "cc/animation/scrollbar_animation_controller.h" | 16 #include "cc/animation/scrollbar_animation_controller.h" |
| 17 #include "cc/animation/timing_function.h" | 17 #include "cc/animation/timing_function.h" |
| 18 #include "cc/base/math_util.h" | 18 #include "cc/base/math_util.h" |
| 19 #include "cc/base/util.h" | 19 #include "cc/base/util.h" |
| 20 #include "cc/debug/benchmark_instrumentation.h" | 20 #include "cc/debug/benchmark_instrumentation.h" |
| 21 #include "cc/debug/debug_rect_history.h" | 21 #include "cc/debug/debug_rect_history.h" |
| 22 #include "cc/debug/devtools_instrumentation.h" |
| 22 #include "cc/debug/frame_rate_counter.h" | 23 #include "cc/debug/frame_rate_counter.h" |
| 23 #include "cc/debug/overdraw_metrics.h" | 24 #include "cc/debug/overdraw_metrics.h" |
| 24 #include "cc/debug/paint_time_counter.h" | 25 #include "cc/debug/paint_time_counter.h" |
| 25 #include "cc/debug/rendering_stats_instrumentation.h" | 26 #include "cc/debug/rendering_stats_instrumentation.h" |
| 26 #include "cc/debug/traced_value.h" | 27 #include "cc/debug/traced_value.h" |
| 27 #include "cc/input/page_scale_animation.h" | 28 #include "cc/input/page_scale_animation.h" |
| 28 #include "cc/input/top_controls_manager.h" | 29 #include "cc/input/top_controls_manager.h" |
| 29 #include "cc/layers/append_quads_data.h" | 30 #include "cc/layers/append_quads_data.h" |
| 30 #include "cc/layers/heads_up_display_layer_impl.h" | 31 #include "cc/layers/heads_up_display_layer_impl.h" |
| 31 #include "cc/layers/layer_impl.h" | 32 #include "cc/layers/layer_impl.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 LayerTreeHostImpl::FrameData::FrameData() | 183 LayerTreeHostImpl::FrameData::FrameData() |
| 183 : contains_incomplete_tile(false), has_no_damage(false) {} | 184 : contains_incomplete_tile(false), has_no_damage(false) {} |
| 184 | 185 |
| 185 LayerTreeHostImpl::FrameData::~FrameData() {} | 186 LayerTreeHostImpl::FrameData::~FrameData() {} |
| 186 | 187 |
| 187 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( | 188 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( |
| 188 const LayerTreeSettings& settings, | 189 const LayerTreeSettings& settings, |
| 189 LayerTreeHostImplClient* client, | 190 LayerTreeHostImplClient* client, |
| 190 Proxy* proxy, | 191 Proxy* proxy, |
| 191 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 192 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 192 SharedBitmapManager* manager) { | 193 SharedBitmapManager* manager, |
| 194 int id) { |
| 193 return make_scoped_ptr(new LayerTreeHostImpl( | 195 return make_scoped_ptr(new LayerTreeHostImpl( |
| 194 settings, client, proxy, rendering_stats_instrumentation, manager)); | 196 settings, client, proxy, rendering_stats_instrumentation, manager, id)); |
| 195 } | 197 } |
| 196 | 198 |
| 197 LayerTreeHostImpl::LayerTreeHostImpl( | 199 LayerTreeHostImpl::LayerTreeHostImpl( |
| 198 const LayerTreeSettings& settings, | 200 const LayerTreeSettings& settings, |
| 199 LayerTreeHostImplClient* client, | 201 LayerTreeHostImplClient* client, |
| 200 Proxy* proxy, | 202 Proxy* proxy, |
| 201 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 203 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 202 SharedBitmapManager* manager) | 204 SharedBitmapManager* manager, |
| 205 int id) |
| 203 : client_(client), | 206 : client_(client), |
| 204 proxy_(proxy), | 207 proxy_(proxy), |
| 205 input_handler_client_(NULL), | 208 input_handler_client_(NULL), |
| 206 did_lock_scrolling_layer_(false), | 209 did_lock_scrolling_layer_(false), |
| 207 should_bubble_scrolls_(false), | 210 should_bubble_scrolls_(false), |
| 208 last_scroll_did_bubble_(false), | 211 last_scroll_did_bubble_(false), |
| 209 wheel_scrolling_(false), | 212 wheel_scrolling_(false), |
| 210 scroll_layer_id_when_mouse_over_scrollbar_(0), | 213 scroll_layer_id_when_mouse_over_scrollbar_(0), |
| 211 tile_priorities_dirty_(false), | 214 tile_priorities_dirty_(false), |
| 212 root_layer_scroll_offset_delegate_(NULL), | 215 root_layer_scroll_offset_delegate_(NULL), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 229 last_sent_memory_use_bytes_(0), | 232 last_sent_memory_use_bytes_(0), |
| 230 zero_budget_(false), | 233 zero_budget_(false), |
| 231 device_scale_factor_(1.f), | 234 device_scale_factor_(1.f), |
| 232 overhang_ui_resource_id_(0), | 235 overhang_ui_resource_id_(0), |
| 233 overdraw_bottom_height_(0.f), | 236 overdraw_bottom_height_(0.f), |
| 234 device_viewport_valid_for_tile_management_(true), | 237 device_viewport_valid_for_tile_management_(true), |
| 235 external_stencil_test_enabled_(false), | 238 external_stencil_test_enabled_(false), |
| 236 animation_registrar_(AnimationRegistrar::Create()), | 239 animation_registrar_(AnimationRegistrar::Create()), |
| 237 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 240 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
| 238 need_to_update_visible_tiles_before_draw_(false), | 241 need_to_update_visible_tiles_before_draw_(false), |
| 239 shared_bitmap_manager_(manager) { | 242 shared_bitmap_manager_(manager), |
| 243 id_(id) { |
| 240 DCHECK(proxy_->IsImplThread()); | 244 DCHECK(proxy_->IsImplThread()); |
| 241 DidVisibilityChange(this, visible_); | 245 DidVisibilityChange(this, visible_); |
| 242 | 246 |
| 243 SetDebugState(settings.initial_debug_state); | 247 SetDebugState(settings.initial_debug_state); |
| 244 | 248 |
| 245 if (settings.calculate_top_controls_position) { | 249 if (settings.calculate_top_controls_position) { |
| 246 top_controls_manager_ = | 250 top_controls_manager_ = |
| 247 TopControlsManager::Create(this, | 251 TopControlsManager::Create(this, |
| 248 settings.top_controls_height, | 252 settings.top_controls_height, |
| 249 settings.top_controls_show_threshold, | 253 settings.top_controls_show_threshold, |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 stats.main_stats.record_time + | 1550 stats.main_stats.record_time + |
| 1547 stats.impl_stats.rasterize_time); | 1551 stats.impl_stats.rasterize_time); |
| 1548 } | 1552 } |
| 1549 | 1553 |
| 1550 client_->DidActivatePendingTree(); | 1554 client_->DidActivatePendingTree(); |
| 1551 if (!tree_activation_callback_.is_null()) | 1555 if (!tree_activation_callback_.is_null()) |
| 1552 tree_activation_callback_.Run(); | 1556 tree_activation_callback_.Run(); |
| 1553 | 1557 |
| 1554 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) | 1558 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) |
| 1555 DCHECK(active_tree_->root_layer()); | 1559 DCHECK(active_tree_->root_layer()); |
| 1560 devtools_instrumentation::didActivateLayerTree(id_, |
| 1561 active_tree_->source_frame_number()); |
| 1556 } | 1562 } |
| 1557 | 1563 |
| 1558 void LayerTreeHostImpl::SetVisible(bool visible) { | 1564 void LayerTreeHostImpl::SetVisible(bool visible) { |
| 1559 DCHECK(proxy_->IsImplThread()); | 1565 DCHECK(proxy_->IsImplThread()); |
| 1560 | 1566 |
| 1561 if (visible_ == visible) | 1567 if (visible_ == visible) |
| 1562 return; | 1568 return; |
| 1563 visible_ = visible; | 1569 visible_ = visible; |
| 1564 DidVisibilityChange(this, visible_); | 1570 DidVisibilityChange(this, visible_); |
| 1565 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); | 1571 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2836 std::set<UIResourceId>::iterator found_in_evicted = | 2842 std::set<UIResourceId>::iterator found_in_evicted = |
| 2837 evicted_ui_resources_.find(uid); | 2843 evicted_ui_resources_.find(uid); |
| 2838 if (found_in_evicted == evicted_ui_resources_.end()) | 2844 if (found_in_evicted == evicted_ui_resources_.end()) |
| 2839 return; | 2845 return; |
| 2840 evicted_ui_resources_.erase(found_in_evicted); | 2846 evicted_ui_resources_.erase(found_in_evicted); |
| 2841 if (evicted_ui_resources_.empty()) | 2847 if (evicted_ui_resources_.empty()) |
| 2842 client_->OnCanDrawStateChanged(CanDraw()); | 2848 client_->OnCanDrawStateChanged(CanDraw()); |
| 2843 } | 2849 } |
| 2844 | 2850 |
| 2845 } // namespace cc | 2851 } // namespace cc |
| OLD | NEW |