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

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: Fixes. Created 4 years, 6 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // TODO(bashi): Change type name of |absoluteName|. 108 // TODO(bashi): Change type name of |absoluteName|.
109 return m_currentProcessMemoryDump->CreateAllocatorDump(absoluteName.utf8().d ata()); 109 return m_currentProcessMemoryDump->CreateAllocatorDump(absoluteName.utf8().d ata());
110 } 110 }
111 111
112 void BlinkGCMemoryDumpProvider::clearProcessDumpForCurrentGC() 112 void BlinkGCMemoryDumpProvider::clearProcessDumpForCurrentGC()
113 { 113 {
114 m_currentProcessMemoryDump->Clear(); 114 m_currentProcessMemoryDump->Clear();
115 } 115 }
116 116
117 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() 117 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider()
118 : m_currentProcessMemoryDump(new base::trace_event::ProcessMemoryDump(nullpt r)) 118 : m_currentProcessMemoryDump(new base::trace_event::ProcessMemoryDump(nullpt r, { base::trace_event::MemoryDumpLevelOfDetail::DETAILED }))
Primiano Tucci (use gerrit) 2016/06/02 20:24:04 OH I wonder if for consistency you should reset m_
ssid 2016/06/03 01:59:47 This dump is added to trace when detailed dump and
119 , m_isHeapProfilingEnabled(false) 119 , m_isHeapProfilingEnabled(false)
120 { 120 {
121 } 121 }
122 122
123 void BlinkGCMemoryDumpProvider::insert(Address address, size_t size, const char* typeName) 123 void BlinkGCMemoryDumpProvider::insert(Address address, size_t size, const char* typeName)
124 { 124 {
125 base::trace_event::AllocationContext context = base::trace_event::Allocation ContextTracker::GetInstanceForCurrentThread()->GetContextSnapshot(); 125 base::trace_event::AllocationContext context = base::trace_event::Allocation ContextTracker::GetInstanceForCurrentThread()->GetContextSnapshot();
126 context.type_name = typeName; 126 context.type_name = typeName;
127 MutexLocker locker(m_allocationRegisterMutex); 127 MutexLocker locker(m_allocationRegisterMutex);
128 if (m_allocationRegister) 128 if (m_allocationRegister)
129 m_allocationRegister->Insert(address, size, context); 129 m_allocationRegister->Insert(address, size, context);
130 } 130 }
131 131
132 void BlinkGCMemoryDumpProvider::remove(Address address) 132 void BlinkGCMemoryDumpProvider::remove(Address address)
133 { 133 {
134 MutexLocker locker(m_allocationRegisterMutex); 134 MutexLocker locker(m_allocationRegisterMutex);
135 if (m_allocationRegister) 135 if (m_allocationRegister)
136 m_allocationRegister->Remove(address); 136 m_allocationRegister->Remove(address);
137 } 137 }
138 138
139 } // namespace blink 139 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698