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

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

Issue 2844273004: cc: Make images that can't possibly fit in cache not checker. (Closed)
Patch Set: tests Created 3 years, 7 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/tiles/gpu_image_decode_cache.h ('k') | cc/tiles/image_controller.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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 bytes_used_ -= it->second->size; 609 bytes_used_ -= it->second->size;
610 images_pending_deletion_.push_back(it->second->upload.image()); 610 images_pending_deletion_.push_back(it->second->upload.image());
611 it->second->upload.SetImage(nullptr); 611 it->second->upload.SetImage(nullptr);
612 it->second->upload.budgeted = false; 612 it->second->upload.budgeted = false;
613 } 613 }
614 614
615 it = persistent_cache_.Erase(it); 615 it = persistent_cache_.Erase(it);
616 } 616 }
617 } 617 }
618 618
619 size_t GpuImageDecodeCache::GetMaximumMemoryLimitBytes() const {
620 return normal_max_cache_bytes_;
621 }
622
619 bool GpuImageDecodeCache::OnMemoryDump( 623 bool GpuImageDecodeCache::OnMemoryDump(
620 const base::trace_event::MemoryDumpArgs& args, 624 const base::trace_event::MemoryDumpArgs& args,
621 base::trace_event::ProcessMemoryDump* pmd) { 625 base::trace_event::ProcessMemoryDump* pmd) {
622 using base::trace_event::MemoryAllocatorDump; 626 using base::trace_event::MemoryAllocatorDump;
623 using base::trace_event::MemoryAllocatorDumpGuid; 627 using base::trace_event::MemoryAllocatorDumpGuid;
624 using base::trace_event::MemoryDumpLevelOfDetail; 628 using base::trace_event::MemoryDumpLevelOfDetail;
625 629
626 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), 630 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
627 "GpuImageDecodeCache::OnMemoryDump"); 631 "GpuImageDecodeCache::OnMemoryDump");
628 632
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 1099
1096 switch (image_data->mode) { 1100 switch (image_data->mode) {
1097 case DecodedDataMode::CPU: { 1101 case DecodedDataMode::CPU: {
1098 SkImageInfo image_info = CreateImageInfoForDrawImage( 1102 SkImageInfo image_info = CreateImageInfoForDrawImage(
1099 draw_image, image_data->upload_params.fPreScaleMipLevel); 1103 draw_image, image_data->upload_params.fPreScaleMipLevel);
1100 // In order to match GPU scaling quality (which uses mip-maps at high 1104 // In order to match GPU scaling quality (which uses mip-maps at high
1101 // quality), we want to use at most medium filter quality for the 1105 // quality), we want to use at most medium filter quality for the
1102 // scale. 1106 // scale.
1103 SkPixmap image_pixmap(image_info.makeColorSpace(nullptr), 1107 SkPixmap image_pixmap(image_info.makeColorSpace(nullptr),
1104 backing_memory->data(), image_info.minRowBytes()); 1108 backing_memory->data(), image_info.minRowBytes());
1105 // Note that scalePixels falls back to readPixels if the sale is 1x, so 1109 // Note that scalePixels falls back to readPixels if the scale is 1x, so
1106 // no need to special case that as an optimization. 1110 // no need to special case that as an optimization.
1107 if (!draw_image.image()->scalePixels( 1111 if (!draw_image.image()->scalePixels(
1108 image_pixmap, CalculateUploadScaleFilterQuality(draw_image), 1112 image_pixmap, CalculateUploadScaleFilterQuality(draw_image),
1109 SkImage::kDisallow_CachingHint)) { 1113 SkImage::kDisallow_CachingHint)) {
1110 DLOG(ERROR) << "scalePixels failed."; 1114 DLOG(ERROR) << "scalePixels failed.";
1111 backing_memory->Unlock(); 1115 backing_memory->Unlock();
1112 backing_memory.reset(); 1116 backing_memory.reset();
1113 } 1117 }
1114 break; 1118 break;
1115 } 1119 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 1343
1340 void GpuImageDecodeCache::OnPurgeMemory() { 1344 void GpuImageDecodeCache::OnPurgeMemory() {
1341 base::AutoLock lock(lock_); 1345 base::AutoLock lock(lock_);
1342 // Temporary changes |memory_state_| to free up cache as much as possible. 1346 // Temporary changes |memory_state_| to free up cache as much as possible.
1343 base::AutoReset<base::MemoryState> reset(&memory_state_, 1347 base::AutoReset<base::MemoryState> reset(&memory_state_,
1344 base::MemoryState::SUSPENDED); 1348 base::MemoryState::SUSPENDED);
1345 EnsureCapacity(0); 1349 EnsureCapacity(0);
1346 } 1350 }
1347 1351
1348 } // namespace cc 1352 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/gpu_image_decode_cache.h ('k') | cc/tiles/image_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698