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 #ifndef SKIA_EXT_SK_TRACE_MEMORY_DUMP_CHROME_H_ | 5 #ifndef SKIA_EXT_SK_TRACE_MEMORY_DUMP_CHROME_H_ |
6 #define SKIA_EXT_SK_TRACE_MEMORY_DUMP_CHROME_H_ | 6 #define SKIA_EXT_SK_TRACE_MEMORY_DUMP_CHROME_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/trace_event/memory_dump_provider.h" | |
11 #include "third_party/skia/include/core/SkTraceMemoryDump.h" | 12 #include "third_party/skia/include/core/SkTraceMemoryDump.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 namespace trace_event { | 15 namespace trace_event { |
15 class MemoryAllocatorDump; | 16 class MemoryAllocatorDump; |
16 class ProcessMemoryDump; | |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
20 namespace skia { | 20 namespace skia { |
21 | 21 |
22 class SkTraceMemoryDump_Chrome : public SkTraceMemoryDump { | 22 class SkTraceMemoryDump_Chrome : public SkTraceMemoryDump { |
23 public: | 23 public: |
24 // This should never outlive the OnMemoryDump call since the | 24 // This should never outlive the OnMemoryDump call since the |
25 // ProcessMemoryDump is valid only in that timeframe. Optional | 25 // ProcessMemoryDump is valid only in that timeframe. Optional |
26 // |dump_name_prefix| argument specifies the prefix appended to the dump | 26 // |dump_name_prefix| argument specifies the prefix appended to the dump |
27 // name skia provides. By default it is taken as empty string. | 27 // name skia provides. By default it is taken as empty string. |
28 SkTraceMemoryDump_Chrome( | 28 SkTraceMemoryDump_Chrome( |
29 const base::trace_event::MemoryDumpArgs& args, | |
Primiano Tucci (use gerrit)
2015/09/09 17:27:23
why don't you pass just the "LevelOfDetail" enum h
| |
29 base::trace_event::ProcessMemoryDump* process_memory_dump); | 30 base::trace_event::ProcessMemoryDump* process_memory_dump); |
30 | 31 |
31 SkTraceMemoryDump_Chrome( | 32 SkTraceMemoryDump_Chrome( |
32 const char* dump_name_prefix, | 33 const char* dump_name_prefix, |
34 const base::trace_event::MemoryDumpArgs& args, | |
33 base::trace_event::ProcessMemoryDump* process_memory_dump); | 35 base::trace_event::ProcessMemoryDump* process_memory_dump); |
34 | 36 |
35 ~SkTraceMemoryDump_Chrome() override; | 37 ~SkTraceMemoryDump_Chrome() override; |
36 | 38 |
37 // SkTraceMemoryDump implementation: | 39 // SkTraceMemoryDump implementation: |
38 void dumpNumericValue(const char* dumpName, | 40 void dumpNumericValue(const char* dumpName, |
39 const char* valueName, | 41 const char* valueName, |
40 const char* units, | 42 const char* units, |
41 uint64_t value) override; | 43 uint64_t value) override; |
42 void setMemoryBacking(const char* dumpName, | 44 void setMemoryBacking(const char* dumpName, |
43 const char* backingType, | 45 const char* backingType, |
44 const char* backingObjectId) override; | 46 const char* backingObjectId) override; |
45 void setDiscardableMemoryBacking( | 47 void setDiscardableMemoryBacking( |
46 const char* dumpName, | 48 const char* dumpName, |
47 const SkDiscardableMemory& discardableMemoryObject) override; | 49 const SkDiscardableMemory& discardableMemoryObject) override; |
50 bool isLightDump() const override; | |
48 | 51 |
49 protected: | 52 protected: |
50 base::trace_event::ProcessMemoryDump* process_memory_dump() { | 53 base::trace_event::ProcessMemoryDump* process_memory_dump() { |
51 return process_memory_dump_; | 54 return process_memory_dump_; |
52 } | 55 } |
53 | 56 |
54 private: | 57 private: |
55 std::string dump_name_prefix_; | 58 std::string dump_name_prefix_; |
56 | 59 |
57 base::trace_event::ProcessMemoryDump* process_memory_dump_; | 60 base::trace_event::ProcessMemoryDump* process_memory_dump_; |
61 bool is_light_dump_; | |
58 | 62 |
59 // Helper to create allocator dumps. | 63 // Helper to create allocator dumps. |
60 base::trace_event::MemoryAllocatorDump* GetOrCreateAllocatorDump( | 64 base::trace_event::MemoryAllocatorDump* GetOrCreateAllocatorDump( |
61 const char* dumpName); | 65 const char* dumpName); |
62 | 66 |
63 DISALLOW_COPY_AND_ASSIGN(SkTraceMemoryDump_Chrome); | 67 DISALLOW_COPY_AND_ASSIGN(SkTraceMemoryDump_Chrome); |
64 }; | 68 }; |
65 | 69 |
66 } // namespace skia | 70 } // namespace skia |
67 | 71 |
68 #endif // SKIA_EXT_SK_TRACE_MEMORY_DUMP_CHROME_H_ | 72 #endif // SKIA_EXT_SK_TRACE_MEMORY_DUMP_CHROME_H_ |
OLD | NEW |