| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 leftover->length() * base::GetPageSize()); | 184 leftover->length() * base::GetPageSize()); |
| 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 const base::trace_event::MemoryDumpArgs& args, |
| 194 base::trace_event::ProcessMemoryDump* pmd) { | 195 base::trace_event::ProcessMemoryDump* pmd) { |
| 195 base::AutoLock lock(lock_); | 196 base::AutoLock lock(lock_); |
| 196 return heap_.OnMemoryDump(pmd); | 197 return heap_.OnMemoryDump(pmd); |
| 197 } | 198 } |
| 198 | 199 |
| 199 void ChildDiscardableSharedMemoryManager::ReleaseFreeMemory() { | 200 void ChildDiscardableSharedMemoryManager::ReleaseFreeMemory() { |
| 200 base::AutoLock lock(lock_); | 201 base::AutoLock lock(lock_); |
| 201 | 202 |
| 202 size_t heap_size_prior_to_releasing_memory = heap_.GetSize(); | 203 size_t heap_size_prior_to_releasing_memory = heap_.GetSize(); |
| 203 | 204 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 "discardable-memory-allocated"; | 291 "discardable-memory-allocated"; |
| 291 base::debug::SetCrashKeyValue(kDiscardableMemoryAllocatedKey, | 292 base::debug::SetCrashKeyValue(kDiscardableMemoryAllocatedKey, |
| 292 base::Uint64ToString(new_bytes_total)); | 293 base::Uint64ToString(new_bytes_total)); |
| 293 | 294 |
| 294 static const char kDiscardableMemoryFreeKey[] = "discardable-memory-free"; | 295 static const char kDiscardableMemoryFreeKey[] = "discardable-memory-free"; |
| 295 base::debug::SetCrashKeyValue(kDiscardableMemoryFreeKey, | 296 base::debug::SetCrashKeyValue(kDiscardableMemoryFreeKey, |
| 296 base::Uint64ToString(new_bytes_free)); | 297 base::Uint64ToString(new_bytes_free)); |
| 297 } | 298 } |
| 298 | 299 |
| 299 } // namespace content | 300 } // namespace content |
| OLD | NEW |