| 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/latency_info_swap_promise.h" | 18 #include "cc/base/latency_info_swap_promise.h" |
| 19 #include "cc/base/math_util.h" | 19 #include "cc/base/math_util.h" |
| 20 #include "cc/base/util.h" | 20 #include "cc/base/util.h" |
| 21 #include "cc/debug/benchmark_instrumentation.h" | 21 #include "cc/debug/benchmark_instrumentation.h" |
| 22 #include "cc/debug/debug_rect_history.h" | 22 #include "cc/debug/debug_rect_history.h" |
| 23 #include "cc/debug/devtools_instrumentation.h" |
| 23 #include "cc/debug/frame_rate_counter.h" | 24 #include "cc/debug/frame_rate_counter.h" |
| 24 #include "cc/debug/overdraw_metrics.h" | 25 #include "cc/debug/overdraw_metrics.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/debug/traced_value.h" |
| 28 #include "cc/input/page_scale_animation.h" | 29 #include "cc/input/page_scale_animation.h" |
| 29 #include "cc/input/top_controls_manager.h" | 30 #include "cc/input/top_controls_manager.h" |
| 30 #include "cc/layers/append_quads_data.h" | 31 #include "cc/layers/append_quads_data.h" |
| 31 #include "cc/layers/heads_up_display_layer_impl.h" | 32 #include "cc/layers/heads_up_display_layer_impl.h" |
| 32 #include "cc/layers/layer_impl.h" | 33 #include "cc/layers/layer_impl.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 LayerTreeHostImpl::FrameData::FrameData() | 201 LayerTreeHostImpl::FrameData::FrameData() |
| 201 : contains_incomplete_tile(false), has_no_damage(false) {} | 202 : contains_incomplete_tile(false), has_no_damage(false) {} |
| 202 | 203 |
| 203 LayerTreeHostImpl::FrameData::~FrameData() {} | 204 LayerTreeHostImpl::FrameData::~FrameData() {} |
| 204 | 205 |
| 205 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( | 206 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( |
| 206 const LayerTreeSettings& settings, | 207 const LayerTreeSettings& settings, |
| 207 LayerTreeHostImplClient* client, | 208 LayerTreeHostImplClient* client, |
| 208 Proxy* proxy, | 209 Proxy* proxy, |
| 209 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 210 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 210 SharedBitmapManager* manager) { | 211 SharedBitmapManager* manager, |
| 212 int id) { |
| 211 return make_scoped_ptr(new LayerTreeHostImpl( | 213 return make_scoped_ptr(new LayerTreeHostImpl( |
| 212 settings, client, proxy, rendering_stats_instrumentation, manager)); | 214 settings, client, proxy, rendering_stats_instrumentation, manager, id)); |
| 213 } | 215 } |
| 214 | 216 |
| 215 LayerTreeHostImpl::LayerTreeHostImpl( | 217 LayerTreeHostImpl::LayerTreeHostImpl( |
| 216 const LayerTreeSettings& settings, | 218 const LayerTreeSettings& settings, |
| 217 LayerTreeHostImplClient* client, | 219 LayerTreeHostImplClient* client, |
| 218 Proxy* proxy, | 220 Proxy* proxy, |
| 219 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 221 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 220 SharedBitmapManager* manager) | 222 SharedBitmapManager* manager, |
| 223 int id) |
| 221 : client_(client), | 224 : client_(client), |
| 222 proxy_(proxy), | 225 proxy_(proxy), |
| 223 input_handler_client_(NULL), | 226 input_handler_client_(NULL), |
| 224 did_lock_scrolling_layer_(false), | 227 did_lock_scrolling_layer_(false), |
| 225 should_bubble_scrolls_(false), | 228 should_bubble_scrolls_(false), |
| 226 last_scroll_did_bubble_(false), | 229 last_scroll_did_bubble_(false), |
| 227 wheel_scrolling_(false), | 230 wheel_scrolling_(false), |
| 228 scroll_layer_id_when_mouse_over_scrollbar_(0), | 231 scroll_layer_id_when_mouse_over_scrollbar_(0), |
| 229 tile_priorities_dirty_(false), | 232 tile_priorities_dirty_(false), |
| 230 root_layer_scroll_offset_delegate_(NULL), | 233 root_layer_scroll_offset_delegate_(NULL), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 251 overdraw_bottom_height_(0.f), | 254 overdraw_bottom_height_(0.f), |
| 252 device_viewport_valid_for_tile_management_(true), | 255 device_viewport_valid_for_tile_management_(true), |
| 253 external_stencil_test_enabled_(false), | 256 external_stencil_test_enabled_(false), |
| 254 animation_registrar_(AnimationRegistrar::Create()), | 257 animation_registrar_(AnimationRegistrar::Create()), |
| 255 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 258 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
| 256 micro_benchmark_controller_(this), | 259 micro_benchmark_controller_(this), |
| 257 need_to_update_visible_tiles_before_draw_(false), | 260 need_to_update_visible_tiles_before_draw_(false), |
| 258 #ifndef NDEBUG | 261 #ifndef NDEBUG |
| 259 did_lose_called_(false), | 262 did_lose_called_(false), |
| 260 #endif | 263 #endif |
| 261 shared_bitmap_manager_(manager) { | 264 shared_bitmap_manager_(manager), |
| 265 id_(id) { |
| 262 DCHECK(proxy_->IsImplThread()); | 266 DCHECK(proxy_->IsImplThread()); |
| 263 DidVisibilityChange(this, visible_); | 267 DidVisibilityChange(this, visible_); |
| 264 | 268 |
| 265 SetDebugState(settings.initial_debug_state); | 269 SetDebugState(settings.initial_debug_state); |
| 266 | 270 |
| 267 if (settings.calculate_top_controls_position) { | 271 if (settings.calculate_top_controls_position) { |
| 268 top_controls_manager_ = | 272 top_controls_manager_ = |
| 269 TopControlsManager::Create(this, | 273 TopControlsManager::Create(this, |
| 270 settings.top_controls_height, | 274 settings.top_controls_height, |
| 271 settings.top_controls_show_threshold, | 275 settings.top_controls_show_threshold, |
| (...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 stats.main_stats.record_time + | 1580 stats.main_stats.record_time + |
| 1577 stats.impl_stats.rasterize_time); | 1581 stats.impl_stats.rasterize_time); |
| 1578 } | 1582 } |
| 1579 | 1583 |
| 1580 client_->DidActivatePendingTree(); | 1584 client_->DidActivatePendingTree(); |
| 1581 if (!tree_activation_callback_.is_null()) | 1585 if (!tree_activation_callback_.is_null()) |
| 1582 tree_activation_callback_.Run(); | 1586 tree_activation_callback_.Run(); |
| 1583 | 1587 |
| 1584 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) | 1588 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) |
| 1585 DCHECK(active_tree_->root_layer()); | 1589 DCHECK(active_tree_->root_layer()); |
| 1590 devtools_instrumentation::didActivateLayerTree(id_, |
| 1591 active_tree_->source_frame_number()); |
| 1586 } | 1592 } |
| 1587 | 1593 |
| 1588 void LayerTreeHostImpl::SetVisible(bool visible) { | 1594 void LayerTreeHostImpl::SetVisible(bool visible) { |
| 1589 DCHECK(proxy_->IsImplThread()); | 1595 DCHECK(proxy_->IsImplThread()); |
| 1590 | 1596 |
| 1591 if (visible_ == visible) | 1597 if (visible_ == visible) |
| 1592 return; | 1598 return; |
| 1593 visible_ = visible; | 1599 visible_ = visible; |
| 1594 DidVisibilityChange(this, visible_); | 1600 DidVisibilityChange(this, visible_); |
| 1595 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); | 1601 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2876 if (evicted_ui_resources_.empty()) | 2882 if (evicted_ui_resources_.empty()) |
| 2877 client_->OnCanDrawStateChanged(CanDraw()); | 2883 client_->OnCanDrawStateChanged(CanDraw()); |
| 2878 } | 2884 } |
| 2879 | 2885 |
| 2880 void LayerTreeHostImpl::ScheduleMicroBenchmark( | 2886 void LayerTreeHostImpl::ScheduleMicroBenchmark( |
| 2881 scoped_ptr<MicroBenchmarkImpl> benchmark) { | 2887 scoped_ptr<MicroBenchmarkImpl> benchmark) { |
| 2882 micro_benchmark_controller_.ScheduleRun(benchmark.Pass()); | 2888 micro_benchmark_controller_.ScheduleRun(benchmark.Pass()); |
| 2883 } | 2889 } |
| 2884 | 2890 |
| 2885 } // namespace cc | 2891 } // namespace cc |
| OLD | NEW |