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

Unified Diff: services/memory_instrumentation/public/cpp/memory_instrumentation_traits.h

Issue 2621143002: memory-infra: Introduce mojo interfaces and service stubs (Closed)
Patch Set: memory_infra -> memory_instrumentation Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: services/memory_instrumentation/public/cpp/memory_instrumentation_traits.h
diff --git a/services/memory_instrumentation/public/cpp/memory_instrumentation_traits.h b/services/memory_instrumentation/public/cpp/memory_instrumentation_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..29b219fb49b58da8411f35632250d4971d163450
--- /dev/null
+++ b/services/memory_instrumentation/public/cpp/memory_instrumentation_traits.h
@@ -0,0 +1,52 @@
+// 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_instrumentation/public/interfaces/memory_instrumentation.mojom.h"
+
+namespace mojo {
+
+template<>
+struct EnumTraits<memory_instrumentation::mojom::DumpType,
+ base::trace_event::MemoryDumpType> {
+ static memory_instrumentation::mojom::DumpType ToMojom(
+ base::trace_event::MemoryDumpType type);
+ static bool FromMojom(memory_instrumentation::mojom::DumpType input,
+ base::trace_event::MemoryDumpType* out);
+};
+
+template<>
+struct EnumTraits<memory_instrumentation::mojom::LevelOfDetail,
+ base::trace_event::MemoryDumpLevelOfDetail> {
+ static memory_instrumentation::mojom::LevelOfDetail ToMojom(
+ base::trace_event::MemoryDumpLevelOfDetail level_of_detail);
+ static bool FromMojom(memory_instrumentation::mojom::LevelOfDetail input,
+ base::trace_event::MemoryDumpLevelOfDetail* out);
+};
+
+template<>
+struct StructTraits<memory_instrumentation::mojom::RequestArgsDataView,
+ base::trace_event::MemoryDumpRequestArgs> {
+ static uint64_t dump_guid(
+ const base::trace_event::MemoryDumpRequestArgs& args) {
+ return args.dump_guid;
+ }
+ static base::trace_event::MemoryDumpType dump_type(
+ const base::trace_event::MemoryDumpRequestArgs& args) {
+ return args.dump_type;
+ }
+ static base::trace_event::MemoryDumpLevelOfDetail level_of_detail(
+ const base::trace_event::MemoryDumpRequestArgs& args) {
+ return args.level_of_detail;
+ }
+ static bool Read(memory_instrumentation::mojom::RequestArgsDataView input,
+ base::trace_event::MemoryDumpRequestArgs* out);
+};
+
+} // namespace mojo
+
+#endif // SERVICES_MEMORY_INFRA_PUBLIC_CPP_MEMORY_INFRA_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698