Chromium Code Reviews| Index: services/memory_infra/public/cpp/memory_infra_traits.h |
| diff --git a/services/memory_infra/public/cpp/memory_infra_traits.h b/services/memory_infra/public/cpp/memory_infra_traits.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3ad5e9fc7550a2dc817d5e18bd2192247c61e9df |
| --- /dev/null |
| +++ b/services/memory_infra/public/cpp/memory_infra_traits.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef SERVICES_MEMORY_INFRA_PUBLIC_CPP_MEMORY_INFRA_TRAITS_H_ |
| +#define SERVICES_MEMORY_INFRA_PUBLIC_CPP_MEMORY_INFRA_TRAITS_H_ |
| + |
| +#include "base/trace_event/memory_dump_request_args.h" |
| +#include "services/memory_infra/public/interfaces/memory_infra.mojom.h" |
| + |
| +namespace mojo { |
| + |
| +template<> |
|
Primiano Tucci (use gerrit)
2017/01/16 15:11:04
(not related to your code, more about the mojo arc
chiniforooshan1
2017/01/16 18:14:48
Ken, am I doing this correctly?
|
| +struct EnumTraits<memory_infra::mojom::DumpType, |
| + base::trace_event::MemoryDumpType> { |
| + static memory_infra::mojom::DumpType ToMojom( |
| + base::trace_event::MemoryDumpType type); |
| + static bool FromMojom(memory_infra::mojom::DumpType input, |
| + base::trace_event::MemoryDumpType* out); |
| +}; |
| + |
| +template<> |
| +struct EnumTraits<memory_infra::mojom::LevelOfDetail, |
| + base::trace_event::MemoryDumpLevelOfDetail> { |
| + static memory_infra::mojom::LevelOfDetail ToMojom( |
| + base::trace_event::MemoryDumpLevelOfDetail level_of_detail); |
| + static bool FromMojom(memory_infra::mojom::LevelOfDetail input, |
| + base::trace_event::MemoryDumpLevelOfDetail* out); |
| +}; |
| + |
| +template<> |
| +struct StructTraits<memory_infra::mojom::RequestArgsDataView, |
| + base::trace_event::MemoryDumpRequestArgs> { |
| + static uint64_t dump_guid( |
| + const base::trace_event::MemoryDumpRequestArgs& args) { |
| + return args.dump_guid; |
| + } |
| + static memory_infra::mojom::DumpType dump_type( |
| + const base::trace_event::MemoryDumpRequestArgs& args); |
| + static memory_infra::mojom::LevelOfDetail level_of_detail( |
| + const base::trace_event::MemoryDumpRequestArgs& args); |
| + static bool Read(memory_infra::mojom::RequestArgsDataView input, |
| + base::trace_event::MemoryDumpRequestArgs* out); |
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif // SERVICES_MEMORY_INFRA_PUBLIC_CPP_MEMORY_INFRA_TRAITS_H_ |