| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/child/child_discardable_shared_memory_manager.h" | 5 #include "content/child/child_discardable_shared_memory_manager.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
| 10 #include "base/memory/discardable_memory.h" | 10 #include "base/memory/discardable_memory.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 heap_.MergeIntoFreeLists(leftover.Pass()); | 185 heap_.MergeIntoFreeLists(leftover.Pass()); |
| 186 } | 186 } |
| 187 | 187 |
| 188 MemoryUsageChanged(heap_.GetSize(), heap_.GetSizeOfFreeLists()); | 188 MemoryUsageChanged(heap_.GetSize(), heap_.GetSizeOfFreeLists()); |
| 189 | 189 |
| 190 return make_scoped_ptr(new DiscardableMemoryImpl(this, new_span.Pass())); | 190 return make_scoped_ptr(new DiscardableMemoryImpl(this, new_span.Pass())); |
| 191 } | 191 } |
| 192 | 192 |
| 193 bool ChildDiscardableSharedMemoryManager::OnMemoryDump( | 193 bool ChildDiscardableSharedMemoryManager::OnMemoryDump( |
| 194 base::trace_event::ProcessMemoryDump* pmd) { | 194 base::trace_event::ProcessMemoryDump* pmd) { |
| 195 DiscardableMemoryAllocator::CreateMemoryPoolDumpForTracing(pmd); |
| 196 |
| 195 base::AutoLock lock(lock_); | 197 base::AutoLock lock(lock_); |
| 196 return heap_.OnMemoryDump(pmd); | 198 return heap_.OnMemoryDump(pmd); |
| 197 } | 199 } |
| 198 | 200 |
| 199 void ChildDiscardableSharedMemoryManager::ReleaseFreeMemory() { | 201 void ChildDiscardableSharedMemoryManager::ReleaseFreeMemory() { |
| 200 base::AutoLock lock(lock_); | 202 base::AutoLock lock(lock_); |
| 201 | 203 |
| 202 size_t heap_size_prior_to_releasing_memory = heap_.GetSize(); | 204 size_t heap_size_prior_to_releasing_memory = heap_.GetSize(); |
| 203 | 205 |
| 204 // Release both purged and free memory. | 206 // Release both purged and free memory. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 "discardable-memory-allocated"; | 292 "discardable-memory-allocated"; |
| 291 base::debug::SetCrashKeyValue(kDiscardableMemoryAllocatedKey, | 293 base::debug::SetCrashKeyValue(kDiscardableMemoryAllocatedKey, |
| 292 base::Uint64ToString(new_bytes_total)); | 294 base::Uint64ToString(new_bytes_total)); |
| 293 | 295 |
| 294 static const char kDiscardableMemoryFreeKey[] = "discardable-memory-free"; | 296 static const char kDiscardableMemoryFreeKey[] = "discardable-memory-free"; |
| 295 base::debug::SetCrashKeyValue(kDiscardableMemoryFreeKey, | 297 base::debug::SetCrashKeyValue(kDiscardableMemoryFreeKey, |
| 296 base::Uint64ToString(new_bytes_free)); | 298 base::Uint64ToString(new_bytes_free)); |
| 297 } | 299 } |
| 298 | 300 |
| 299 } // namespace content | 301 } // namespace content |
| OLD | NEW |