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

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

Issue 342483007: Removed ManagedMemoryStats. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()),
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( 239 texture_mailbox_deleter_(new TextureMailboxDeleter(
240 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() 240 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner()
241 : proxy_->MainThreadTaskRunner())), 241 : proxy_->MainThreadTaskRunner())),
242 max_memory_needed_bytes_(0), 242 max_memory_needed_bytes_(0),
243 last_sent_memory_visible_bytes_(0),
244 last_sent_memory_visible_and_nearby_bytes_(0),
245 last_sent_memory_use_bytes_(0),
246 zero_budget_(false), 243 zero_budget_(false),
247 device_scale_factor_(1.f), 244 device_scale_factor_(1.f),
248 overhang_ui_resource_id_(0), 245 overhang_ui_resource_id_(0),
249 overdraw_bottom_height_(0.f), 246 overdraw_bottom_height_(0.f),
250 device_viewport_valid_for_tile_management_(true), 247 device_viewport_valid_for_tile_management_(true),
251 begin_impl_frame_interval_(BeginFrameArgs::DefaultInterval()), 248 begin_impl_frame_interval_(BeginFrameArgs::DefaultInterval()),
252 animation_registrar_(AnimationRegistrar::Create()), 249 animation_registrar_(AnimationRegistrar::Create()),
253 rendering_stats_instrumentation_(rendering_stats_instrumentation), 250 rendering_stats_instrumentation_(rendering_stats_instrumentation),
254 micro_benchmark_controller_(this), 251 micro_benchmark_controller_(this),
255 need_to_update_visible_tiles_before_draw_(false), 252 need_to_update_visible_tiles_before_draw_(false),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 active_tree_->ProcessUIResourceRequestQueue(); 340 active_tree_->ProcessUIResourceRequestQueue();
344 active_tree_->DidBecomeActive(); 341 active_tree_->DidBecomeActive();
345 342
346 ActivateAnimations(); 343 ActivateAnimations();
347 344
348 active_tree_->set_needs_update_draw_properties(); 345 active_tree_->set_needs_update_draw_properties();
349 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) 346 if (time_source_client_adapter_ && time_source_client_adapter_->Active())
350 DCHECK(active_tree_->root_layer()); 347 DCHECK(active_tree_->root_layer());
351 } 348 }
352 349
353 client_->SendManagedMemoryStats();
354
355 micro_benchmark_controller_.DidCompleteCommit(); 350 micro_benchmark_controller_.DidCompleteCommit();
356 } 351 }
357 352
358 bool LayerTreeHostImpl::CanDraw() const { 353 bool LayerTreeHostImpl::CanDraw() const {
359 // Note: If you are changing this function or any other function that might 354 // Note: If you are changing this function or any other function that might
360 // affect the result of CanDraw, make sure to call 355 // affect the result of CanDraw, make sure to call
361 // client_->OnCanDrawStateChanged in the proper places and update the 356 // client_->OnCanDrawStateChanged in the proper places and update the
362 // NotifyIfCanDrawChanged test. 357 // NotifyIfCanDrawChanged test.
363 358
364 if (!renderer_) { 359 if (!renderer_) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 413
419 void LayerTreeHostImpl::ManageTiles() { 414 void LayerTreeHostImpl::ManageTiles() {
420 if (!tile_manager_) 415 if (!tile_manager_)
421 return; 416 return;
422 if (!tile_priorities_dirty_) 417 if (!tile_priorities_dirty_)
423 return; 418 return;
424 419
425 tile_priorities_dirty_ = false; 420 tile_priorities_dirty_ = false;
426 tile_manager_->ManageTiles(global_tile_state_); 421 tile_manager_->ManageTiles(global_tile_state_);
427 422
428 size_t memory_required_bytes;
429 size_t memory_nice_to_have_bytes;
430 size_t memory_allocated_bytes;
431 size_t memory_used_bytes;
432 tile_manager_->GetMemoryStats(&memory_required_bytes,
433 &memory_nice_to_have_bytes,
434 &memory_allocated_bytes,
435 &memory_used_bytes);
436 SendManagedMemoryStats(memory_required_bytes,
437 memory_nice_to_have_bytes,
438 memory_used_bytes);
439
440 client_->DidManageTiles(); 423 client_->DidManageTiles();
441 } 424 }
442 425
443 void LayerTreeHostImpl::StartPageScaleAnimation( 426 void LayerTreeHostImpl::StartPageScaleAnimation(
444 const gfx::Vector2d& target_offset, 427 const gfx::Vector2d& target_offset,
445 bool anchor_point, 428 bool anchor_point,
446 float page_scale, 429 float page_scale,
447 base::TimeDelta duration) { 430 base::TimeDelta duration) {
448 if (!InnerViewportScrollLayer()) 431 if (!InnerViewportScrollLayer())
449 return; 432 return;
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 visible_ ? policy.priority_cutoff_when_visible 1150 visible_ ? policy.priority_cutoff_when_visible
1168 : gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING)); 1151 : gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING));
1169 if (evicted_resources) { 1152 if (evicted_resources) {
1170 active_tree_->SetContentsTexturesPurged(); 1153 active_tree_->SetContentsTexturesPurged();
1171 if (pending_tree_) 1154 if (pending_tree_)
1172 pending_tree_->SetContentsTexturesPurged(); 1155 pending_tree_->SetContentsTexturesPurged();
1173 client_->SetNeedsCommitOnImplThread(); 1156 client_->SetNeedsCommitOnImplThread();
1174 client_->OnCanDrawStateChanged(CanDraw()); 1157 client_->OnCanDrawStateChanged(CanDraw());
1175 client_->RenewTreePriority(); 1158 client_->RenewTreePriority();
1176 } 1159 }
1177 client_->SendManagedMemoryStats();
1178 1160
1179 UpdateTileManagerMemoryPolicy(policy); 1161 UpdateTileManagerMemoryPolicy(policy);
1180 } 1162 }
1181 1163
1182 void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy( 1164 void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy(
1183 const ManagedMemoryPolicy& policy) { 1165 const ManagedMemoryPolicy& policy) {
1184 if (!tile_manager_) 1166 if (!tile_manager_)
1185 return; 1167 return;
1186 1168
1187 global_tile_state_.hard_memory_limit_in_bytes = 0; 1169 global_tile_state_.hard_memory_limit_in_bytes = 0;
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after
2895 base::JSONWriter::WriteWithOptions( 2877 base::JSONWriter::WriteWithOptions(
2896 json.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); 2878 json.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &str);
2897 } 2879 }
2898 return str; 2880 return str;
2899 } 2881 }
2900 2882
2901 int LayerTreeHostImpl::SourceAnimationFrameNumber() const { 2883 int LayerTreeHostImpl::SourceAnimationFrameNumber() const {
2902 return fps_counter_->current_frame_number(); 2884 return fps_counter_->current_frame_number();
2903 } 2885 }
2904 2886
2905 void LayerTreeHostImpl::SendManagedMemoryStats(
2906 size_t memory_visible_bytes,
2907 size_t memory_visible_and_nearby_bytes,
2908 size_t memory_use_bytes) {
2909 if (!renderer_)
2910 return;
2911
2912 // Round the numbers being sent up to the next 8MB, to throttle the rate
2913 // at which we spam the GPU process.
2914 static const size_t rounding_step = 8 * 1024 * 1024;
2915 memory_visible_bytes = RoundUp(memory_visible_bytes, rounding_step);
2916 memory_visible_and_nearby_bytes = RoundUp(memory_visible_and_nearby_bytes,
2917 rounding_step);
2918 memory_use_bytes = RoundUp(memory_use_bytes, rounding_step);
2919 if (last_sent_memory_visible_bytes_ == memory_visible_bytes &&
2920 last_sent_memory_visible_and_nearby_bytes_ ==
2921 memory_visible_and_nearby_bytes &&
2922 last_sent_memory_use_bytes_ == memory_use_bytes) {
2923 return;
2924 }
2925 last_sent_memory_visible_bytes_ = memory_visible_bytes;
2926 last_sent_memory_visible_and_nearby_bytes_ = memory_visible_and_nearby_bytes;
2927 last_sent_memory_use_bytes_ = memory_use_bytes;
2928
2929 renderer_->SendManagedMemoryStats(last_sent_memory_visible_bytes_,
2930 last_sent_memory_visible_and_nearby_bytes_,
2931 last_sent_memory_use_bytes_);
2932 }
2933
2934 void LayerTreeHostImpl::AnimateScrollbars(base::TimeTicks time) { 2887 void LayerTreeHostImpl::AnimateScrollbars(base::TimeTicks time) {
2935 AnimateScrollbarsRecursive(active_tree_->root_layer(), time); 2888 AnimateScrollbarsRecursive(active_tree_->root_layer(), time);
2936 } 2889 }
2937 2890
2938 void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer, 2891 void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer,
2939 base::TimeTicks time) { 2892 base::TimeTicks time) {
2940 if (!layer) 2893 if (!layer)
2941 return; 2894 return;
2942 2895
2943 ScrollbarAnimationController* scrollbar_controller = 2896 ScrollbarAnimationController* scrollbar_controller =
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 } 3106 }
3154 3107
3155 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3108 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3156 std::vector<PictureLayerImpl*>::iterator it = 3109 std::vector<PictureLayerImpl*>::iterator it =
3157 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3110 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3158 DCHECK(it != picture_layers_.end()); 3111 DCHECK(it != picture_layers_.end());
3159 picture_layers_.erase(it); 3112 picture_layers_.erase(it);
3160 } 3113 }
3161 3114
3162 } // namespace cc 3115 } // 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