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 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "cc/animation/scroll_offset_animation_curve.h" | 23 #include "cc/animation/scroll_offset_animation_curve.h" |
24 #include "cc/animation/scrollbar_animation_controller.h" | 24 #include "cc/animation/scrollbar_animation_controller.h" |
25 #include "cc/animation/timing_function.h" | 25 #include "cc/animation/timing_function.h" |
26 #include "cc/base/histograms.h" | 26 #include "cc/base/histograms.h" |
27 #include "cc/base/math_util.h" | 27 #include "cc/base/math_util.h" |
28 #include "cc/debug/benchmark_instrumentation.h" | 28 #include "cc/debug/benchmark_instrumentation.h" |
29 #include "cc/debug/debug_rect_history.h" | 29 #include "cc/debug/debug_rect_history.h" |
30 #include "cc/debug/devtools_instrumentation.h" | 30 #include "cc/debug/devtools_instrumentation.h" |
31 #include "cc/debug/frame_rate_counter.h" | 31 #include "cc/debug/frame_rate_counter.h" |
32 #include "cc/debug/frame_viewer_instrumentation.h" | 32 #include "cc/debug/frame_viewer_instrumentation.h" |
33 #include "cc/debug/paint_time_counter.h" | |
34 #include "cc/debug/rendering_stats_instrumentation.h" | 33 #include "cc/debug/rendering_stats_instrumentation.h" |
35 #include "cc/debug/traced_value.h" | 34 #include "cc/debug/traced_value.h" |
36 #include "cc/input/page_scale_animation.h" | 35 #include "cc/input/page_scale_animation.h" |
37 #include "cc/input/scroll_elasticity_helper.h" | 36 #include "cc/input/scroll_elasticity_helper.h" |
38 #include "cc/input/scroll_state.h" | 37 #include "cc/input/scroll_state.h" |
39 #include "cc/input/top_controls_manager.h" | 38 #include "cc/input/top_controls_manager.h" |
40 #include "cc/layers/append_quads_data.h" | 39 #include "cc/layers/append_quads_data.h" |
41 #include "cc/layers/heads_up_display_layer_impl.h" | 40 #include "cc/layers/heads_up_display_layer_impl.h" |
42 #include "cc/layers/layer_impl.h" | 41 #include "cc/layers/layer_impl.h" |
43 #include "cc/layers/layer_iterator.h" | 42 #include "cc/layers/layer_iterator.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // Must be initialized after is_synchronous_single_threaded_ and proxy_. | 197 // Must be initialized after is_synchronous_single_threaded_ and proxy_. |
199 tile_manager_( | 198 tile_manager_( |
200 TileManager::Create(this, | 199 TileManager::Create(this, |
201 GetTaskRunner(), | 200 GetTaskRunner(), |
202 is_synchronous_single_threaded_ | 201 is_synchronous_single_threaded_ |
203 ? std::numeric_limits<size_t>::max() | 202 ? std::numeric_limits<size_t>::max() |
204 : settings.scheduled_raster_task_limit)), | 203 : settings.scheduled_raster_task_limit)), |
205 pinch_gesture_active_(false), | 204 pinch_gesture_active_(false), |
206 pinch_gesture_end_should_clear_scrolling_layer_(false), | 205 pinch_gesture_end_should_clear_scrolling_layer_(false), |
207 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())), | 206 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())), |
208 paint_time_counter_(PaintTimeCounter::Create()), | |
209 memory_history_(MemoryHistory::Create()), | 207 memory_history_(MemoryHistory::Create()), |
210 debug_rect_history_(DebugRectHistory::Create()), | 208 debug_rect_history_(DebugRectHistory::Create()), |
211 texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())), | 209 texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())), |
212 max_memory_needed_bytes_(0), | 210 max_memory_needed_bytes_(0), |
213 device_scale_factor_(1.f), | 211 device_scale_factor_(1.f), |
214 resourceless_software_draw_(false), | 212 resourceless_software_draw_(false), |
215 animation_registrar_(), | 213 animation_registrar_(), |
216 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 214 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
217 micro_benchmark_controller_(this), | 215 micro_benchmark_controller_(this), |
218 shared_bitmap_manager_(shared_bitmap_manager), | 216 shared_bitmap_manager_(shared_bitmap_manager), |
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1916 // If we have any picture layers, then by activating we also modified tile | 1914 // If we have any picture layers, then by activating we also modified tile |
1917 // priorities. | 1915 // priorities. |
1918 if (!active_tree_->picture_layers().empty()) | 1916 if (!active_tree_->picture_layers().empty()) |
1919 DidModifyTilePriorities(); | 1917 DidModifyTilePriorities(); |
1920 | 1918 |
1921 client_->OnCanDrawStateChanged(CanDraw()); | 1919 client_->OnCanDrawStateChanged(CanDraw()); |
1922 client_->DidActivateSyncTree(); | 1920 client_->DidActivateSyncTree(); |
1923 if (!tree_activation_callback_.is_null()) | 1921 if (!tree_activation_callback_.is_null()) |
1924 tree_activation_callback_.Run(); | 1922 tree_activation_callback_.Run(); |
1925 | 1923 |
1926 if (debug_state_.continuous_painting) { | |
1927 const RenderingStats& stats = | |
1928 rendering_stats_instrumentation_->GetRenderingStats(); | |
1929 // TODO(hendrikw): This requires a different metric when we commit directly | |
1930 // to the active tree. See crbug.com/429311. | |
1931 paint_time_counter_->SavePaintTime( | |
1932 stats.commit_to_activate_duration.GetLastTimeDelta() + | |
1933 stats.draw_duration.GetLastTimeDelta()); | |
1934 } | |
1935 | |
1936 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation = | 1924 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation = |
1937 active_tree_->TakePendingPageScaleAnimation(); | 1925 active_tree_->TakePendingPageScaleAnimation(); |
1938 if (pending_page_scale_animation) { | 1926 if (pending_page_scale_animation) { |
1939 StartPageScaleAnimation( | 1927 StartPageScaleAnimation( |
1940 pending_page_scale_animation->target_offset, | 1928 pending_page_scale_animation->target_offset, |
1941 pending_page_scale_animation->use_anchor, | 1929 pending_page_scale_animation->use_anchor, |
1942 pending_page_scale_animation->scale, | 1930 pending_page_scale_animation->scale, |
1943 pending_page_scale_animation->duration); | 1931 pending_page_scale_animation->duration); |
1944 } | 1932 } |
1945 } | 1933 } |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3265 state->BeginDictionary("tile_manager"); | 3253 state->BeginDictionary("tile_manager"); |
3266 tile_manager_->BasicStateAsValueInto(state); | 3254 tile_manager_->BasicStateAsValueInto(state); |
3267 state->EndDictionary(); | 3255 state->EndDictionary(); |
3268 } | 3256 } |
3269 } | 3257 } |
3270 | 3258 |
3271 void LayerTreeHostImpl::SetDebugState( | 3259 void LayerTreeHostImpl::SetDebugState( |
3272 const LayerTreeDebugState& new_debug_state) { | 3260 const LayerTreeDebugState& new_debug_state) { |
3273 if (LayerTreeDebugState::Equal(debug_state_, new_debug_state)) | 3261 if (LayerTreeDebugState::Equal(debug_state_, new_debug_state)) |
3274 return; | 3262 return; |
3275 if (debug_state_.continuous_painting != new_debug_state.continuous_painting) | |
3276 paint_time_counter_->ClearHistory(); | |
3277 | 3263 |
3278 debug_state_ = new_debug_state; | 3264 debug_state_ = new_debug_state; |
3279 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); | 3265 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); |
3280 SetFullRootLayerDamage(); | 3266 SetFullRootLayerDamage(); |
3281 } | 3267 } |
3282 | 3268 |
3283 void LayerTreeHostImpl::CreateUIResource(UIResourceId uid, | 3269 void LayerTreeHostImpl::CreateUIResource(UIResourceId uid, |
3284 const UIResourceBitmap& bitmap) { | 3270 const UIResourceBitmap& bitmap) { |
3285 DCHECK_GT(uid, 0); | 3271 DCHECK_GT(uid, 0); |
3286 | 3272 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3605 if (active_tree()) { | 3591 if (active_tree()) { |
3606 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3592 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
3607 if (layer) | 3593 if (layer) |
3608 return layer->ScrollOffsetForAnimation(); | 3594 return layer->ScrollOffsetForAnimation(); |
3609 } | 3595 } |
3610 | 3596 |
3611 return gfx::ScrollOffset(); | 3597 return gfx::ScrollOffset(); |
3612 } | 3598 } |
3613 | 3599 |
3614 } // namespace cc | 3600 } // namespace cc |
OLD | NEW |