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

Side by Side Diff: cc/tiles/software_image_decode_cache.cc

Issue 2904743002: cc: Add UMA for tracking decode duration for out of raster decodes. (Closed)
Patch Set: .. Created 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/tiles/software_image_decode_cache.h" 5 #include "cc/tiles/software_image_decode_cache.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 task_type_(task_type), 106 task_type_(task_type),
107 tracing_info_(tracing_info) {} 107 tracing_info_(tracing_info) {}
108 108
109 // Overridden from Task: 109 // Overridden from Task:
110 void RunOnWorkerThread() override { 110 void RunOnWorkerThread() override {
111 TRACE_EVENT2("cc", "ImageDecodeTaskImpl::RunOnWorkerThread", "mode", 111 TRACE_EVENT2("cc", "ImageDecodeTaskImpl::RunOnWorkerThread", "mode",
112 "software", "source_prepare_tiles_id", 112 "software", "source_prepare_tiles_id",
113 tracing_info_.prepare_tiles_id); 113 tracing_info_.prepare_tiles_id);
114 devtools_instrumentation::ScopedImageDecodeTask image_decode_task( 114 devtools_instrumentation::ScopedImageDecodeTask image_decode_task(
115 image_.image().get(), 115 image_.image().get(),
116 devtools_instrumentation::ScopedImageDecodeTask::SOFTWARE); 116 devtools_instrumentation::ScopedImageDecodeTask::SOFTWARE,
117 ImageDecodeCache::ToScopedDecodeTaskType(tracing_info_.type));
117 cache_->DecodeImage(image_key_, image_, task_type_); 118 cache_->DecodeImage(image_key_, image_, task_type_);
118 } 119 }
119 120
120 // Overridden from TileTask: 121 // Overridden from TileTask:
121 void OnTaskCompleted() override { 122 void OnTaskCompleted() override {
122 cache_->RemovePendingTask(image_key_, task_type_); 123 cache_->RemovePendingTask(image_key_, task_type_);
123 } 124 }
124 125
125 protected: 126 protected:
126 ~ImageDecodeTaskImpl() override {} 127 ~ImageDecodeTaskImpl() override {}
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( 221 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
221 this); 222 this);
222 // Unregister this component with memory_coordinator::ClientRegistry. 223 // Unregister this component with memory_coordinator::ClientRegistry.
223 base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this); 224 base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this);
224 } 225 }
225 226
226 bool SoftwareImageDecodeCache::GetTaskForImageAndRef( 227 bool SoftwareImageDecodeCache::GetTaskForImageAndRef(
227 const DrawImage& image, 228 const DrawImage& image,
228 const TracingInfo& tracing_info, 229 const TracingInfo& tracing_info,
229 scoped_refptr<TileTask>* task) { 230 scoped_refptr<TileTask>* task) {
231 DCHECK_EQ(tracing_info.type, ImageDecodeType::kInRaster);
230 return GetTaskForImageAndRefInternal( 232 return GetTaskForImageAndRefInternal(
231 image, tracing_info, DecodeTaskType::USE_IN_RASTER_TASKS, task); 233 image, tracing_info, DecodeTaskType::USE_IN_RASTER_TASKS, task);
232 } 234 }
233 235
234 bool SoftwareImageDecodeCache::GetOutOfRasterDecodeTaskForImageAndRef( 236 bool SoftwareImageDecodeCache::GetOutOfRasterDecodeTaskForImageAndRef(
235 const DrawImage& image, 237 const DrawImage& image,
238 ImageDecodeType decode_type,
236 scoped_refptr<TileTask>* task) { 239 scoped_refptr<TileTask>* task) {
240 DCHECK_NE(decode_type, ImageDecodeType::kInRaster);
237 return GetTaskForImageAndRefInternal( 241 return GetTaskForImageAndRefInternal(
238 image, TracingInfo(), DecodeTaskType::USE_OUT_OF_RASTER_TASKS, task); 242 image, TracingInfo(0, TilePriority::NOW, decode_type),
243 DecodeTaskType::USE_OUT_OF_RASTER_TASKS, task);
239 } 244 }
240 245
241 bool SoftwareImageDecodeCache::GetTaskForImageAndRefInternal( 246 bool SoftwareImageDecodeCache::GetTaskForImageAndRefInternal(
242 const DrawImage& image, 247 const DrawImage& image,
243 const TracingInfo& tracing_info, 248 const TracingInfo& tracing_info,
244 DecodeTaskType task_type, 249 DecodeTaskType task_type,
245 scoped_refptr<TileTask>* task) { 250 scoped_refptr<TileTask>* task) {
246 // If the image already exists or if we're going to create a task for it, then 251 // If the image already exists or if we're going to create a task for it, then
247 // we'll likely need to ref this image (the exception is if we're prerolling 252 // we'll likely need to ref this image (the exception is if we're prerolling
248 // the image only). That means the image is or will be in the cache. When the 253 // the image only). That means the image is or will be in the cache. When the
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 } 1184 }
1180 } 1185 }
1181 } 1186 }
1182 1187
1183 void SoftwareImageDecodeCache::OnPurgeMemory() { 1188 void SoftwareImageDecodeCache::OnPurgeMemory() {
1184 base::AutoLock lock(lock_); 1189 base::AutoLock lock(lock_);
1185 ReduceCacheUsageUntilWithinLimit(0); 1190 ReduceCacheUsageUntilWithinLimit(0);
1186 } 1191 }
1187 1192
1188 } // namespace cc 1193 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698