Index: src/core/SkResourceCache.h |
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h |
index a748133c964d74a2b8e3422c6e3c5563da9ddd3b..548f17fe87a496ca168c29bd4145131cd99ae87f 100644 |
--- a/src/core/SkResourceCache.h |
+++ b/src/core/SkResourceCache.h |
@@ -29,14 +29,18 @@ class SkTraceMemoryDump; |
class SkResourceCache { |
public: |
struct Key { |
- // Call this to access your private contents. Must not use the address after calling init() |
- void* writableContents() { return this + 1; } |
- |
- // must call this after your private data has been written. |
- // nameSpace must be unique per Key subclass. |
- // sharedID == 0 means ignore this field : does not support group purging. |
- // length must be a multiple of 4 |
- void init(void* nameSpace, uint64_t sharedID, size_t length); |
+ /** Key subclasses must call this after their own fields and data are initialized. |
+ * All fields and data must be tightly packed. |
+ * @param nameSpace must be unique per Key subclass. |
+ * @param sharedID == 0 means ignore this field, does not support group purging. |
+ * @param dataSize is size of fields and data of the subclass, must be a multiple of 4. |
+ */ |
+ void init(void* nameSpace, uint64_t sharedID, size_t dataSize); |
+ |
+ /** Returns the size of this key. */ |
+ size_t size() const { |
+ return fCount32 << 2; |
+ } |
void* getNamespace() const { return fNamespace; } |
uint64_t getSharedID() const { return ((uint64_t)fSharedID_hi << 32) | fSharedID_lo; } |