OLD | NEW |
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 "base/trace_event/winheap_dump_provider_win.h" | 5 #include "base/trace_event/winheap_dump_provider_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/debug/profiler.h" | 9 #include "base/debug/profiler.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 heap_info.block_count); | 40 heap_info.block_count); |
41 } | 41 } |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 WinHeapDumpProvider* WinHeapDumpProvider::GetInstance() { | 45 WinHeapDumpProvider* WinHeapDumpProvider::GetInstance() { |
46 return Singleton<WinHeapDumpProvider, | 46 return Singleton<WinHeapDumpProvider, |
47 LeakySingletonTraits<WinHeapDumpProvider>>::get(); | 47 LeakySingletonTraits<WinHeapDumpProvider>>::get(); |
48 } | 48 } |
49 | 49 |
50 bool WinHeapDumpProvider::OnMemoryDump(ProcessMemoryDump* pmd) { | 50 bool WinHeapDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, |
| 51 ProcessMemoryDump* pmd) { |
51 // This method might be flaky for 2 reasons: | 52 // This method might be flaky for 2 reasons: |
52 // - GetProcessHeaps is racy by design. It returns a snapshot of the | 53 // - GetProcessHeaps is racy by design. It returns a snapshot of the |
53 // available heaps, but there's no guarantee that that snapshot remains | 54 // available heaps, but there's no guarantee that that snapshot remains |
54 // valid. If a heap disappears between GetProcessHeaps() and HeapWalk() | 55 // valid. If a heap disappears between GetProcessHeaps() and HeapWalk() |
55 // then chaos should be assumed. This flakyness is acceptable for tracing. | 56 // then chaos should be assumed. This flakyness is acceptable for tracing. |
56 // - The MSDN page for HeapLock says: "If the HeapLock function is called on | 57 // - The MSDN page for HeapLock says: "If the HeapLock function is called on |
57 // a heap created with the HEAP_NO_SERIALIZATION flag, the results are | 58 // a heap created with the HEAP_NO_SERIALIZATION flag, the results are |
58 // undefined.". This is a problem on Windows XP where some system DLLs are | 59 // undefined.". This is a problem on Windows XP where some system DLLs are |
59 // known for creating heaps with this particular flag. For this reason | 60 // known for creating heaps with this particular flag. For this reason |
60 // this function should be disabled on XP. | 61 // this function should be disabled on XP. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } else if ((heap_entry.wFlags & PROCESS_HEAP_REGION) != 0) { | 120 } else if ((heap_entry.wFlags & PROCESS_HEAP_REGION) != 0) { |
120 heap_info->committed_size += heap_entry.Region.dwCommittedSize; | 121 heap_info->committed_size += heap_entry.Region.dwCommittedSize; |
121 } | 122 } |
122 } | 123 } |
123 CHECK(::HeapUnlock(heap_info->heap_id) == TRUE); | 124 CHECK(::HeapUnlock(heap_info->heap_id) == TRUE); |
124 return true; | 125 return true; |
125 } | 126 } |
126 | 127 |
127 } // namespace trace_event | 128 } // namespace trace_event |
128 } // namespace base | 129 } // namespace base |
OLD | NEW |