OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrCacheable_DEFINED | 8 #ifndef GrCacheable_DEFINED |
9 #define GrCacheable_DEFINED | 9 #define GrCacheable_DEFINED |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 virtual bool isValidOnGpu() const = 0; | 39 virtual bool isValidOnGpu() const = 0; |
40 | 40 |
41 void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEn
try; } | 41 void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEn
try; } |
42 GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; } | 42 GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; } |
43 | 43 |
44 protected: | 44 protected: |
45 GrCacheable() : fCacheEntry(NULL) {} | 45 GrCacheable() : fCacheEntry(NULL) {} |
46 | 46 |
47 bool isInCache() const { return NULL != fCacheEntry; } | 47 bool isInCache() const { return NULL != fCacheEntry; } |
48 | 48 |
| 49 /** |
| 50 * This entry point should be called whenever gpuMemorySize() begins |
| 51 * reporting a different size. If the object is in the cache, it will call |
| 52 * gpuMemorySize() immediately and pass the new size on to the resource |
| 53 * cache. |
| 54 */ |
| 55 void didChangeGpuMemorySize() const; |
| 56 |
49 private: | 57 private: |
50 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache | 58 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache |
51 | 59 |
52 typedef SkRefCnt INHERITED; | 60 typedef SkRefCnt INHERITED; |
53 }; | 61 }; |
54 | 62 |
55 #endif | 63 #endif |
OLD | NEW |