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

Unified Diff: src/core/SkBasicDiscardableMemory.h

Issue 74793011: Add SkImageGenerator Interface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: protected destructor Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698