| Index: base/memory/discardable_shared_memory.h
|
| diff --git a/base/memory/discardable_shared_memory.h b/base/memory/discardable_shared_memory.h
|
| index 0b5ac9fba8e5f7d9f82245720b69bd9c4051b49b..5dca884ca82e2d6665930905c92e990b8a5515c2 100644
|
| --- a/base/memory/discardable_shared_memory.h
|
| +++ b/base/memory/discardable_shared_memory.h
|
| @@ -15,15 +15,10 @@
|
| #include <set>
|
| #endif
|
|
|
| -// Linux (including Android) support the MADV_REMOVE argument with madvise()
|
| -// which has the behavior of reliably causing zero-fill-on-demand pages to
|
| -// be returned after a call. Here we define
|
| -// DISCARDABLE_SHARED_MEMORY_ZERO_FILL_ON_DEMAND_PAGES_AFTER_PURGE on Linux
|
| -// and Android to indicate that this type of behavior can be expected on
|
| -// those platforms. Note that madvise() will still be used on other POSIX
|
| -// platforms but doesn't provide the zero-fill-on-demand pages guarantee.
|
| -#if defined(OS_LINUX) || defined(OS_ANDROID)
|
| -#define DISCARDABLE_SHARED_MEMORY_ZERO_FILL_ON_DEMAND_PAGES_AFTER_PURGE
|
| +// 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 {
|
| @@ -129,6 +124,12 @@
|
| 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;
|
|
|