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 SkImageCache_DEFINED | 8 #ifndef SkImageCache_DEFINED |
9 #define SkImageCache_DEFINED | 9 #define SkImageCache_DEFINED |
10 | 10 |
11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
12 #include "SkTypes.h" | 12 #include "SkTypes.h" |
13 | 13 |
14 /** | 14 /** |
15 * Interface for a cache that manages pixel memory. | 15 * Interface for a cache that manages pixel memory. |
16 */ | 16 */ |
17 class SkImageCache : public SkRefCnt { | 17 class SkImageCache : public SkRefCnt { |
18 | 18 |
19 public: | 19 public: |
| 20 SK_DECLARE_INST_COUNT(SkImageCache) |
| 21 |
20 typedef intptr_t ID; | 22 typedef intptr_t ID; |
21 | 23 |
22 /** | 24 /** |
23 * Allocate memory whose lifetime is managed by the cache. On success, MUST
be balanced with a | 25 * Allocate memory whose lifetime is managed by the cache. On success, MUST
be balanced with a |
24 * call to releaseCache and a call to throwAwayCache. | 26 * call to releaseCache and a call to throwAwayCache. |
25 * @param bytes Number of bytes needed. | 27 * @param bytes Number of bytes needed. |
26 * @param ID Output parameter which must not be NULL. On success, ID will b
e set to a value | 28 * @param ID Output parameter which must not be NULL. On success, ID will b
e set to a value |
27 * associated with that memory which can be used as a parameter to the
other functions | 29 * associated with that memory which can be used as a parameter to the
other functions |
28 * in SkImageCache. On failure, ID is unchanged. | 30 * in SkImageCache. On failure, ID is unchanged. |
29 * @return Pointer to the newly allocated memory, or NULL. This memory is s
afe to use until | 31 * @return Pointer to the newly allocated memory, or NULL. This memory is s
afe to use until |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 * Debug only function to get the status of a particular block of memory. S
afe to call after | 118 * Debug only function to get the status of a particular block of memory. S
afe to call after |
117 * throwAwayCache has been called with this ID. | 119 * throwAwayCache has been called with this ID. |
118 */ | 120 */ |
119 virtual MemoryStatus getMemoryStatus(intptr_t ID) const = 0; | 121 virtual MemoryStatus getMemoryStatus(intptr_t ID) const = 0; |
120 | 122 |
121 /** | 123 /** |
122 * Debug only function to clear all unpinned caches. | 124 * Debug only function to clear all unpinned caches. |
123 */ | 125 */ |
124 virtual void purgeAllUnpinnedCaches() = 0; | 126 virtual void purgeAllUnpinnedCaches() = 0; |
125 #endif | 127 #endif |
| 128 |
| 129 private: |
| 130 typedef SkRefCnt INHERITED; |
126 }; | 131 }; |
127 #endif // SkImageCache_DEFINED | 132 #endif // SkImageCache_DEFINED |
OLD | NEW |