| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SERVICES_MEMORY_INFRA_PUBLIC_CPP_MEMORY_INFRA_TRAITS_H_ | |
| 6 #define SERVICES_MEMORY_INFRA_PUBLIC_CPP_MEMORY_INFRA_TRAITS_H_ | |
| 7 | |
| 8 #include "base/trace_event/memory_dump_request_args.h" | |
| 9 #include "services/memory_instrumentation/public/interfaces/memory_instrumentati
on.mojom.h" | |
| 10 | |
| 11 namespace mojo { | |
| 12 | |
| 13 template<> | |
| 14 struct EnumTraits<memory_instrumentation::mojom::DumpType, | |
| 15 base::trace_event::MemoryDumpType> { | |
| 16 static memory_instrumentation::mojom::DumpType ToMojom( | |
| 17 base::trace_event::MemoryDumpType type); | |
| 18 static bool FromMojom(memory_instrumentation::mojom::DumpType input, | |
| 19 base::trace_event::MemoryDumpType* out); | |
| 20 }; | |
| 21 | |
| 22 template<> | |
| 23 struct EnumTraits<memory_instrumentation::mojom::LevelOfDetail, | |
| 24 base::trace_event::MemoryDumpLevelOfDetail> { | |
| 25 static memory_instrumentation::mojom::LevelOfDetail ToMojom( | |
| 26 base::trace_event::MemoryDumpLevelOfDetail level_of_detail); | |
| 27 static bool FromMojom(memory_instrumentation::mojom::LevelOfDetail input, | |
| 28 base::trace_event::MemoryDumpLevelOfDetail* out); | |
| 29 }; | |
| 30 | |
| 31 template<> | |
| 32 struct StructTraits<memory_instrumentation::mojom::RequestArgsDataView, | |
| 33 base::trace_event::MemoryDumpRequestArgs> { | |
| 34 static uint64_t dump_guid( | |
| 35 const base::trace_event::MemoryDumpRequestArgs& args) { | |
| 36 return args.dump_guid; | |
| 37 } | |
| 38 static base::trace_event::MemoryDumpType dump_type( | |
| 39 const base::trace_event::MemoryDumpRequestArgs& args) { | |
| 40 return args.dump_type; | |
| 41 } | |
| 42 static base::trace_event::MemoryDumpLevelOfDetail level_of_detail( | |
| 43 const base::trace_event::MemoryDumpRequestArgs& args) { | |
| 44 return args.level_of_detail; | |
| 45 } | |
| 46 static bool Read(memory_instrumentation::mojom::RequestArgsDataView input, | |
| 47 base::trace_event::MemoryDumpRequestArgs* out); | |
| 48 }; | |
| 49 | |
| 50 } // namespace mojo | |
| 51 | |
| 52 #endif // SERVICES_MEMORY_INFRA_PUBLIC_CPP_MEMORY_INFRA_TRAITS_H_ | |
| OLD | NEW |