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

Side by Side Diff: services/resource_coordinator/public/cpp/memory/memory_instrumentation_struct_traits.h

Issue 2819413002: [memory-infra] Remove MemoryDumpManagerDelegate (Closed)
Patch Set: rebase. Created 3 years, 8 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_INSTRUMENTATION_S TRUCT_TRAITS_H_ 5 #ifndef SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_INSTRUMENTATION_S TRUCT_TRAITS_H_
6 #define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_INSTRUMENTATION_S TRUCT_TRAITS_H_ 6 #define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_INSTRUMENTATION_S TRUCT_TRAITS_H_
7 7
8 #include "base/process/process_handle.h" 8 #include "base/process/process_handle.h"
9 #include "base/trace_event/memory_dump_request_args.h" 9 #include "base/trace_event/memory_dump_request_args.h"
10 #include "mojo/common/common_custom_types_struct_traits.h" 10 #include "mojo/common/common_custom_types_struct_traits.h"
11 #include "services/resource_coordinator/public/cpp/memory/memory_export.h"
11 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume ntation.mojom.h" 12 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume ntation.mojom.h"
12 13
13 namespace mojo { 14 namespace mojo {
14 15
15 template <> 16 template <>
16 struct EnumTraits<memory_instrumentation::mojom::DumpType, 17 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT
17 base::trace_event::MemoryDumpType> { 18 EnumTraits<memory_instrumentation::mojom::DumpType,
19 base::trace_event::MemoryDumpType> {
18 static memory_instrumentation::mojom::DumpType ToMojom( 20 static memory_instrumentation::mojom::DumpType ToMojom(
19 base::trace_event::MemoryDumpType type); 21 base::trace_event::MemoryDumpType type);
20 static bool FromMojom(memory_instrumentation::mojom::DumpType input, 22 static bool FromMojom(memory_instrumentation::mojom::DumpType input,
21 base::trace_event::MemoryDumpType* out); 23 base::trace_event::MemoryDumpType* out);
22 }; 24 };
23 25
24 template <> 26 template <>
25 struct EnumTraits<memory_instrumentation::mojom::LevelOfDetail, 27 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT
26 base::trace_event::MemoryDumpLevelOfDetail> { 28 EnumTraits<memory_instrumentation::mojom::LevelOfDetail,
29 base::trace_event::MemoryDumpLevelOfDetail> {
27 static memory_instrumentation::mojom::LevelOfDetail ToMojom( 30 static memory_instrumentation::mojom::LevelOfDetail ToMojom(
28 base::trace_event::MemoryDumpLevelOfDetail level_of_detail); 31 base::trace_event::MemoryDumpLevelOfDetail level_of_detail);
29 static bool FromMojom(memory_instrumentation::mojom::LevelOfDetail input, 32 static bool FromMojom(memory_instrumentation::mojom::LevelOfDetail input,
30 base::trace_event::MemoryDumpLevelOfDetail* out); 33 base::trace_event::MemoryDumpLevelOfDetail* out);
31 }; 34 };
32 35
33 template <> 36 template <>
34 struct StructTraits<memory_instrumentation::mojom::RequestArgsDataView, 37 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT
35 base::trace_event::MemoryDumpRequestArgs> { 38 StructTraits<memory_instrumentation::mojom::RequestArgsDataView,
39 base::trace_event::MemoryDumpRequestArgs> {
36 static uint64_t dump_guid( 40 static uint64_t dump_guid(
37 const base::trace_event::MemoryDumpRequestArgs& args) { 41 const base::trace_event::MemoryDumpRequestArgs& args) {
38 return args.dump_guid; 42 return args.dump_guid;
39 } 43 }
40 static base::trace_event::MemoryDumpType dump_type( 44 static base::trace_event::MemoryDumpType dump_type(
41 const base::trace_event::MemoryDumpRequestArgs& args) { 45 const base::trace_event::MemoryDumpRequestArgs& args) {
42 return args.dump_type; 46 return args.dump_type;
43 } 47 }
44 static base::trace_event::MemoryDumpLevelOfDetail level_of_detail( 48 static base::trace_event::MemoryDumpLevelOfDetail level_of_detail(
45 const base::trace_event::MemoryDumpRequestArgs& args) { 49 const base::trace_event::MemoryDumpRequestArgs& args) {
46 return args.level_of_detail; 50 return args.level_of_detail;
47 } 51 }
48 static bool Read(memory_instrumentation::mojom::RequestArgsDataView input, 52 static bool Read(memory_instrumentation::mojom::RequestArgsDataView input,
49 base::trace_event::MemoryDumpRequestArgs* out); 53 base::trace_event::MemoryDumpRequestArgs* out);
50 }; 54 };
51 55
52 template <> 56 template <>
53 struct StructTraits< 57 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT
54 memory_instrumentation::mojom::ChromeMemDumpDataView, 58 StructTraits<memory_instrumentation::mojom::ChromeMemDumpDataView,
55 base::trace_event::MemoryDumpCallbackResult::ChromeMemDump> { 59 base::trace_event::MemoryDumpCallbackResult::ChromeMemDump> {
56 static uint32_t malloc_total_kb( 60 static uint32_t malloc_total_kb(
57 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) { 61 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) {
58 return args.malloc_total_kb; 62 return args.malloc_total_kb;
59 } 63 }
60 static uint32_t partition_alloc_total_kb( 64 static uint32_t partition_alloc_total_kb(
61 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) { 65 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) {
62 return args.partition_alloc_total_kb; 66 return args.partition_alloc_total_kb;
63 } 67 }
64 static uint32_t blink_gc_total_kb( 68 static uint32_t blink_gc_total_kb(
65 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) { 69 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) {
66 return args.blink_gc_total_kb; 70 return args.blink_gc_total_kb;
67 } 71 }
68 static uint32_t v8_total_kb( 72 static uint32_t v8_total_kb(
69 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) { 73 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) {
70 return args.v8_total_kb; 74 return args.v8_total_kb;
71 } 75 }
72 static bool Read( 76 static bool Read(
73 memory_instrumentation::mojom::ChromeMemDumpDataView input, 77 memory_instrumentation::mojom::ChromeMemDumpDataView input,
74 base::trace_event::MemoryDumpCallbackResult::ChromeMemDump* out); 78 base::trace_event::MemoryDumpCallbackResult::ChromeMemDump* out);
75 }; 79 };
76 80
77 template <> 81 template <>
78 struct StructTraits<memory_instrumentation::mojom::OSMemDumpDataView, 82 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT
79 base::trace_event::MemoryDumpCallbackResult::OSMemDump> { 83 StructTraits<memory_instrumentation::mojom::OSMemDumpDataView,
84 base::trace_event::MemoryDumpCallbackResult::OSMemDump> {
80 static uint32_t resident_set_kb( 85 static uint32_t resident_set_kb(
81 const base::trace_event::MemoryDumpCallbackResult::OSMemDump& args) { 86 const base::trace_event::MemoryDumpCallbackResult::OSMemDump& args) {
82 return args.resident_set_kb; 87 return args.resident_set_kb;
83 } 88 }
84 static bool Read(memory_instrumentation::mojom::OSMemDumpDataView input, 89 static bool Read(memory_instrumentation::mojom::OSMemDumpDataView input,
85 base::trace_event::MemoryDumpCallbackResult::OSMemDump* out); 90 base::trace_event::MemoryDumpCallbackResult::OSMemDump* out);
86 }; 91 };
87 92
88 template <> 93 template <>
89 struct StructTraits< 94 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT StructTraits<
90 memory_instrumentation::mojom::MemoryDumpCallbackResultDataView, 95 memory_instrumentation::mojom::MemoryDumpCallbackResultDataView,
91 base::trace_event::MemoryDumpCallbackResult> { 96 base::trace_event::MemoryDumpCallbackResult> {
92 static base::trace_event::MemoryDumpCallbackResult::OSMemDump os_dump( 97 static base::trace_event::MemoryDumpCallbackResult::OSMemDump os_dump(
93 const base::trace_event::MemoryDumpCallbackResult& args) { 98 const base::trace_event::MemoryDumpCallbackResult& args) {
94 return args.os_dump; 99 return args.os_dump;
95 } 100 }
96 static base::trace_event::MemoryDumpCallbackResult::ChromeMemDump chrome_dump( 101 static base::trace_event::MemoryDumpCallbackResult::ChromeMemDump chrome_dump(
97 const base::trace_event::MemoryDumpCallbackResult& args) { 102 const base::trace_event::MemoryDumpCallbackResult& args) {
98 return args.chrome_dump; 103 return args.chrome_dump;
99 } 104 }
100 static const std::map<base::ProcessId, 105 static const std::map<base::ProcessId,
101 base::trace_event::MemoryDumpCallbackResult::OSMemDump>& 106 base::trace_event::MemoryDumpCallbackResult::OSMemDump>&
102 extra_processes_dump( 107 extra_processes_dump(
103 const base::trace_event::MemoryDumpCallbackResult& args) { 108 const base::trace_event::MemoryDumpCallbackResult& args) {
104 return args.extra_processes_dump; 109 return args.extra_processes_dump;
105 } 110 }
106 static bool Read( 111 static bool Read(
107 memory_instrumentation::mojom::MemoryDumpCallbackResultDataView input, 112 memory_instrumentation::mojom::MemoryDumpCallbackResultDataView input,
108 base::trace_event::MemoryDumpCallbackResult* out); 113 base::trace_event::MemoryDumpCallbackResult* out);
109 }; 114 };
110 115
111 } // namespace mojo 116 } // namespace mojo
112 117
113 #endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_INSTRUMENTATIO N_STRUCT_TRAITS_H_ 118 #endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_INSTRUMENTATIO N_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698