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

Unified Diff: base/memory/discardable_shared_memory.h

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 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
Index: base/memory/discardable_shared_memory.h
diff --git a/base/memory/discardable_shared_memory.h b/base/memory/discardable_shared_memory.h
index e3b437c89e7e4bb743db4dc1c7d82ed411a1cb40..892d556471ed85afa2d50f30553a097461624eca 100644
--- a/base/memory/discardable_shared_memory.h
+++ b/base/memory/discardable_shared_memory.h
@@ -15,6 +15,12 @@
#include <set>
#endif
+// Define DISCARDABLE_SHARED_MEMORY_SHRINKING if platform supports shrinking
+// of discardable shared memory segments.
+#if defined(OS_POSIX) && !defined(OS_ANDROID)
+#define DISCARDABLE_SHARED_MEMORY_SHRINKING
+#endif
+
namespace base {
// Platform abstraction for discardable shared memory.
@@ -93,12 +99,6 @@ class BASE_EXPORT DiscardableSharedMemory {
// each call.
bool Purge(Time current_time);
- // Purge and release as much memory as possible to the OS.
- // Note: The amount of memory that can be released to the OS is platform
- // specific. Best case, all but one page is released. Worst case, nothing
- // is released.
- bool PurgeAndTruncate(Time current_time);
-
// Returns true if memory is still resident.
bool IsMemoryResident() const;
@@ -116,6 +116,12 @@ class BASE_EXPORT DiscardableSharedMemory {
return shared_memory_.ShareToProcess(process_handle, new_handle);
}
+#if defined(DISCARDABLE_SHARED_MEMORY_SHRINKING)
+ // Release as much memory as possible to the OS. The change in size will
+ // be reflected by the return value of mapped_size().
+ void Shrink();
+#endif
+
private:
// Virtual for tests.
virtual Time Now() const;

Powered by Google App Engine
This is Rietveld 408576698