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

Side by Side Diff: include/lazy/SkImageCache.h

Issue 84783002: SkDiscardableMemory::Factory class (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | Annotate | Revision Log
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 #ifndef SkImageCache_DEFINED 8 #ifndef SkImageCache_DEFINED
9 #define SkImageCache_DEFINED 9 #define SkImageCache_DEFINED
10 10
11 #include "SkRefCnt.h" 11 #include "SkDiscardableMemory.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 SkDiscardableMemory::Factory {
18
19 public: 18 public:
20 SK_DECLARE_INST_COUNT(SkImageCache) 19 SK_DECLARE_INST_COUNT(SkImageCache)
21 20
22 typedef intptr_t ID; 21 typedef intptr_t ID;
23 22
23 virtual SkDiscardableMemory* create(size_t bytes) SK_OVERRIDE;
scroggo 2013/12/02 19:00:09 Need this be virtual? Can you imagine a different
24
24 /** 25 /**
25 * Allocate memory whose lifetime is managed by the cache. On success, MUST be balanced with a 26 * Allocate memory whose lifetime is managed by the cache. On success, MUST be balanced with a
26 * call to releaseCache and a call to throwAwayCache. 27 * call to releaseCache and a call to throwAwayCache.
27 * @param bytes Number of bytes needed. 28 * @param bytes Number of bytes needed.
28 * @param ID Output parameter which must not be NULL. On success, ID will b e set to a value 29 * @param ID Output parameter which must not be NULL. On success, ID will b e set to a value
29 * associated with that memory which can be used as a parameter to the other functions 30 * associated with that memory which can be used as a parameter to the other functions
30 * in SkImageCache. On failure, ID is unchanged. 31 * in SkImageCache. On failure, ID is unchanged.
31 * @return Pointer to the newly allocated memory, or NULL. This memory is s afe to use until 32 * @return Pointer to the newly allocated memory, or NULL. This memory is s afe to use until
32 * releaseCache is called with ID. 33 * releaseCache is called with ID.
33 */ 34 */
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 */ 121 */
121 virtual MemoryStatus getMemoryStatus(intptr_t ID) const = 0; 122 virtual MemoryStatus getMemoryStatus(intptr_t ID) const = 0;
122 123
123 /** 124 /**
124 * Debug only function to clear all unpinned caches. 125 * Debug only function to clear all unpinned caches.
125 */ 126 */
126 virtual void purgeAllUnpinnedCaches() = 0; 127 virtual void purgeAllUnpinnedCaches() = 0;
127 #endif 128 #endif
128 129
129 private: 130 private:
130 typedef SkRefCnt INHERITED; 131 typedef SkDiscardableMemory::Factory INHERITED;
131 }; 132 };
132 #endif // SkImageCache_DEFINED 133 #endif // SkImageCache_DEFINED
134
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698