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

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

Issue 2904743002: cc: Add UMA for tracking decode duration for out of raster decodes. (Closed)
Patch Set: move 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
« no previous file with comments | « cc/base/devtools_instrumentation.cc ('k') | cc/tiles/image_decode_cache.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/gpu_image_decode_cache.h" 5 #include "cc/tiles/gpu_image_decode_cache.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 task_type_(task_type) { 166 task_type_(task_type) {
167 DCHECK(!SkipImage(draw_image)); 167 DCHECK(!SkipImage(draw_image));
168 } 168 }
169 169
170 // Overridden from Task: 170 // Overridden from Task:
171 void RunOnWorkerThread() override { 171 void RunOnWorkerThread() override {
172 TRACE_EVENT2("cc", "ImageDecodeTaskImpl::RunOnWorkerThread", "mode", "gpu", 172 TRACE_EVENT2("cc", "ImageDecodeTaskImpl::RunOnWorkerThread", "mode", "gpu",
173 "source_prepare_tiles_id", tracing_info_.prepare_tiles_id); 173 "source_prepare_tiles_id", tracing_info_.prepare_tiles_id);
174 devtools_instrumentation::ScopedImageDecodeTask image_decode_task( 174 devtools_instrumentation::ScopedImageDecodeTask image_decode_task(
175 image_.image().get(), 175 image_.image().get(),
176 devtools_instrumentation::ScopedImageDecodeTask::GPU); 176 devtools_instrumentation::ScopedImageDecodeTask::kGpu,
177 ImageDecodeCache::ToScopedTaskType(tracing_info_.task_type));
177 cache_->DecodeImage(image_); 178 cache_->DecodeImage(image_);
178 } 179 }
179 180
180 // Overridden from TileTask: 181 // Overridden from TileTask:
181 void OnTaskCompleted() override { 182 void OnTaskCompleted() override {
182 cache_->OnImageDecodeTaskCompleted(image_, task_type_); 183 cache_->OnImageDecodeTaskCompleted(image_, task_type_);
183 } 184 }
184 185
185 protected: 186 protected:
186 ~ImageDecodeTaskImpl() override {} 187 ~ImageDecodeTaskImpl() override {}
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // It is safe to unregister, even if we didn't register in the constructor. 393 // It is safe to unregister, even if we didn't register in the constructor.
393 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( 394 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
394 this); 395 this);
395 // Unregister this component with memory_coordinator::ClientRegistry. 396 // Unregister this component with memory_coordinator::ClientRegistry.
396 base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this); 397 base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this);
397 } 398 }
398 399
399 bool GpuImageDecodeCache::GetTaskForImageAndRef(const DrawImage& draw_image, 400 bool GpuImageDecodeCache::GetTaskForImageAndRef(const DrawImage& draw_image,
400 const TracingInfo& tracing_info, 401 const TracingInfo& tracing_info,
401 scoped_refptr<TileTask>* task) { 402 scoped_refptr<TileTask>* task) {
403 DCHECK_EQ(tracing_info.task_type, TaskType::kInRaster);
402 return GetTaskForImageAndRefInternal( 404 return GetTaskForImageAndRefInternal(
403 draw_image, tracing_info, DecodeTaskType::PART_OF_UPLOAD_TASK, task); 405 draw_image, tracing_info, DecodeTaskType::PART_OF_UPLOAD_TASK, task);
404 } 406 }
405 407
406 bool GpuImageDecodeCache::GetOutOfRasterDecodeTaskForImageAndRef( 408 bool GpuImageDecodeCache::GetOutOfRasterDecodeTaskForImageAndRef(
407 const DrawImage& draw_image, 409 const DrawImage& draw_image,
408 scoped_refptr<TileTask>* task) { 410 scoped_refptr<TileTask>* task) {
409 return GetTaskForImageAndRefInternal( 411 return GetTaskForImageAndRefInternal(
410 draw_image, TracingInfo(), DecodeTaskType::STAND_ALONE_DECODE_TASK, task); 412 draw_image, TracingInfo(0, TilePriority::NOW, TaskType::kOutOfRaster),
413 DecodeTaskType::STAND_ALONE_DECODE_TASK, task);
411 } 414 }
412 415
413 bool GpuImageDecodeCache::GetTaskForImageAndRefInternal( 416 bool GpuImageDecodeCache::GetTaskForImageAndRefInternal(
414 const DrawImage& draw_image, 417 const DrawImage& draw_image,
415 const TracingInfo& tracing_info, 418 const TracingInfo& tracing_info,
416 DecodeTaskType task_type, 419 DecodeTaskType task_type,
417 scoped_refptr<TileTask>* task) { 420 scoped_refptr<TileTask>* task) {
418 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), 421 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
419 "GpuImageDecodeCache::GetTaskForImageAndRef"); 422 "GpuImageDecodeCache::GetTaskForImageAndRef");
420 if (SkipImage(draw_image)) { 423 if (SkipImage(draw_image)) {
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 1346
1344 void GpuImageDecodeCache::OnPurgeMemory() { 1347 void GpuImageDecodeCache::OnPurgeMemory() {
1345 base::AutoLock lock(lock_); 1348 base::AutoLock lock(lock_);
1346 // Temporary changes |memory_state_| to free up cache as much as possible. 1349 // Temporary changes |memory_state_| to free up cache as much as possible.
1347 base::AutoReset<base::MemoryState> reset(&memory_state_, 1350 base::AutoReset<base::MemoryState> reset(&memory_state_,
1348 base::MemoryState::SUSPENDED); 1351 base::MemoryState::SUSPENDED);
1349 EnsureCapacity(0); 1352 EnsureCapacity(0);
1350 } 1353 }
1351 1354
1352 } // namespace cc 1355 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/devtools_instrumentation.cc ('k') | cc/tiles/image_decode_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698