X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fbase%2Fmemory%2Fdiscardable_memory_manager.h;h=8bf92891a3ea967d897053f138d09030de808e62;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=94b3c55108f22715b0afcbfca019ffe92b357e9f;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/base/memory/discardable_memory_manager.h b/src/base/memory/discardable_memory_manager.h index 94b3c55..8bf9289 100644 --- a/src/base/memory/discardable_memory_manager.h +++ b/src/base/memory/discardable_memory_manager.h @@ -31,6 +31,10 @@ class DiscardableMemoryManagerAllocation { // is acquired on the allocation. virtual void Purge() = 0; + // Check if allocated memory is still resident. It is illegal to call this + // while a lock is acquired on the allocation. + virtual bool IsMemoryResident() const = 0; + protected: virtual ~DiscardableMemoryManagerAllocation() {} }; @@ -38,18 +42,6 @@ class DiscardableMemoryManagerAllocation { } // namespace internal } // namespace base -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { -template <> -struct hash { - size_t operator()( - base::internal::DiscardableMemoryManagerAllocation* ptr) const { - return hash()(reinterpret_cast(ptr)); - } -}; -} // namespace BASE_HASH_NAMESPACE -#endif // COMPILER - namespace base { namespace internal { @@ -80,6 +72,9 @@ class BASE_EXPORT_PRIVATE DiscardableMemoryManager { void SetHardMemoryLimitExpirationTime( TimeDelta hard_memory_limit_expiration_time); + // This will make sure that all purged memory is released to the OS. + void ReleaseFreeMemory(); + // This will attempt to reduce memory footprint until within soft memory // limit. Returns true if there's no need to call this again until allocations // have been used.