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

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

Issue 1351453004: use allocator (if present) when we allocate our cache bitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 /* 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"
11 #include "SkMutex.h" 11 #include "SkMutex.h"
12 #include "SkPixelRef.h" 12 #include "SkPixelRef.h"
13 #include "SkResourceCache.h" 13 #include "SkResourceCache.h"
14 #include "SkTraceMemoryDump.h" 14 #include "SkTraceMemoryDump.h"
15 15
16 #include <stddef.h> 16 #include <stddef.h>
17 #include <stdlib.h> 17 #include <stdlib.h>
18 18
19 DECLARE_SKMESSAGEBUS_MESSAGE(SkResourceCache::PurgeSharedIDMessage) 19 DECLARE_SKMESSAGEBUS_MESSAGE(SkResourceCache::PurgeSharedIDMessage)
20 20
21 // This can be defined by the caller's build system 21 // This can be defined by the caller's build system
22 //#define SK_USE_DISCARDABLE_SCALEDIMAGECACHE 22 #define SK_USE_DISCARDABLE_SCALEDIMAGECACHE
tomhudson 2015/09/17 18:58:07 Don't you want to comment this back out? Or is it
reed1 2015/09/17 19:57:23 Done.
23 23
24 #ifndef SK_DISCARDABLEMEMORY_SCALEDIMAGECACHE_COUNT_LIMIT 24 #ifndef SK_DISCARDABLEMEMORY_SCALEDIMAGECACHE_COUNT_LIMIT
25 # define SK_DISCARDABLEMEMORY_SCALEDIMAGECACHE_COUNT_LIMIT 1024 25 # define SK_DISCARDABLEMEMORY_SCALEDIMAGECACHE_COUNT_LIMIT 1024
26 #endif 26 #endif
27 27
28 #ifndef SK_DEFAULT_IMAGE_CACHE_LIMIT 28 #ifndef SK_DEFAULT_IMAGE_CACHE_LIMIT
29 #define SK_DEFAULT_IMAGE_CACHE_LIMIT (32 * 1024 * 1024) 29 #define SK_DEFAULT_IMAGE_CACHE_LIMIT (32 * 1024 * 1024)
30 #endif 30 #endif
31 31
32 void SkResourceCache::Key::init(void* nameSpace, uint64_t sharedID, size_t lengt h) { 32 void SkResourceCache::Key::init(void* nameSpace, uint64_t sharedID, size_t lengt h) {
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 dump->setDiscardableMemoryBacking(dump_name.c_str(), *discardable); 681 dump->setDiscardableMemoryBacking(dump_name.c_str(), *discardable);
682 } else { 682 } else {
683 dump->dumpNumericValue(dump_name.c_str(), "size", "bytes", rec.bytesUsed ()); 683 dump->dumpNumericValue(dump_name.c_str(), "size", "bytes", rec.bytesUsed ());
684 dump->setMemoryBacking(dump_name.c_str(), "malloc", nullptr); 684 dump->setMemoryBacking(dump_name.c_str(), "malloc", nullptr);
685 } 685 }
686 } 686 }
687 687
688 void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) { 688 void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
689 VisitAll(sk_trace_dump_visitor, dump); 689 VisitAll(sk_trace_dump_visitor, dump);
690 } 690 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698