Roll src/third_party/WebKit dbf9be3:8d6c3d5 (svn 202308:202312)
[chromium-blink-merge.git] / base / trace_event / winheap_dump_provider_win.h
blobe3653550d442799df9b1a650ba4113ba87f631fd
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
3 // found in the LICENSE file.
5 #ifndef BASE_TRACE_EVENT_WINHEAP_DUMP_PROVIDER_WIN_H_
6 #define BASE_TRACE_EVENT_WINHEAP_DUMP_PROVIDER_WIN_H_
8 #include <set>
10 #include "base/memory/singleton.h"
11 #include "base/trace_event/memory_dump_provider.h"
13 namespace base {
14 namespace trace_event {
16 // A structure containing some information about a given heap.
17 struct WinHeapInfo {
18 HANDLE heap_id;
19 size_t committed_size;
20 size_t allocated_size;
21 size_t block_count;
24 // Dump provider which collects process-wide heap memory stats. This provider
25 // iterates over all the heaps of the current process to gather some metrics
26 // about them.
27 class BASE_EXPORT WinHeapDumpProvider : public MemoryDumpProvider {
28 public:
29 // Name of the allocated_objects dump. Use this to declare suballocator dumps
30 // from other dump providers.
31 static const char kAllocatedObjects[];
33 static WinHeapDumpProvider* GetInstance();
35 // MemoryDumpProvider implementation.
36 bool OnMemoryDump(const MemoryDumpArgs& args,
37 ProcessMemoryDump* pmd) override;
39 private:
40 friend struct DefaultSingletonTraits<WinHeapDumpProvider>;
42 // Retrieves the information about given heap. The |heap_info| should contain
43 // a valid handle to an existing heap. The blocks contained in the
44 // |block_to_skip| set will be ignored.
45 bool GetHeapInformation(WinHeapInfo* heap_info,
46 const std::set<void*>& block_to_skip);
48 WinHeapDumpProvider() {}
49 ~WinHeapDumpProvider() override {}
51 DISALLOW_COPY_AND_ASSIGN(WinHeapDumpProvider);
54 } // namespace trace_event
55 } // namespace base
57 #endif // BASE_TRACE_EVENT_WINHEAP_DUMP_PROVIDER_WIN_H_