Chromium Code Reviews| 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); |
| } |