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

Unified Diff: base/memory/discardable_memory.h

Issue 1013373002: base: Remove DiscardableMemory::CreateLockedMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win build issue Created 5 years, 9 months 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
« no previous file with comments | « no previous file | base/memory/discardable_memory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory.h
diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h
index ce0f0bbe75c7eff42006f8e299c8e8015c1d62bf..a0882ccc94e9ab280ef3a82b9492cd0525b1bb9a 100644
--- a/base/memory/discardable_memory.h
+++ b/base/memory/discardable_memory.h
@@ -5,26 +5,24 @@
#ifndef BASE_MEMORY_DISCARDABLE_MEMORY_H_
#define BASE_MEMORY_DISCARDABLE_MEMORY_H_
-#include <string>
-#include <vector>
-
#include "base/base_export.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
namespace base {
-// 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
-// should be used to help the user experience. This is preferable to releasing
-// memory in response to an OOM signal because it is simpler, though it has less
-// flexibility as to which objects get discarded.
+// Discardable memory 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 should be used to help the user
+// experience. This is preferable to releasing memory in response to an OOM
+// signal because it is simpler and provides system-wide management of
+// purgable memory, though it has less flexibility as to which objects get
+// discarded.
//
// Discardable memory has two states: locked and unlocked. While the memory is
-// locked, it will not be discarded. Unlocking the memory allows the OS to
-// reclaim it if needed. Locks do not nest.
+// locked, it will not be discarded. Unlocking the memory allows the
+// discardable memory system and the OS to reclaim it if needed. Locks do not
+// nest.
//
// Notes:
// - The paging behavior of memory while it is locked is not specified. While
@@ -39,19 +37,10 @@ namespace base {
// responsibility of users of discardable memory to ensure there are no
// races.
//
-// References:
-// - Linux: http://lwn.net/Articles/452035/
-// - Mac: http://trac.webkit.org/browser/trunk/Source/WebCore/platform/mac/PurgeableBufferMac.cpp
-// the comment starting with "vm_object_purgable_control" at
-// http://www.opensource.apple.com/source/xnu/xnu-792.13.8/osfmk/vm/vm_object.c
-//
-// Thread-safety: DiscardableMemory instances are not thread-safe.
class BASE_EXPORT DiscardableMemory {
public:
- virtual ~DiscardableMemory() {}
-
- // Create a DiscardableMemory instance with |size|.
- static scoped_ptr<DiscardableMemory> CreateLockedMemory(size_t size);
+ DiscardableMemory();
+ virtual ~DiscardableMemory();
// Locks the memory so that it will not be purged by the system. Returns
// true on success. If the return value is false then this object should be
« no previous file with comments | « no previous file | base/memory/discardable_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698