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

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

Issue 13206004: cc: Fix build issues for adding ‘chromium_code’: 1 to cc.gyp and cc_tests.gyp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 bool prediction_benchmarking, 156 bool prediction_benchmarking,
157 RenderingStatsInstrumentation* rendering_stats_instrumentation) 157 RenderingStatsInstrumentation* rendering_stats_instrumentation)
158 : client_(client), 158 : client_(client),
159 resource_pool_(ResourcePool::Create(resource_provider)), 159 resource_pool_(ResourcePool::Create(resource_provider)),
160 raster_worker_pool_(RasterWorkerPool::Create(this, num_raster_threads)), 160 raster_worker_pool_(RasterWorkerPool::Create(this, num_raster_threads)),
161 manage_tiles_pending_(false), 161 manage_tiles_pending_(false),
162 manage_tiles_call_count_(0), 162 manage_tiles_call_count_(0),
163 bytes_pending_upload_(0), 163 bytes_pending_upload_(0),
164 has_performed_uploads_since_last_flush_(false), 164 has_performed_uploads_since_last_flush_(false),
165 ever_exceeded_memory_budget_(false), 165 ever_exceeded_memory_budget_(false),
166 rendering_stats_instrumentation_(rendering_stats_instrumentation),
166 use_cheapness_estimator_(use_cheapness_estimator), 167 use_cheapness_estimator_(use_cheapness_estimator),
167 use_color_estimator_(use_color_estimator), 168 use_color_estimator_(use_color_estimator),
168 prediction_benchmarking_(prediction_benchmarking), 169 prediction_benchmarking_(prediction_benchmarking),
169 pending_tasks_(0), 170 pending_tasks_(0),
170 max_pending_tasks_(kMaxNumPendingTasksPerThread * num_raster_threads), 171 max_pending_tasks_(kMaxNumPendingTasksPerThread * num_raster_threads) {
171 rendering_stats_instrumentation_(rendering_stats_instrumentation) {
172 for (int i = 0; i < NUM_STATES; ++i) { 172 for (int i = 0; i < NUM_STATES; ++i) {
173 for (int j = 0; j < NUM_TREES; ++j) { 173 for (int j = 0; j < NUM_TREES; ++j) {
174 for (int k = 0; k < NUM_BINS; ++k) 174 for (int k = 0; k < NUM_BINS; ++k)
175 raster_state_count_[i][j][k] = 0; 175 raster_state_count_[i][j][k] = 0;
176 } 176 }
177 } 177 }
178 } 178 }
179 179
180 TileManager::~TileManager() { 180 TileManager::~TileManager() {
181 // Reset global state and manage. This should cause 181 // Reset global state and manage. This should cause
182 // our memory usage to drop to zero. 182 // our memory usage to drop to zero.
183 global_state_ = GlobalStateThatImpactsTilePriority(); 183 global_state_ = GlobalStateThatImpactsTilePriority();
184 AssignGpuMemoryToTiles(); 184 AssignGpuMemoryToTiles();
185 // This should finish all pending tasks and release any uninitialized 185 // This should finish all pending tasks and release any uninitialized
186 // resources. 186 // resources.
187 raster_worker_pool_.reset(); 187 raster_worker_pool_.reset();
188 AbortPendingTileUploads(); 188 AbortPendingTileUploads();
189 DCHECK_EQ(tiles_with_pending_upload_.size(), 0); 189 DCHECK(tiles_with_pending_upload_.empty());
190 DCHECK_EQ(all_tiles_.size(), 0); 190 DCHECK(all_tiles_.empty());
191 DCHECK_EQ(live_or_allocated_tiles_.size(), 0); 191 DCHECK(live_or_allocated_tiles_.empty());
192 } 192 }
193 193
194 void TileManager::SetGlobalState( 194 void TileManager::SetGlobalState(
195 const GlobalStateThatImpactsTilePriority& global_state) { 195 const GlobalStateThatImpactsTilePriority& global_state) {
196 global_state_ = global_state; 196 global_state_ = global_state;
197 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); 197 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes);
198 ScheduleManageTiles(); 198 ScheduleManageTiles();
199 UpdateCheapTasksTimeLimit(); 199 UpdateCheapTasksTimeLimit();
200 } 200 }
201 201
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 10); 1003 10);
1004 1004
1005 if (metadata.prediction_benchmarking) { 1005 if (metadata.prediction_benchmarking) {
1006 PicturePileImpl::Analysis analysis; 1006 PicturePileImpl::Analysis analysis;
1007 picture_pile->AnalyzeInRect(rect, contents_scale, &analysis); 1007 picture_pile->AnalyzeInRect(rect, contents_scale, &analysis);
1008 bool is_predicted_cheap = analysis.is_cheap_to_raster; 1008 bool is_predicted_cheap = analysis.is_cheap_to_raster;
1009 bool is_actually_cheap = duration.InMillisecondsF() <= 1.0f; 1009 bool is_actually_cheap = duration.InMillisecondsF() <= 1.0f;
1010 RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap); 1010 RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap);
1011 1011
1012 DCHECK_EQ(bitmap.rowBytes(), 1012 DCHECK_EQ(bitmap.rowBytes(),
1013 bitmap.width() * bitmap.bytesPerPixel()); 1013 static_cast<size_t>(bitmap.width() * bitmap.bytesPerPixel()));
1014 1014
1015 RecordSolidColorPredictorResults( 1015 RecordSolidColorPredictorResults(
1016 reinterpret_cast<SkColor*>(bitmap.getPixels()), 1016 reinterpret_cast<SkColor*>(bitmap.getPixels()),
1017 bitmap.getSize() / bitmap.bytesPerPixel(), 1017 bitmap.getSize() / bitmap.bytesPerPixel(),
1018 analysis.is_solid_color, 1018 analysis.is_solid_color,
1019 analysis.solid_color, 1019 analysis.solid_color,
1020 analysis.is_transparent); 1020 analysis.is_transparent);
1021 } 1021 }
1022 } 1022 }
1023 } 1023 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 skia::LazyPixelRef* pixel_ref, 1091 skia::LazyPixelRef* pixel_ref,
1092 RenderingStatsInstrumentation* stats_instrumentation) { 1092 RenderingStatsInstrumentation* stats_instrumentation) {
1093 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); 1093 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask");
1094 base::TimeTicks start_time = stats_instrumentation->StartRecording(); 1094 base::TimeTicks start_time = stats_instrumentation->StartRecording();
1095 pixel_ref->Decode(); 1095 pixel_ref->Decode();
1096 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); 1096 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time);
1097 stats_instrumentation->AddDeferredImageDecode(duration); 1097 stats_instrumentation->AddDeferredImageDecode(duration);
1098 } 1098 }
1099 1099
1100 } // namespace cc 1100 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698