Index: src/ports/SkDiscardableMemory_none.cpp |
diff --git a/src/ports/SkDiscardableMemory_none.cpp b/src/ports/SkDiscardableMemory_none.cpp |
index 700713ba4816631dfc7d7e2f3bb69558d5eedbee..51c3164dfa6e90ea3b29f31a29461bc23bf49bcf 100644 |
--- a/src/ports/SkDiscardableMemory_none.cpp |
+++ b/src/ports/SkDiscardableMemory_none.cpp |
@@ -5,57 +5,9 @@ |
* found in the LICENSE file. |
*/ |
-#include "SkDiscardableMemory.h" |
+#include "SkDiscardableMemoryPool.h" |
#include "SkTypes.h" |
-namespace { |
-//////////////////////////////////////////////////////////////////////////////// |
-/** |
- * Always successful, never purges. Useful for testing. |
- */ |
-class SkMockDiscardableMemory : public SkDiscardableMemory { |
-public: |
- SkMockDiscardableMemory(void*); |
- virtual ~SkMockDiscardableMemory(); |
- virtual bool lock() SK_OVERRIDE; |
- virtual void* data() SK_OVERRIDE; |
- virtual void unlock() SK_OVERRIDE; |
-private: |
- bool fLocked; |
- void* fPointer; |
-}; |
- |
-//////////////////////////////////////////////////////////////////////////////// |
- |
-SkMockDiscardableMemory::SkMockDiscardableMemory(void* ptr) |
- : fLocked(true) |
- , fPointer(ptr) { // Takes ownership of ptr. |
- SkASSERT(fPointer != NULL); |
-} |
- |
-SkMockDiscardableMemory::~SkMockDiscardableMemory() { |
- SkASSERT(!fLocked); |
- sk_free(fPointer); |
-} |
- |
-bool SkMockDiscardableMemory::lock() { |
- SkASSERT(!fLocked); |
- return fLocked = true; |
-} |
- |
-void* SkMockDiscardableMemory::data() { |
- SkASSERT(fLocked); |
- return fLocked ? fPointer : NULL; |
-} |
- |
-void SkMockDiscardableMemory::unlock() { |
- SkASSERT(fLocked); |
- fLocked = false; |
-} |
-//////////////////////////////////////////////////////////////////////////////// |
-} // namespace |
- |
SkDiscardableMemory* SkDiscardableMemory::Create(size_t bytes) { |
- void* ptr = sk_malloc_throw(bytes); |
- return (ptr != NULL) ? SkNEW_ARGS(SkMockDiscardableMemory, (ptr)) : NULL; |
+ return SkGetGlobalDiscardableMemoryPool()->create(bytes); |
} |