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

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

Issue 2083463003: Revert of 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: 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
« no previous file with comments | « base/threading/platform_thread_win.cc ('k') | chrome/app/chrome_crash_reporter_client_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
12 13
13 namespace base { 14 namespace base {
14 namespace trace_event { 15 namespace trace_event {
15 16
16 #define DUMP_ROOT_NAME "winheap" 17 #define DUMP_ROOT_NAME "winheap"
17 // static 18 // static
18 const char WinHeapDumpProvider::kAllocatedObjects[] = 19 const char WinHeapDumpProvider::kAllocatedObjects[] =
19 DUMP_ROOT_NAME "/allocated_objects"; 20 DUMP_ROOT_NAME "/allocated_objects";
20 21
21 namespace { 22 namespace {
(...skipping 26 matching lines...) Expand all
48 49
49 bool WinHeapDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, 50 bool WinHeapDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
50 ProcessMemoryDump* pmd) { 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." 59 // undefined.". This is a problem on Windows XP where some system DLLs are
60 // known for creating heaps with this particular flag. For this reason
61 // this function should be disabled on XP.
62 //
63 // See https://crbug.com/487291 for more details about this.
64 if (base::win::GetVersion() < base::win::VERSION_VISTA)
65 return false;
59 66
60 // Disable this dump provider for the SyzyASan instrumented build 67 // Disable this dump provider for the SyzyASan instrumented build
61 // because they don't support the heap walking functions yet. 68 // because they don't support the heap walking functions yet.
62 #if defined(SYZYASAN) 69 #if defined(SYZYASAN)
63 if (base::debug::IsBinaryInstrumented()) 70 if (base::debug::IsBinaryInstrumented())
64 return false; 71 return false;
65 #endif 72 #endif
66 73
67 // Retrieves the number of heaps in the current process. 74 // Retrieves the number of heaps in the current process.
68 DWORD number_of_heaps = ::GetProcessHeaps(0, NULL); 75 DWORD number_of_heaps = ::GetProcessHeaps(0, NULL);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } else if ((heap_entry.wFlags & PROCESS_HEAP_REGION) != 0) { 120 } else if ((heap_entry.wFlags & PROCESS_HEAP_REGION) != 0) {
114 heap_info->committed_size += heap_entry.Region.dwCommittedSize; 121 heap_info->committed_size += heap_entry.Region.dwCommittedSize;
115 } 122 }
116 } 123 }
117 CHECK(::HeapUnlock(heap_info->heap_id) == TRUE); 124 CHECK(::HeapUnlock(heap_info->heap_id) == TRUE);
118 return true; 125 return true;
119 } 126 }
120 127
121 } // namespace trace_event 128 } // namespace trace_event
122 } // namespace base 129 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/platform_thread_win.cc ('k') | chrome/app/chrome_crash_reporter_client_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698