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

Side by Side Diff: cc/resources/tile_manager.cc

Issue 12502016: cc: Add command line switch to control resource usage for impl-side painting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MRU eviction pattern Created 7 years, 9 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
« cc/resources/resource_pool.cc ('K') | « cc/resources/resource_pool.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/tile_manager.h" 5 #include "cc/resources/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 resource_pool_->resource_provider()->ReleasePixelBuffer(resource->id()); 915 resource_pool_->resource_provider()->ReleasePixelBuffer(resource->id());
916 resource_pool_->ReleaseResource(resource.Pass()); 916 resource_pool_->ReleaseResource(resource.Pass());
917 managed_tile_state.drawing_info.resource_is_being_initialized_ = false; 917 managed_tile_state.drawing_info.resource_is_being_initialized_ = false;
918 DidTileRasterStateChange(tile, IDLE_STATE); 918 DidTileRasterStateChange(tile, IDLE_STATE);
919 } 919 }
920 } 920 }
921 921
922 void TileManager::DidFinishTileInitialization(Tile* tile) { 922 void TileManager::DidFinishTileInitialization(Tile* tile) {
923 ManagedTileState& managed_state = tile->managed_state(); 923 ManagedTileState& managed_state = tile->managed_state();
924 managed_state.drawing_info.resource_is_being_initialized_ = false; 924 managed_state.drawing_info.resource_is_being_initialized_ = false;
925
925 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) 926 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0)
926 client_->DidInitializeVisibleTile(); 927 client_->DidInitializeVisibleTile();
928
929 // Reduce memory usage when no work is pending.
930 if (!HasPendingWorkScheduled(PENDING_TREE) &&
931 !HasPendingWorkScheduled(ACTIVE_TREE))
932 resource_pool_->ReduceMemoryUsage();
927 } 933 }
928 934
929 void TileManager::DidTileRasterStateChange(Tile* tile, TileRasterState state) { 935 void TileManager::DidTileRasterStateChange(Tile* tile, TileRasterState state) {
930 ManagedTileState& mts = tile->managed_state(); 936 ManagedTileState& mts = tile->managed_state();
931 DCHECK_LT(state, NUM_STATES); 937 DCHECK_LT(state, NUM_STATES);
932 938
933 for (int i = 0; i < NUM_TREES; ++i) { 939 for (int i = 0; i < NUM_TREES; ++i) {
934 // Decrement count for current state. 940 // Decrement count for current state.
935 --raster_state_count_[mts.raster_state][i][mts.tree_bin[i]]; 941 --raster_state_count_[mts.raster_state][i][mts.tree_bin[i]];
936 DCHECK_GE(raster_state_count_[mts.raster_state][i][mts.tree_bin[i]], 0); 942 DCHECK_GE(raster_state_count_[mts.raster_state][i][mts.tree_bin[i]], 0);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 skia::LazyPixelRef* pixel_ref, 1096 skia::LazyPixelRef* pixel_ref,
1091 RenderingStatsInstrumentation* stats_instrumentation) { 1097 RenderingStatsInstrumentation* stats_instrumentation) {
1092 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); 1098 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask");
1093 base::TimeTicks start_time = stats_instrumentation->StartRecording(); 1099 base::TimeTicks start_time = stats_instrumentation->StartRecording();
1094 pixel_ref->Decode(); 1100 pixel_ref->Decode();
1095 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); 1101 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time);
1096 stats_instrumentation->AddDeferredImageDecode(duration); 1102 stats_instrumentation->AddDeferredImageDecode(duration);
1097 } 1103 }
1098 1104
1099 } // namespace cc 1105 } // namespace cc
OLDNEW
« cc/resources/resource_pool.cc ('K') | « cc/resources/resource_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698