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

Unified Diff: services/service_manager/public/cpp/standalone_service/standalone_service.h

Issue 2557213002: Build services as standalone executables (Closed)
Patch Set: remove DCHECKs with side effects -_- Created 4 years 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/service_manager/public/cpp/standalone_service/standalone_service.h
diff --git a/services/service_manager/public/cpp/standalone_service/standalone_service.h b/services/service_manager/public/cpp/standalone_service/standalone_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..e7ea3a714846c7ad6c3dce9fb91bb63958c27dbf
--- /dev/null
+++ b/services/service_manager/public/cpp/standalone_service/standalone_service.h
@@ -0,0 +1,25 @@
+// Copyright 2016 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 "base/callback.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
+
+namespace service_manager {
+
+using StandaloneServiceCallback = base::Callback<void(mojom::ServiceRequest)>;
+
+// Runs a standalone service in the current process. This takes care of setting
+// up a boilerplate environment, including initializing //base objects, Mojo
+// IPC, running a MessageLoop, and establishing a connection to the Service
+// Manager via canonical command-line arguments.
+//
+// Once a Service request is obtained, |callback| is invoked with it. This call
+// blocks until |callback| returns.
+//
+// NOTE: A typical service should also link against the main() defined in
+// main.cc (next to this header) and thus have no need to call this function
+// directly.
+void RunStandaloneService(const StandaloneServiceCallback& callback);
+
+} // namespace service_manager

Powered by Google App Engine
This is Rietveld 408576698