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

Side by Side Diff: src/core/SkResourceCache.cpp

Issue 1381523002: Revert of Implement SkImageFilter::Cache with SkResourceCache. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 | « src/core/SkImageFilter.cpp ('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 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkChecksum.h" 8 #include "SkChecksum.h"
9 #include "SkMessageBus.h" 9 #include "SkMessageBus.h"
10 #include "SkMipMap.h" 10 #include "SkMipMap.h"
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 651
652 size_t SkGraphics::GetResourceCacheSingleAllocationByteLimit() { 652 size_t SkGraphics::GetResourceCacheSingleAllocationByteLimit() {
653 return SkResourceCache::GetSingleAllocationByteLimit(); 653 return SkResourceCache::GetSingleAllocationByteLimit();
654 } 654 }
655 655
656 size_t SkGraphics::SetResourceCacheSingleAllocationByteLimit(size_t newLimit) { 656 size_t SkGraphics::SetResourceCacheSingleAllocationByteLimit(size_t newLimit) {
657 return SkResourceCache::SetSingleAllocationByteLimit(newLimit); 657 return SkResourceCache::SetSingleAllocationByteLimit(newLimit);
658 } 658 }
659 659
660 void SkGraphics::PurgeResourceCache() { 660 void SkGraphics::PurgeResourceCache() {
661 SkImageFilter::PurgeCache();
661 return SkResourceCache::PurgeAll(); 662 return SkResourceCache::PurgeAll();
662 } 663 }
663 664
664 ///////////// 665 /////////////
665 666
666 static void dump_visitor(const SkResourceCache::Rec& rec, void*) { 667 static void dump_visitor(const SkResourceCache::Rec& rec, void*) {
667 SkDebugf("RC: %12s bytes %9lu discardable %p\n", 668 SkDebugf("RC: %12s bytes %9lu discardable %p\n",
668 rec.getCategory(), rec.bytesUsed(), rec.diagnostic_only_getDiscarda ble()); 669 rec.getCategory(), rec.bytesUsed(), rec.diagnostic_only_getDiscarda ble());
669 } 670 }
670 671
671 void SkResourceCache::TestDumpMemoryStatistics() { 672 void SkResourceCache::TestDumpMemoryStatistics() {
672 VisitAll(dump_visitor, nullptr); 673 VisitAll(dump_visitor, nullptr);
673 } 674 }
674 675
675 static void sk_trace_dump_visitor(const SkResourceCache::Rec& rec, void* context ) { 676 static void sk_trace_dump_visitor(const SkResourceCache::Rec& rec, void* context ) {
676 SkTraceMemoryDump* dump = static_cast<SkTraceMemoryDump*>(context); 677 SkTraceMemoryDump* dump = static_cast<SkTraceMemoryDump*>(context);
677 SkString dump_name = SkStringPrintf("skia/sk_resource_cache/%s_%p", rec.getC ategory(), &rec); 678 SkString dump_name = SkStringPrintf("skia/sk_resource_cache/%s_%p", rec.getC ategory(), &rec);
678 SkDiscardableMemory* discardable = rec.diagnostic_only_getDiscardable(); 679 SkDiscardableMemory* discardable = rec.diagnostic_only_getDiscardable();
679 if (discardable) { 680 if (discardable) {
680 dump->setDiscardableMemoryBacking(dump_name.c_str(), *discardable); 681 dump->setDiscardableMemoryBacking(dump_name.c_str(), *discardable);
681 } else { 682 } else {
682 dump->dumpNumericValue(dump_name.c_str(), "size", "bytes", rec.bytesUsed ()); 683 dump->dumpNumericValue(dump_name.c_str(), "size", "bytes", rec.bytesUsed ());
683 dump->setMemoryBacking(dump_name.c_str(), "malloc", nullptr); 684 dump->setMemoryBacking(dump_name.c_str(), "malloc", nullptr);
684 } 685 }
685 } 686 }
686 687
687 void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) { 688 void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
688 VisitAll(sk_trace_dump_visitor, dump); 689 VisitAll(sk_trace_dump_visitor, dump);
689 } 690 }
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698