OLD | NEW |
---|---|
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 #ifndef SkDiscardableMemoryPool_DEFINED | 8 #ifndef SkDiscardableMemoryPool_DEFINED |
9 #define SkDiscardableMemoryPool_DEFINED | 9 #define SkDiscardableMemoryPool_DEFINED |
10 | 10 |
11 #include "SkDiscardableMemory.h" | 11 #include "SkDiscardableMemory.h" |
12 | 12 |
13 #ifndef SK_LAZY_CACHE_STATS | 13 #ifndef SK_LAZY_CACHE_STATS |
14 #ifdef SK_DEBUG | 14 #ifdef SK_DEBUG |
15 #define SK_LAZY_CACHE_STATS 1 | 15 #define SK_LAZY_CACHE_STATS 1 |
16 #else | 16 #else |
17 #define SK_LAZY_CACHE_STATS 0 | 17 #define SK_LAZY_CACHE_STATS 0 |
18 #endif | 18 #endif |
19 #endif | 19 #endif |
20 | 20 |
21 /** | 21 /** |
22 * An implementation of Discardable Memory that manages a fixed-size | 22 * An implementation of Discardable Memory that manages a fixed-size |
23 * budget of memory. When the allocated memory exceeds this size, | 23 * budget of memory. When the allocated memory exceeds this size, |
24 * unlocked blocks of memory are purged. If all memory is locked, it | 24 * unlocked blocks of memory are purged. If all memory is locked, it |
25 * can exceed the memory-use budget. | 25 * can exceed the memory-use budget. |
26 */ | 26 */ |
27 class SkDiscardableMemoryPool : public SkDiscardableMemory::Factory { | 27 class SkDiscardableMemoryPool : public SkDiscardableMemory::Factory { |
scroggo
2014/04/08 13:59:49
I put this in include/lazy because its source file
scroggo
2014/05/23 20:07:55
Again, Hal's change https://codereview.chromium.or
| |
28 public: | 28 public: |
29 virtual ~SkDiscardableMemoryPool() { } | 29 virtual ~SkDiscardableMemoryPool() { } |
30 | 30 |
31 virtual size_t getRAMUsed() = 0; | 31 virtual size_t getRAMUsed() = 0; |
32 virtual void setRAMBudget(size_t budget) = 0; | 32 virtual void setRAMBudget(size_t budget) = 0; |
33 virtual size_t getRAMBudget() = 0; | 33 virtual size_t getRAMBudget() = 0; |
34 | 34 |
35 /** purges all unlocked DMs */ | 35 /** purges all unlocked DMs */ |
36 virtual void dumpPool() = 0; | 36 virtual void dumpPool() = 0; |
37 | 37 |
(...skipping 21 matching lines...) Expand all Loading... | |
59 * Returns (and creates if needed) a threadsafe global | 59 * Returns (and creates if needed) a threadsafe global |
60 * SkDiscardableMemoryPool. | 60 * SkDiscardableMemoryPool. |
61 */ | 61 */ |
62 SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool(); | 62 SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool(); |
63 | 63 |
64 #if !defined(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE) | 64 #if !defined(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE) |
65 #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (128 * 1024 * 1024) | 65 #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (128 * 1024 * 1024) |
66 #endif | 66 #endif |
67 | 67 |
68 #endif // SkDiscardableMemoryPool_DEFINED | 68 #endif // SkDiscardableMemoryPool_DEFINED |
OLD | NEW |