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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 DiscardableSharedMemoryId id) { | 80 DiscardableSharedMemoryId id) { |
81 sender->Send(new ChildProcessHostMsg_DeletedDiscardableSharedMemory(id)); | 81 sender->Send(new ChildProcessHostMsg_DeletedDiscardableSharedMemory(id)); |
82 } | 82 } |
83 | 83 |
84 } // namespace | 84 } // namespace |
85 | 85 |
86 ChildDiscardableSharedMemoryManager::ChildDiscardableSharedMemoryManager( | 86 ChildDiscardableSharedMemoryManager::ChildDiscardableSharedMemoryManager( |
87 ThreadSafeSender* sender) | 87 ThreadSafeSender* sender) |
88 : heap_(base::GetPageSize()), sender_(sender) { | 88 : heap_(base::GetPageSize()), sender_(sender) { |
89 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 89 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
90 this, base::ThreadTaskRunnerHandle::Get()); | 90 this, "ChildDiscardableSharedMemoryManager", |
| 91 base::ThreadTaskRunnerHandle::Get()); |
91 } | 92 } |
92 | 93 |
93 ChildDiscardableSharedMemoryManager::~ChildDiscardableSharedMemoryManager() { | 94 ChildDiscardableSharedMemoryManager::~ChildDiscardableSharedMemoryManager() { |
94 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | 95 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( |
95 this); | 96 this); |
96 // TODO(reveman): Determine if this DCHECK can be enabled. crbug.com/430533 | 97 // TODO(reveman): Determine if this DCHECK can be enabled. crbug.com/430533 |
97 // DCHECK_EQ(heap_.GetSize(), heap_.GetSizeOfFreeLists()); | 98 // DCHECK_EQ(heap_.GetSize(), heap_.GetSizeOfFreeLists()); |
98 if (heap_.GetSize()) | 99 if (heap_.GetSize()) |
99 MemoryUsageChanged(0, 0); | 100 MemoryUsageChanged(0, 0); |
100 } | 101 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 "discardable-memory-allocated"; | 311 "discardable-memory-allocated"; |
311 base::debug::SetCrashKeyValue(kDiscardableMemoryAllocatedKey, | 312 base::debug::SetCrashKeyValue(kDiscardableMemoryAllocatedKey, |
312 base::Uint64ToString(new_bytes_total)); | 313 base::Uint64ToString(new_bytes_total)); |
313 | 314 |
314 static const char kDiscardableMemoryFreeKey[] = "discardable-memory-free"; | 315 static const char kDiscardableMemoryFreeKey[] = "discardable-memory-free"; |
315 base::debug::SetCrashKeyValue(kDiscardableMemoryFreeKey, | 316 base::debug::SetCrashKeyValue(kDiscardableMemoryFreeKey, |
316 base::Uint64ToString(new_bytes_free)); | 317 base::Uint64ToString(new_bytes_free)); |
317 } | 318 } |
318 | 319 |
319 } // namespace content | 320 } // namespace content |
OLD | NEW |