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

Unified Diff: content/common/host_discardable_shared_memory_manager.cc

Issue 1057493005: Revert of base: Replace PurgeAndTruncate with Shrink function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « base/memory/discardable_shared_memory_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/host_discardable_shared_memory_manager.cc
diff --git a/content/common/host_discardable_shared_memory_manager.cc b/content/common/host_discardable_shared_memory_manager.cc
index 4c5c220f6006585511278238fc2a3b6650e94102..49c24f812424dac4e3c16efe9eda29d1355126a2 100644
--- a/content/common/host_discardable_shared_memory_manager.cc
+++ b/content/common/host_discardable_shared_memory_manager.cc
@@ -359,8 +359,12 @@
scoped_refptr<MemorySegment> segment = segments_.back();
segments_.pop_back();
- // Attempt to purge LRU segment. When successful, released the memory.
- if (segment->memory()->Purge(current_time)) {
+ // Attempt to purge and truncate LRU segment. When successful, as much
+ // memory as possible will be released to the OS. How much memory is
+ // released depends on the platform. The child process should perform
+ // periodic cleanup to ensure that all memory is release within a
+ // reasonable amount of time.
+ if (segment->memory()->PurgeAndTruncate(current_time)) {
ReleaseMemory(segment->memory());
continue;
}
@@ -382,11 +386,6 @@
size_t size = memory->mapped_size();
DCHECK_GE(bytes_allocated_, size);
bytes_allocated_ -= size;
-
-#if defined(DISCARDABLE_SHARED_MEMORY_SHRINKING)
- // Shrink memory segment. This will immediately release the memory to the OS.
- memory->Shrink();
-#endif
// This will unmap the memory segment and drop our reference. The result
// is that the memory will be released to the OS if the child process is
« no previous file with comments | « base/memory/discardable_shared_memory_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698