| Index: base/memory/discardable_memory.h
|
| diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h
|
| index d6e91b979d5a46fdd50e6ef07ab4f52a904bc042..70294fbb64d11c20db33d8c9a3a1d0206abe8dd9 100644
|
| --- a/base/memory/discardable_memory.h
|
| +++ b/base/memory/discardable_memory.h
|
| @@ -17,6 +17,10 @@ enum LockDiscardableMemoryStatus {
|
| DISCARDABLE_MEMORY_SUCCESS = 1
|
| };
|
|
|
| +#if defined(OS_MACOSX) || defined(OS_ANDROID)
|
| +#define DISCARDABLE_MEMORY_SUPPORTED_NATIVELY
|
| +#endif
|
| +
|
| // Platform abstraction for discardable memory. DiscardableMemory is used to
|
| // cache large objects without worrying about blowing out memory, both on mobile
|
| // devices where there is no swap, and desktop devices where unused free memory
|
| @@ -72,6 +76,8 @@ class BASE_EXPORT DiscardableMemory {
|
| // after every successful lock call.
|
| void Unlock();
|
|
|
| + bool is_locked() const { return is_locked_; }
|
| +
|
| // Return the memory address held by this object. The object must be locked
|
| // before calling this. Otherwise, this will cause a DCHECK error.
|
| void* Memory() const;
|
| @@ -87,6 +93,15 @@ class BASE_EXPORT DiscardableMemory {
|
| static void PurgeForTesting();
|
|
|
| private:
|
| +#if !defined(DISCARDABLE_MEMORY_SUPPORTED_NATIVELY)
|
| + friend class DiscardableMemoryProvider;
|
| + friend class DiscardableMemoryProviderTest;
|
| +
|
| + // Used by the DiscardableMemoryProvider to allocate and free memory.
|
| + bool Allocate();
|
| + void Deallocate();
|
| +#endif
|
| +
|
| #if defined(OS_ANDROID)
|
| // Maps the discardable memory into the caller's address space.
|
| // Returns true on success, false otherwise.
|
|
|