Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 23495022: CC: Add a scheduled action for ManageTiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 const LayerTreeSettings& settings, 190 const LayerTreeSettings& settings,
191 LayerTreeHostImplClient* client, 191 LayerTreeHostImplClient* client,
192 Proxy* proxy, 192 Proxy* proxy,
193 RenderingStatsInstrumentation* rendering_stats_instrumentation) 193 RenderingStatsInstrumentation* rendering_stats_instrumentation)
194 : client_(client), 194 : client_(client),
195 proxy_(proxy), 195 proxy_(proxy),
196 input_handler_client_(NULL), 196 input_handler_client_(NULL),
197 did_lock_scrolling_layer_(false), 197 did_lock_scrolling_layer_(false),
198 should_bubble_scrolls_(false), 198 should_bubble_scrolls_(false),
199 wheel_scrolling_(false), 199 wheel_scrolling_(false),
200 manage_tiles_needed_(false), 200 tile_priorities_dirty_(false),
201 root_layer_scroll_offset_delegate_(NULL), 201 root_layer_scroll_offset_delegate_(NULL),
202 settings_(settings), 202 settings_(settings),
203 visible_(true), 203 visible_(true),
204 cached_managed_memory_policy_( 204 cached_managed_memory_policy_(
205 PrioritizedResourceManager::DefaultMemoryAllocationLimit(), 205 PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
206 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, 206 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING,
207 0, 207 0,
208 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING, 208 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING,
209 ManagedMemoryPolicy::kDefaultNumResourcesLimit), 209 ManagedMemoryPolicy::kDefaultNumResourcesLimit),
210 pinch_gesture_active_(false), 210 pinch_gesture_active_(false),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); 272 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete");
273 273
274 if (settings_.impl_side_painting) { 274 if (settings_.impl_side_painting) {
275 // Impl-side painting needs an update immediately post-commit to have the 275 // Impl-side painting needs an update immediately post-commit to have the
276 // opportunity to create tilings. Other paths can call UpdateDrawProperties 276 // opportunity to create tilings. Other paths can call UpdateDrawProperties
277 // more lazily when needed prior to drawing. 277 // more lazily when needed prior to drawing.
278 pending_tree()->ApplyScrollDeltasSinceBeginFrame(); 278 pending_tree()->ApplyScrollDeltasSinceBeginFrame();
279 pending_tree_->set_needs_update_draw_properties(); 279 pending_tree_->set_needs_update_draw_properties();
280 pending_tree_->UpdateDrawProperties(); 280 pending_tree_->UpdateDrawProperties();
281 // Start working on newly created tiles immediately if needed. 281 // Start working on newly created tiles immediately if needed.
282 if (!tile_manager_ || !manage_tiles_needed_) 282 if (!tile_manager_ || !tile_priorities_dirty_)
283 NotifyReadyToActivate(); 283 NotifyReadyToActivate();
284 else 284 else
285 ManageTiles(); 285 ManageTiles();
286 } else { 286 } else {
287 active_tree_->set_needs_update_draw_properties(); 287 active_tree_->set_needs_update_draw_properties();
288 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) 288 if (time_source_client_adapter_ && time_source_client_adapter_->Active())
289 DCHECK(active_tree_->root_layer()); 289 DCHECK(active_tree_->root_layer());
290 } 290 }
291 291
292 client_->SendManagedMemoryStats(); 292 client_->SendManagedMemoryStats();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 input_handler_client_->Animate(monotonic_time); 350 input_handler_client_->Animate(monotonic_time);
351 AnimatePageScale(monotonic_time); 351 AnimatePageScale(monotonic_time);
352 AnimateLayers(monotonic_time, wall_clock_time); 352 AnimateLayers(monotonic_time, wall_clock_time);
353 AnimateScrollbars(monotonic_time); 353 AnimateScrollbars(monotonic_time);
354 AnimateTopControls(monotonic_time); 354 AnimateTopControls(monotonic_time);
355 } 355 }
356 356
357 void LayerTreeHostImpl::ManageTiles() { 357 void LayerTreeHostImpl::ManageTiles() {
358 if (!tile_manager_) 358 if (!tile_manager_)
359 return; 359 return;
360 if (!manage_tiles_needed_) 360 if (!tile_priorities_dirty_)
361 return; 361 return;
362 if (!device_viewport_valid_for_tile_management_) 362 if (!device_viewport_valid_for_tile_management_)
363 return; 363 return;
364 364
365 manage_tiles_needed_ = false; 365 tile_priorities_dirty_ = false;
366 tile_manager_->ManageTiles(); 366 tile_manager_->ManageTiles();
367 367
368 size_t memory_required_bytes; 368 size_t memory_required_bytes;
369 size_t memory_nice_to_have_bytes; 369 size_t memory_nice_to_have_bytes;
370 size_t memory_allocated_bytes; 370 size_t memory_allocated_bytes;
371 size_t memory_used_bytes; 371 size_t memory_used_bytes;
372 tile_manager_->GetMemoryStats(&memory_required_bytes, 372 tile_manager_->GetMemoryStats(&memory_required_bytes,
373 &memory_nice_to_have_bytes, 373 &memory_nice_to_have_bytes,
374 &memory_allocated_bytes, 374 &memory_allocated_bytes,
375 &memory_used_bytes); 375 &memory_used_bytes);
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 // possible. crbug.com/224475 1131 // possible. crbug.com/224475
1132 new_state.unused_memory_limit_in_bytes = static_cast<size_t>( 1132 new_state.unused_memory_limit_in_bytes = static_cast<size_t>(
1133 (static_cast<int64>(new_state.memory_limit_in_bytes) * 1133 (static_cast<int64>(new_state.memory_limit_in_bytes) *
1134 settings_.max_unused_resource_memory_percentage) / 100); 1134 settings_.max_unused_resource_memory_percentage) / 100);
1135 new_state.memory_limit_policy = 1135 new_state.memory_limit_policy =
1136 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( 1136 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy(
1137 visible_ ? 1137 visible_ ?
1138 policy.priority_cutoff_when_visible : 1138 policy.priority_cutoff_when_visible :
1139 policy.priority_cutoff_when_not_visible); 1139 policy.priority_cutoff_when_not_visible);
1140 new_state.num_resources_limit = policy.num_resources_limit; 1140 new_state.num_resources_limit = policy.num_resources_limit;
1141
1141 tile_manager_->SetGlobalState(new_state); 1142 tile_manager_->SetGlobalState(new_state);
1142 manage_tiles_needed_ = true; 1143 DidModifyTilePriorities();
1144 }
1145
1146 void LayerTreeHostImpl::DidModifyTilePriorities() {
1147 DCHECK(settings_.impl_side_painting);
1148 // Mark priorities as dirty and schedule a ManageTiles().
1149 tile_priorities_dirty_ = true;
1150 client_->SetNeedsManageTilesOnImplThread();
1143 } 1151 }
1144 1152
1145 void LayerTreeHostImpl::DidInitializeVisibleTile() { 1153 void LayerTreeHostImpl::DidInitializeVisibleTile() {
1146 // TODO(reveman): Determine tiles that changed and only damage 1154 // TODO(reveman): Determine tiles that changed and only damage
1147 // what's necessary. 1155 // what's necessary.
1148 SetFullRootLayerDamage(); 1156 SetFullRootLayerDamage();
1149 if (client_) 1157 if (client_)
1150 client_->DidInitializeVisibleTileOnImplThread(); 1158 client_->DidInitializeVisibleTileOnImplThread();
1151 } 1159 }
1152 1160
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2544 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { 2552 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) {
2545 if (!tile_manager_) 2553 if (!tile_manager_)
2546 return; 2554 return;
2547 2555
2548 GlobalStateThatImpactsTilePriority new_state(tile_manager_->GlobalState()); 2556 GlobalStateThatImpactsTilePriority new_state(tile_manager_->GlobalState());
2549 if (new_state.tree_priority == priority) 2557 if (new_state.tree_priority == priority)
2550 return; 2558 return;
2551 2559
2552 new_state.tree_priority = priority; 2560 new_state.tree_priority = priority;
2553 tile_manager_->SetGlobalState(new_state); 2561 tile_manager_->SetGlobalState(new_state);
2554 manage_tiles_needed_ = true; 2562 DidModifyTilePriorities();
2555 } 2563 }
2556 2564
2557 void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() { 2565 void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() {
2558 current_frame_timeticks_ = base::TimeTicks(); 2566 current_frame_timeticks_ = base::TimeTicks();
2559 current_frame_time_ = base::Time(); 2567 current_frame_time_ = base::Time();
2560 } 2568 }
2561 2569
2562 void LayerTreeHostImpl::UpdateCurrentFrameTime(base::TimeTicks* ticks, 2570 void LayerTreeHostImpl::UpdateCurrentFrameTime(base::TimeTicks* ticks,
2563 base::Time* now) const { 2571 base::Time* now) const {
2564 if (ticks->is_null()) { 2572 if (ticks->is_null()) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 std::set<UIResourceId>::iterator found_in_evicted = 2704 std::set<UIResourceId>::iterator found_in_evicted =
2697 evicted_ui_resources_.find(uid); 2705 evicted_ui_resources_.find(uid);
2698 if (found_in_evicted == evicted_ui_resources_.end()) 2706 if (found_in_evicted == evicted_ui_resources_.end())
2699 return; 2707 return;
2700 evicted_ui_resources_.erase(found_in_evicted); 2708 evicted_ui_resources_.erase(found_in_evicted);
2701 if (evicted_ui_resources_.empty()) 2709 if (evicted_ui_resources_.empty())
2702 client_->OnCanDrawStateChanged(CanDraw()); 2710 client_->OnCanDrawStateChanged(CanDraw());
2703 } 2711 }
2704 2712
2705 } // namespace cc 2713 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698