Index: src/core/SkBasicDiscardableMemory.h |
diff --git a/src/core/SkDiscardableMemory.h b/src/core/SkBasicDiscardableMemory.h |
similarity index 53% |
copy from src/core/SkDiscardableMemory.h |
copy to src/core/SkBasicDiscardableMemory.h |
index e1634eef4f4013a5945f4cb64f67b09c17d16271..8172759a5bc50f67d30a8829326722da3e869cc7 100644 |
--- a/src/core/SkDiscardableMemory.h |
+++ b/src/core/SkBasicDiscardableMemory.h |
@@ -5,27 +5,19 @@ |
* found in the LICENSE file. |
*/ |
-#ifndef SkDiscardableMemory_DEFINED |
-#define SkDiscardableMemory_DEFINED |
+#ifndef SkBasicDiscardableMemory_DEFINED |
+#define SkBasicDiscardableMemory_DEFINED |
-#include "SkTypes.h" |
+#include "SkDiscardableMemory.h" |
/** |
- * Interface for discardable memory. Implementation is provided by the |
- * embedder. |
+ * Always successful, never purges |
*/ |
-class SK_API SkDiscardableMemory { |
- |
+class SkBasicDiscardableMemory : public SkDiscardableMemory { |
reed1
2013/11/19 22:01:18
bikeshed: SkMallocDiscardableMemory?
scroggo
2013/11/19 22:19:27
It seems dishonest to call this SkBasicDiscardable
hal.canary
2013/11/20 00:07:10
Done.
|
public: |
- /** |
- * Factory method that creates, initializes and locks an SkDiscardableMemory |
- * object. If either of these steps fails, a NULL pointer will be returned. |
- */ |
- static SkDiscardableMemory* Create(size_t bytes); |
- |
/** Must not be called while locked. |
*/ |
- virtual ~SkDiscardableMemory() {} |
+ virtual ~SkBasicDiscardableMemory(); |
/** |
* Locks the memory, prevent it from being discarded. Once locked. you may |
scroggo
2013/11/19 22:19:27
Comments don't apply.
hal.canary
2013/11/20 00:07:10
Done.
|
@@ -36,19 +28,26 @@ public: |
* |
* Nested calls to lock are not allowed. |
*/ |
- virtual bool lock() = 0; |
+ virtual bool lock() SK_OVERRIDE; |
/** |
- * Returns the current pointer for the discardable memory. This call is ONLY |
- * valid when the discardable memory object is locked. |
+ * Returns the current pointer for the discardable memory. This |
+ * call is ONLY valid when the discardable memory object is |
+ * locked. |
*/ |
- virtual void* data() = 0; |
+ virtual void* data() SK_OVERRIDE; |
/** |
- * Unlock the memory so that it can be purged by the system. Must be called |
- * after every successful lock call. |
+ * Unlock the memory so that it can be purged by the system. Must |
+ * be called after every successful lock call. |
*/ |
- virtual void unlock() = 0; |
+ virtual void unlock() SK_OVERRIDE; |
+ |
+ static SkDiscardableMemory* Create(size_t bytes); |
+private: |
+ bool fLocked; |
+ void* fPointer; |
+ SkBasicDiscardableMemory(void*); |
}; |
-#endif |
+#endif // SkBasicDiscardableMemory_DEFINED |