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

Side by Side Diff: base/trace_event/winheap_dump_provider_win.cc

Issue 2053953002: Add chrome_crash_reporter_client_win.cc to the source file list for chrome_elf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments 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 "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"
11 #include "base/trace_event/process_memory_dump.h" 11 #include "base/trace_event/process_memory_dump.h"
12 #include "base/win/windows_version.h"
13 12
14 namespace base { 13 namespace base {
15 namespace trace_event { 14 namespace trace_event {
16 15
17 #define DUMP_ROOT_NAME "winheap" 16 #define DUMP_ROOT_NAME "winheap"
18 // static 17 // static
19 const char WinHeapDumpProvider::kAllocatedObjects[] = 18 const char WinHeapDumpProvider::kAllocatedObjects[] =
20 DUMP_ROOT_NAME "/allocated_objects"; 19 DUMP_ROOT_NAME "/allocated_objects";
21 20
22 namespace { 21 namespace {
(...skipping 26 matching lines...) Expand all
49 48
50 bool WinHeapDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, 49 bool WinHeapDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
51 ProcessMemoryDump* pmd) { 50 ProcessMemoryDump* pmd) {
52 // This method might be flaky for 2 reasons: 51 // This method might be flaky for 2 reasons:
53 // - GetProcessHeaps is racy by design. It returns a snapshot of the 52 // - GetProcessHeaps is racy by design. It returns a snapshot of the
54 // available heaps, but there's no guarantee that that snapshot remains 53 // available heaps, but there's no guarantee that that snapshot remains
55 // valid. If a heap disappears between GetProcessHeaps() and HeapWalk() 54 // valid. If a heap disappears between GetProcessHeaps() and HeapWalk()
56 // then chaos should be assumed. This flakyness is acceptable for tracing. 55 // then chaos should be assumed. This flakyness is acceptable for tracing.
57 // - The MSDN page for HeapLock says: "If the HeapLock function is called on 56 // - The MSDN page for HeapLock says: "If the HeapLock function is called on
58 // a heap created with the HEAP_NO_SERIALIZATION flag, the results are 57 // a heap created with the HEAP_NO_SERIALIZATION flag, the results are
59 // undefined.". This is a problem on Windows XP where some system DLLs are 58 // undefined.". This is a problem on Windows XP where some system DLLs are
Lei Zhang 2016/06/15 22:50:45 Since we are removing pre-Win7 bits, can this go a
ananta 2016/06/15 23:09:53 Thanks. Done
60 // known for creating heaps with this particular flag. For this reason 59 // known for creating heaps with this particular flag. For this reason
61 // this function should be disabled on XP. 60 // this function should be disabled on XP.
62 // 61 //
63 // See https://crbug.com/487291 for more details about this.
64 if (base::win::GetVersion() < base::win::VERSION_VISTA)
65 return false;
66 62
67 // Disable this dump provider for the SyzyASan instrumented build 63 // Disable this dump provider for the SyzyASan instrumented build
68 // because they don't support the heap walking functions yet. 64 // because they don't support the heap walking functions yet.
69 #if defined(SYZYASAN) 65 #if defined(SYZYASAN)
70 if (base::debug::IsBinaryInstrumented()) 66 if (base::debug::IsBinaryInstrumented())
71 return false; 67 return false;
72 #endif 68 #endif
73 69
74 // Retrieves the number of heaps in the current process. 70 // Retrieves the number of heaps in the current process.
75 DWORD number_of_heaps = ::GetProcessHeaps(0, NULL); 71 DWORD number_of_heaps = ::GetProcessHeaps(0, NULL);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } else if ((heap_entry.wFlags & PROCESS_HEAP_REGION) != 0) { 116 } else if ((heap_entry.wFlags & PROCESS_HEAP_REGION) != 0) {
121 heap_info->committed_size += heap_entry.Region.dwCommittedSize; 117 heap_info->committed_size += heap_entry.Region.dwCommittedSize;
122 } 118 }
123 } 119 }
124 CHECK(::HeapUnlock(heap_info->heap_id) == TRUE); 120 CHECK(::HeapUnlock(heap_info->heap_id) == TRUE);
125 return true; 121 return true;
126 } 122 }
127 123
128 } // namespace trace_event 124 } // namespace trace_event
129 } // namespace base 125 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698