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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 // Must be initialized after is_synchronous_single_threaded_ and proxy_. | 226 // Must be initialized after is_synchronous_single_threaded_ and proxy_. |
227 tile_manager_( | 227 tile_manager_( |
228 TileManager::Create(this, | 228 TileManager::Create(this, |
229 GetTaskRunner(), | 229 GetTaskRunner(), |
230 is_synchronous_single_threaded_ | 230 is_synchronous_single_threaded_ |
231 ? std::numeric_limits<size_t>::max() | 231 ? std::numeric_limits<size_t>::max() |
232 : settings.scheduled_raster_task_limit)), | 232 : settings.scheduled_raster_task_limit)), |
233 pinch_gesture_active_(false), | 233 pinch_gesture_active_(false), |
234 pinch_gesture_end_should_clear_scrolling_layer_(false), | 234 pinch_gesture_end_should_clear_scrolling_layer_(false), |
235 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())), | 235 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())), |
236 paint_time_counter_(PaintTimeCounter::Create()), | 236 paint_time_counter_(PaintTimeCounter::Create()), |
danakj
2015/08/21 18:56:09
this can go away?
samli
2015/08/26 21:08:24
Done.
| |
237 memory_history_(MemoryHistory::Create()), | 237 memory_history_(MemoryHistory::Create()), |
238 debug_rect_history_(DebugRectHistory::Create()), | 238 debug_rect_history_(DebugRectHistory::Create()), |
239 texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())), | 239 texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())), |
240 max_memory_needed_bytes_(0), | 240 max_memory_needed_bytes_(0), |
241 device_scale_factor_(1.f), | 241 device_scale_factor_(1.f), |
242 resourceless_software_draw_(false), | 242 resourceless_software_draw_(false), |
243 animation_registrar_(), | 243 animation_registrar_(), |
244 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 244 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
245 micro_benchmark_controller_(this), | 245 micro_benchmark_controller_(this), |
246 shared_bitmap_manager_(shared_bitmap_manager), | 246 shared_bitmap_manager_(shared_bitmap_manager), |
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1944 // If we have any picture layers, then by activating we also modified tile | 1944 // If we have any picture layers, then by activating we also modified tile |
1945 // priorities. | 1945 // priorities. |
1946 if (!active_tree_->picture_layers().empty()) | 1946 if (!active_tree_->picture_layers().empty()) |
1947 DidModifyTilePriorities(); | 1947 DidModifyTilePriorities(); |
1948 | 1948 |
1949 client_->OnCanDrawStateChanged(CanDraw()); | 1949 client_->OnCanDrawStateChanged(CanDraw()); |
1950 client_->DidActivateSyncTree(); | 1950 client_->DidActivateSyncTree(); |
1951 if (!tree_activation_callback_.is_null()) | 1951 if (!tree_activation_callback_.is_null()) |
1952 tree_activation_callback_.Run(); | 1952 tree_activation_callback_.Run(); |
1953 | 1953 |
1954 if (debug_state_.continuous_painting) { | |
1955 const RenderingStats& stats = | |
1956 rendering_stats_instrumentation_->GetRenderingStats(); | |
1957 // TODO(hendrikw): This requires a different metric when we commit directly | |
1958 // to the active tree. See crbug.com/429311. | |
1959 paint_time_counter_->SavePaintTime( | |
1960 stats.commit_to_activate_duration.GetLastTimeDelta() + | |
1961 stats.draw_duration.GetLastTimeDelta()); | |
1962 } | |
1963 | |
1964 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation = | 1954 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation = |
1965 active_tree_->TakePendingPageScaleAnimation(); | 1955 active_tree_->TakePendingPageScaleAnimation(); |
1966 if (pending_page_scale_animation) { | 1956 if (pending_page_scale_animation) { |
1967 StartPageScaleAnimation( | 1957 StartPageScaleAnimation( |
1968 pending_page_scale_animation->target_offset, | 1958 pending_page_scale_animation->target_offset, |
1969 pending_page_scale_animation->use_anchor, | 1959 pending_page_scale_animation->use_anchor, |
1970 pending_page_scale_animation->scale, | 1960 pending_page_scale_animation->scale, |
1971 pending_page_scale_animation->duration); | 1961 pending_page_scale_animation->duration); |
1972 } | 1962 } |
1973 } | 1963 } |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3304 state->BeginDictionary("tile_manager"); | 3294 state->BeginDictionary("tile_manager"); |
3305 tile_manager_->BasicStateAsValueInto(state); | 3295 tile_manager_->BasicStateAsValueInto(state); |
3306 state->EndDictionary(); | 3296 state->EndDictionary(); |
3307 } | 3297 } |
3308 } | 3298 } |
3309 | 3299 |
3310 void LayerTreeHostImpl::SetDebugState( | 3300 void LayerTreeHostImpl::SetDebugState( |
3311 const LayerTreeDebugState& new_debug_state) { | 3301 const LayerTreeDebugState& new_debug_state) { |
3312 if (LayerTreeDebugState::Equal(debug_state_, new_debug_state)) | 3302 if (LayerTreeDebugState::Equal(debug_state_, new_debug_state)) |
3313 return; | 3303 return; |
3314 if (debug_state_.continuous_painting != new_debug_state.continuous_painting) | |
3315 paint_time_counter_->ClearHistory(); | |
3316 | 3304 |
3317 debug_state_ = new_debug_state; | 3305 debug_state_ = new_debug_state; |
3318 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); | 3306 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); |
3319 SetFullRootLayerDamage(); | 3307 SetFullRootLayerDamage(); |
3320 } | 3308 } |
3321 | 3309 |
3322 void LayerTreeHostImpl::CreateUIResource(UIResourceId uid, | 3310 void LayerTreeHostImpl::CreateUIResource(UIResourceId uid, |
3323 const UIResourceBitmap& bitmap) { | 3311 const UIResourceBitmap& bitmap) { |
3324 DCHECK_GT(uid, 0); | 3312 DCHECK_GT(uid, 0); |
3325 | 3313 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3644 if (active_tree()) { | 3632 if (active_tree()) { |
3645 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3633 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
3646 if (layer) | 3634 if (layer) |
3647 return layer->ScrollOffsetForAnimation(); | 3635 return layer->ScrollOffsetForAnimation(); |
3648 } | 3636 } |
3649 | 3637 |
3650 return gfx::ScrollOffset(); | 3638 return gfx::ScrollOffset(); |
3651 } | 3639 } |
3652 | 3640 |
3653 } // namespace cc | 3641 } // namespace cc |
OLD | NEW |