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

Unified Diff: services/resource_coordinator/public/cpp/coordination_unit_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 side-by-side diff with in-line comments
Download patch
Index: services/resource_coordinator/public/cpp/coordination_unit_struct_traits.h
diff --git a/services/resource_coordinator/public/cpp/coordination_unit_struct_traits.h b/services/resource_coordinator/public/cpp/coordination_unit_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..79e761425ea7a401c3c893d409304608a1efc88f
--- /dev/null
+++ b/services/resource_coordinator/public/cpp/coordination_unit_struct_traits.h
@@ -0,0 +1,39 @@
+// 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_RESOURCE_COORDINATOR_PUBLIC_CPP_COORDINATION_UNIT_STRUCT_TRAITS_H_
+#define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_COORDINATION_UNIT_STRUCT_TRAITS_H_
+
+#include "services/resource_coordinator/public/cpp/coordination_unit_types.h"
+#include "services/resource_coordinator/public/interfaces/coordination_unit.mojom.h"
+
+namespace mojo {
+
+template <>
+struct EnumTraits<resource_coordinator::mojom::CoordinationUnitType,
+ resource_coordinator::CoordinationUnitType> {
+ static resource_coordinator::mojom::CoordinationUnitType ToMojom(
+ resource_coordinator::CoordinationUnitType type);
+ static bool FromMojom(resource_coordinator::mojom::CoordinationUnitType input,
+ resource_coordinator::CoordinationUnitType* out);
+};
+
+template <>
+struct StructTraits<resource_coordinator::mojom::CoordinationUnitIDDataView,
+ resource_coordinator::CoordinationUnitID> {
+ static uint64_t id(const resource_coordinator::CoordinationUnitID& id) {
+ return id.id;
+ }
+ static resource_coordinator::CoordinationUnitType type(
+ const resource_coordinator::CoordinationUnitID& id) {
+ return id.type;
+ }
+ static bool Read(
+ resource_coordinator::mojom::CoordinationUnitIDDataView input,
+ resource_coordinator::CoordinationUnitID* out);
+};
+
+} // namespace mojo
+
+#endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_COORDINATION_UNIT_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698