Index: services/resource_coordinator/coordination_unit_provider.cc |
diff --git a/services/resource_coordinator/coordination_unit_provider.cc b/services/resource_coordinator/coordination_unit_provider.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fc98f2b2ff80414000559157ff0dd51116ebfe0b |
--- /dev/null |
+++ b/services/resource_coordinator/coordination_unit_provider.cc |
@@ -0,0 +1,32 @@ |
+// 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. |
+ |
+#include "services/resource_coordinator/coordination_unit_provider.h" |
+ |
+#include "base/logging.h" |
+#include "mojo/public/cpp/bindings/strong_binding.h" |
+#include "services/resource_coordinator/coordination_unit.h" |
+#include "services/service_manager/public/cpp/connection.h" |
+ |
+namespace resource_coordinator { |
+ |
+CoordinationUnitProvider::CoordinationUnitProvider() = default; |
+ |
+CoordinationUnitProvider::~CoordinationUnitProvider() = default; |
+ |
+void CoordinationUnitProvider::CreateCoordinationUnit( |
+ mojom::CoordinationUnitRequest request, |
+ mojom::CoordinationUnitIDPtr options) { |
+ // TODO(oysteine): A strong binding here means the first binding set up |
+ // to a CoordinationUnit via CoordinationUnitProvider, i.e. the authoritative |
+ // one in terms of setting the context, has to outlive all of the other |
+ // connections (as the rest are just duplicated and held within |
+ // CoordinationUnit). Make sure this assumption is correct, or refactor into |
+ // some kind of refcounted thing. |
+ mojo::MakeStrongBinding( |
+ base::MakeUnique<CoordinationUnit>(std::move(options)), |
+ std::move(request)); |
+}; |
+ |
+} // namespace resource_coordinator |