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

Side by Side Diff: third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp

Issue 2006943003: [tracing] Sanitize process memory dumps for background mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@whitelist_mdp
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "platform/heap/BlinkGCMemoryDumpProvider.h" 5 #include "platform/heap/BlinkGCMemoryDumpProvider.h"
6 6
7 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" 7 #include "base/trace_event/heap_profiler_allocation_context_tracker.h"
8 #include "base/trace_event/heap_profiler_allocation_register.h" 8 #include "base/trace_event/heap_profiler_allocation_register.h"
9 #include "base/trace_event/memory_allocator_dump.h" 9 #include "base/trace_event/memory_allocator_dump.h"
10 #include "base/trace_event/process_memory_dump.h" 10 #include "base/trace_event/process_memory_dump.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // TODO(bashi): Change type name of |absoluteName|. 109 // TODO(bashi): Change type name of |absoluteName|.
110 return m_currentProcessMemoryDump->CreateAllocatorDump(absoluteName.utf8().d ata()); 110 return m_currentProcessMemoryDump->CreateAllocatorDump(absoluteName.utf8().d ata());
111 } 111 }
112 112
113 void BlinkGCMemoryDumpProvider::clearProcessDumpForCurrentGC() 113 void BlinkGCMemoryDumpProvider::clearProcessDumpForCurrentGC()
114 { 114 {
115 m_currentProcessMemoryDump->Clear(); 115 m_currentProcessMemoryDump->Clear();
116 } 116 }
117 117
118 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() 118 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider()
119 : m_currentProcessMemoryDump(new base::trace_event::ProcessMemoryDump(nullpt r)) 119 : m_currentProcessMemoryDump(new base::trace_event::ProcessMemoryDump(nullpt r, base::trace_event::MemoryDumpLevelOfDetail::DETAILED))
120 , m_isHeapProfilingEnabled(false) 120 , m_isHeapProfilingEnabled(false)
121 { 121 {
122 } 122 }
123 123
124 void BlinkGCMemoryDumpProvider::insert(Address address, size_t size, const char* typeName) 124 void BlinkGCMemoryDumpProvider::insert(Address address, size_t size, const char* typeName)
125 { 125 {
126 base::trace_event::AllocationContext context = base::trace_event::Allocation ContextTracker::GetInstanceForCurrentThread()->GetContextSnapshot(); 126 base::trace_event::AllocationContext context = base::trace_event::Allocation ContextTracker::GetInstanceForCurrentThread()->GetContextSnapshot();
127 context.type_name = typeName; 127 context.type_name = typeName;
128 MutexLocker locker(m_allocationRegisterMutex); 128 MutexLocker locker(m_allocationRegisterMutex);
129 if (m_allocationRegister) 129 if (m_allocationRegister)
130 m_allocationRegister->Insert(address, size, context); 130 m_allocationRegister->Insert(address, size, context);
131 } 131 }
132 132
133 void BlinkGCMemoryDumpProvider::remove(Address address) 133 void BlinkGCMemoryDumpProvider::remove(Address address)
134 { 134 {
135 MutexLocker locker(m_allocationRegisterMutex); 135 MutexLocker locker(m_allocationRegisterMutex);
136 if (m_allocationRegister) 136 if (m_allocationRegister)
137 m_allocationRegister->Remove(address); 137 m_allocationRegister->Remove(address);
138 } 138 }
139 139
140 } // namespace blink 140 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698