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

Unified Diff: services/resource_coordinator/resource_coordinator_service.cc

Issue 2798713002: Global Resource Coordinator: Basic service internals (Closed)
Patch Set: Wrap EventType directly in resource_coordinator namespace when using helper Created 3 years, 8 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/resource_coordinator_service.cc
diff --git a/services/resource_coordinator/resource_coordinator_service.cc b/services/resource_coordinator/resource_coordinator_service.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5e93b335d086dd522327f8b41010ef05264eae98
--- /dev/null
+++ b/services/resource_coordinator/resource_coordinator_service.cc
@@ -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.
+
+#include "services/resource_coordinator/resource_coordinator_service.h"
+
+#include "base/macros.h"
+#include "services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h"
+#include "services/service_manager/public/cpp/service_context.h"
+
+namespace resource_coordinator {
+
+std::unique_ptr<service_manager::Service> ResourceCoordinatorService::Create() {
+ return base::MakeUnique<ResourceCoordinatorService>();
+}
+
+ResourceCoordinatorService::ResourceCoordinatorService()
+ : weak_factory_(this) {}
+
+ResourceCoordinatorService::~ResourceCoordinatorService() = default;
+
+void ResourceCoordinatorService::OnStart() {
+ ref_factory_.reset(new service_manager::ServiceContextRefFactory(
+ base::Bind(&service_manager::ServiceContext::RequestQuit,
+ base::Unretained(context()))));
+
+ registry_.AddInterface(base::Bind(&CoordinationUnitProviderImpl::Create,
+ base::Unretained(ref_factory_.get())));
+}
+
+void ResourceCoordinatorService::OnBindInterface(
+ const service_manager::ServiceInfo& source_info,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle interface_pipe) {
+ registry_.BindInterface(source_info.identity, interface_name,
+ std::move(interface_pipe));
+}
+
+} // namespace speed

Powered by Google App Engine
This is Rietveld 408576698