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

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

Issue 2798713002: Global Resource Coordinator: Basic service internals (Closed)
Patch Set: Buildfix after rebase Created 3 years, 7 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 "base/trace_event/process_memory_totals.h" 10 #include "base/trace_event/process_memory_totals.h"
11 #include "mojo/common/common_custom_types_struct_traits.h" 11 #include "mojo/common/common_custom_types_struct_traits.h"
12 #include "services/resource_coordinator/public/cpp/memory/memory_export.h" 12 #include "services/resource_coordinator/public/cpp/resource_coordinator_export.h "
13 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume ntation.mojom.h" 13 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume ntation.mojom.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 16
17 template <> 17 template <>
18 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT 18 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_EXPORT
19 EnumTraits<memory_instrumentation::mojom::DumpType, 19 EnumTraits<memory_instrumentation::mojom::DumpType,
20 base::trace_event::MemoryDumpType> { 20 base::trace_event::MemoryDumpType> {
21 static memory_instrumentation::mojom::DumpType ToMojom( 21 static memory_instrumentation::mojom::DumpType ToMojom(
22 base::trace_event::MemoryDumpType type); 22 base::trace_event::MemoryDumpType type);
23 static bool FromMojom(memory_instrumentation::mojom::DumpType input, 23 static bool FromMojom(memory_instrumentation::mojom::DumpType input,
24 base::trace_event::MemoryDumpType* out); 24 base::trace_event::MemoryDumpType* out);
25 }; 25 };
26 26
27 template <> 27 template <>
28 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT 28 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_EXPORT
29 EnumTraits<memory_instrumentation::mojom::LevelOfDetail, 29 EnumTraits<memory_instrumentation::mojom::LevelOfDetail,
30 base::trace_event::MemoryDumpLevelOfDetail> { 30 base::trace_event::MemoryDumpLevelOfDetail> {
31 static memory_instrumentation::mojom::LevelOfDetail ToMojom( 31 static memory_instrumentation::mojom::LevelOfDetail ToMojom(
32 base::trace_event::MemoryDumpLevelOfDetail level_of_detail); 32 base::trace_event::MemoryDumpLevelOfDetail level_of_detail);
33 static bool FromMojom(memory_instrumentation::mojom::LevelOfDetail input, 33 static bool FromMojom(memory_instrumentation::mojom::LevelOfDetail input,
34 base::trace_event::MemoryDumpLevelOfDetail* out); 34 base::trace_event::MemoryDumpLevelOfDetail* out);
35 }; 35 };
36 36
37 template <> 37 template <>
38 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT 38 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_EXPORT
39 StructTraits<memory_instrumentation::mojom::RequestArgsDataView, 39 StructTraits<memory_instrumentation::mojom::RequestArgsDataView,
40 base::trace_event::MemoryDumpRequestArgs> { 40 base::trace_event::MemoryDumpRequestArgs> {
41 static uint64_t dump_guid( 41 static uint64_t dump_guid(
42 const base::trace_event::MemoryDumpRequestArgs& args) { 42 const base::trace_event::MemoryDumpRequestArgs& args) {
43 return args.dump_guid; 43 return args.dump_guid;
44 } 44 }
45 static base::trace_event::MemoryDumpType dump_type( 45 static base::trace_event::MemoryDumpType dump_type(
46 const base::trace_event::MemoryDumpRequestArgs& args) { 46 const base::trace_event::MemoryDumpRequestArgs& args) {
47 return args.dump_type; 47 return args.dump_type;
48 } 48 }
49 static base::trace_event::MemoryDumpLevelOfDetail level_of_detail( 49 static base::trace_event::MemoryDumpLevelOfDetail level_of_detail(
50 const base::trace_event::MemoryDumpRequestArgs& args) { 50 const base::trace_event::MemoryDumpRequestArgs& args) {
51 return args.level_of_detail; 51 return args.level_of_detail;
52 } 52 }
53 static bool Read(memory_instrumentation::mojom::RequestArgsDataView input, 53 static bool Read(memory_instrumentation::mojom::RequestArgsDataView input,
54 base::trace_event::MemoryDumpRequestArgs* out); 54 base::trace_event::MemoryDumpRequestArgs* out);
55 }; 55 };
56 56
57 template <> 57 template <>
58 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT StructTraits< 58 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_EXPORT StructTraits<
59 memory_instrumentation::mojom::PlatformPrivateFootprintDataView, 59 memory_instrumentation::mojom::PlatformPrivateFootprintDataView,
60 base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint> { 60 base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint> {
61 static uint64_t phys_footprint_bytes( 61 static uint64_t phys_footprint_bytes(
62 const base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint& 62 const base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint&
63 args) { 63 args) {
64 return args.phys_footprint_bytes; 64 return args.phys_footprint_bytes;
65 } 65 }
66 static uint64_t internal_bytes( 66 static uint64_t internal_bytes(
67 const base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint& 67 const base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint&
68 args) { 68 args) {
(...skipping 13 matching lines...) Expand all
82 const base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint& 82 const base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint&
83 args) { 83 args) {
84 return args.vm_swap_bytes; 84 return args.vm_swap_bytes;
85 } 85 }
86 static bool Read( 86 static bool Read(
87 memory_instrumentation::mojom::PlatformPrivateFootprintDataView input, 87 memory_instrumentation::mojom::PlatformPrivateFootprintDataView input,
88 base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint* out); 88 base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint* out);
89 }; 89 };
90 90
91 template <> 91 template <>
92 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT 92 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_EXPORT
93 StructTraits<memory_instrumentation::mojom::ChromeMemDumpDataView, 93 StructTraits<memory_instrumentation::mojom::ChromeMemDumpDataView,
94 base::trace_event::MemoryDumpCallbackResult::ChromeMemDump> { 94 base::trace_event::MemoryDumpCallbackResult::ChromeMemDump> {
95 static uint32_t malloc_total_kb( 95 static uint32_t malloc_total_kb(
96 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) { 96 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) {
97 return args.malloc_total_kb; 97 return args.malloc_total_kb;
98 } 98 }
99 static uint32_t partition_alloc_total_kb( 99 static uint32_t partition_alloc_total_kb(
100 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) { 100 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) {
101 return args.partition_alloc_total_kb; 101 return args.partition_alloc_total_kb;
102 } 102 }
103 static uint32_t blink_gc_total_kb( 103 static uint32_t blink_gc_total_kb(
104 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) { 104 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) {
105 return args.blink_gc_total_kb; 105 return args.blink_gc_total_kb;
106 } 106 }
107 static uint32_t v8_total_kb( 107 static uint32_t v8_total_kb(
108 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) { 108 const base::trace_event::MemoryDumpCallbackResult::ChromeMemDump& args) {
109 return args.v8_total_kb; 109 return args.v8_total_kb;
110 } 110 }
111 static bool Read( 111 static bool Read(
112 memory_instrumentation::mojom::ChromeMemDumpDataView input, 112 memory_instrumentation::mojom::ChromeMemDumpDataView input,
113 base::trace_event::MemoryDumpCallbackResult::ChromeMemDump* out); 113 base::trace_event::MemoryDumpCallbackResult::ChromeMemDump* out);
114 }; 114 };
115 115
116 template <> 116 template <>
117 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT 117 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_EXPORT
118 StructTraits<memory_instrumentation::mojom::OSMemDumpDataView, 118 StructTraits<memory_instrumentation::mojom::OSMemDumpDataView,
119 base::trace_event::MemoryDumpCallbackResult::OSMemDump> { 119 base::trace_event::MemoryDumpCallbackResult::OSMemDump> {
120 static uint32_t resident_set_kb( 120 static uint32_t resident_set_kb(
121 const base::trace_event::MemoryDumpCallbackResult::OSMemDump& args) { 121 const base::trace_event::MemoryDumpCallbackResult::OSMemDump& args) {
122 return args.resident_set_kb; 122 return args.resident_set_kb;
123 } 123 }
124 static base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint 124 static base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint
125 platform_private_footprint( 125 platform_private_footprint(
126 const base::trace_event::MemoryDumpCallbackResult::OSMemDump& args) { 126 const base::trace_event::MemoryDumpCallbackResult::OSMemDump& args) {
127 return args.platform_private_footprint; 127 return args.platform_private_footprint;
128 } 128 }
129 static bool Read(memory_instrumentation::mojom::OSMemDumpDataView input, 129 static bool Read(memory_instrumentation::mojom::OSMemDumpDataView input,
130 base::trace_event::MemoryDumpCallbackResult::OSMemDump* out); 130 base::trace_event::MemoryDumpCallbackResult::OSMemDump* out);
131 }; 131 };
132 132
133 template <> 133 template <>
134 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_EXPORT StructTraits< 134 struct SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_EXPORT StructTraits<
135 memory_instrumentation::mojom::MemoryDumpCallbackResultDataView, 135 memory_instrumentation::mojom::MemoryDumpCallbackResultDataView,
136 base::trace_event::MemoryDumpCallbackResult> { 136 base::trace_event::MemoryDumpCallbackResult> {
137 static base::trace_event::MemoryDumpCallbackResult::OSMemDump os_dump( 137 static base::trace_event::MemoryDumpCallbackResult::OSMemDump os_dump(
138 const base::trace_event::MemoryDumpCallbackResult& args) { 138 const base::trace_event::MemoryDumpCallbackResult& args) {
139 return args.os_dump; 139 return args.os_dump;
140 } 140 }
141 static base::trace_event::MemoryDumpCallbackResult::ChromeMemDump chrome_dump( 141 static base::trace_event::MemoryDumpCallbackResult::ChromeMemDump chrome_dump(
142 const base::trace_event::MemoryDumpCallbackResult& args) { 142 const base::trace_event::MemoryDumpCallbackResult& args) {
143 return args.chrome_dump; 143 return args.chrome_dump;
144 } 144 }
145 static const std::map<base::ProcessId, 145 static const std::map<base::ProcessId,
146 base::trace_event::MemoryDumpCallbackResult::OSMemDump>& 146 base::trace_event::MemoryDumpCallbackResult::OSMemDump>&
147 extra_processes_dump( 147 extra_processes_dump(
148 const base::trace_event::MemoryDumpCallbackResult& args) { 148 const base::trace_event::MemoryDumpCallbackResult& args) {
149 return args.extra_processes_dump; 149 return args.extra_processes_dump;
150 } 150 }
151 static bool Read( 151 static bool Read(
152 memory_instrumentation::mojom::MemoryDumpCallbackResultDataView input, 152 memory_instrumentation::mojom::MemoryDumpCallbackResultDataView input,
153 base::trace_event::MemoryDumpCallbackResult* out); 153 base::trace_event::MemoryDumpCallbackResult* out);
154 }; 154 };
155 155
156 } // namespace mojo 156 } // namespace mojo
157 157
158 #endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_INSTRUMENTATIO N_STRUCT_TRAITS_H_ 158 #endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_INSTRUMENTATIO N_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698