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

Unified Diff: base/memory/discardable_memory_manager.cc

Issue 195863005: Use DiscardableMemoryManager on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix base.gypi Created 6 years, 8 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_memory_manager.cc
diff --git a/base/memory/discardable_memory_manager.cc b/base/memory/discardable_memory_manager.cc
index 1dff3e4da0ec396a8393de9d1607ad49dd04241c..31f9b451cef16b5516495eaab8ba7008626ea637 100644
--- a/base/memory/discardable_memory_manager.cc
+++ b/base/memory/discardable_memory_manager.cc
@@ -84,7 +84,16 @@ void DiscardableMemoryManager::Unregister(Allocation* allocation) {
DCHECK_LE(bytes_purgable, bytes_allocated_);
bytes_allocated_ -= bytes_purgable;
BytesAllocatedChanged();
+ } else {
+ // Note that Purge() which is called below requires the Allocation instance
+ // to be unlocked.
+ allocation->ReleaseLock();
reveman 2014/04/26 00:13:37 It's currently up to the client to call Discardabl
}
+
+ // Purge the allocation here while the mutex is acquired to let the underlying
+ // Allocation instance not have to deal with synchronization on its own.
+ allocation->Purge();
reveman 2014/04/26 00:13:37 I don't think we should do this here. I prefer to
+
allocations_.Erase(it);
}

Powered by Google App Engine
This is Rietveld 408576698