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

Unified Diff: base/memory/discardable_shared_memory.cc

Issue 1473733005: Revert of [Discardable Shared Memory] Adding Windows support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_shared_memory.cc
diff --git a/base/memory/discardable_shared_memory.cc b/base/memory/discardable_shared_memory.cc
index 24bd3e3c720e880839709e0e1fd49717661768a3..1b50da260e09b566807fb40e72a1ab0638db11d3 100644
--- a/base/memory/discardable_shared_memory.cc
+++ b/base/memory/discardable_shared_memory.cc
@@ -19,10 +19,6 @@
#if defined(OS_ANDROID)
#include "third_party/ashmem/ashmem.h"
-#endif
-
-#if defined(OS_WIN)
-#include "base/win/windows_version.h"
#endif
namespace base {
@@ -218,7 +214,6 @@
DCHECK_EQ(locked_pages_.size(), locked_page_count_);
#endif
-// Pin pages if supported.
#if defined(OS_ANDROID)
SharedMemoryHandle handle = shared_memory_.handle();
if (SharedMemory::IsHandleValid(handle)) {
@@ -227,14 +222,6 @@
return PURGED;
}
}
-#elif defined(OS_WIN)
- if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
- if (!VirtualAlloc(reinterpret_cast<char*>(shared_memory_.memory()) +
- AlignToPageSize(sizeof(SharedState)) + offset,
- length, MEM_RESET_UNDO, PAGE_READWRITE)) {
- return PURGED;
- }
- }
#endif
return SUCCESS;
@@ -253,25 +240,12 @@
DCHECK(shared_memory_.memory());
-// Unpin pages if supported.
#if defined(OS_ANDROID)
SharedMemoryHandle handle = shared_memory_.handle();
if (SharedMemory::IsHandleValid(handle)) {
if (ashmem_unpin_region(
handle.fd, AlignToPageSize(sizeof(SharedState)) + offset, length)) {
DPLOG(ERROR) << "ashmem_unpin_region() failed";
- }
- }
-#elif defined(OS_WIN)
- if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
- // Note: MEM_RESET is not technically gated on Win8. However, this Unlock
- // function needs to match the Lock behaviour (MEM_RESET_UNDO) to properly
- // implement memory pinning. It needs to bias towards preserving the
- // contents of memory between an Unlock and next Lock.
- if (!VirtualAlloc(reinterpret_cast<char*>(shared_memory_.memory()) +
- AlignToPageSize(sizeof(SharedState)) + offset,
- length, MEM_RESET, PAGE_READWRITE)) {
- DPLOG(ERROR) << "VirtualAlloc() MEM_RESET failed in Unlock()";
}
}
#endif
@@ -349,12 +323,6 @@
return false;
}
-// The next section will release as much resource as can be done
-// from the purging process, until the client process notices the
-// purge and releases its own references.
-// Note: this memory will not be accessed again. The segment will be
-// freed asynchronously at a later time, so just do the best
-// immediately.
#if defined(OS_POSIX) && !defined(OS_NACL)
// Linux and Android provide MADV_REMOVE which is preferred as it has a
// behavior that can be verified in tests. Other POSIX flavors (MacOSX, BSDs),
@@ -372,14 +340,6 @@
AlignToPageSize(mapped_size_), MADV_PURGE_ARGUMENT)) {
DPLOG(ERROR) << "madvise() failed";
}
-#elif defined(OS_WIN)
- // MEM_DECOMMIT the purged pages to release the physical storage,
- // either in memory or in the paging file on disk. Pages remain RESERVED.
- if (!VirtualFree(reinterpret_cast<char*>(shared_memory_.memory()) +
- AlignToPageSize(sizeof(SharedState)),
- AlignToPageSize(mapped_size_), MEM_DECOMMIT)) {
- DPLOG(ERROR) << "VirtualFree() MEM_DECOMMIT failed in Purge()";
- }
#endif
last_known_usage_ = Time();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698