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

Unified Diff: services/service_manager/background/background_service_manager.h

Issue 2646033002: mash: Exit the root process if the window manager service crashes (Closed)
Patch Set: review comments 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/service_manager/background/background_service_manager.h
diff --git a/services/service_manager/background/background_service_manager.h b/services/service_manager/background/background_service_manager.h
index eb024f82c3786840c9cbe999c1d314ccf0cd0190..2e58974a2bcf5a2387736bbb79438153e603f4ba 100644
--- a/services/service_manager/background/background_service_manager.h
+++ b/services/service_manager/background/background_service_manager.h
@@ -7,6 +7,7 @@
#include <memory>
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/threading/thread.h"
#include "services/service_manager/public/cpp/identity.h"
@@ -15,6 +16,7 @@
#include "services/service_manager/runner/host/service_process_launcher.h"
namespace base {
+class SingleThreadTaskRunner;
class Value;
class WaitableEvent;
}
@@ -22,6 +24,7 @@ class WaitableEvent;
namespace service_manager {
class Context;
+class Identity;
class ServiceManager;
// BackgroundServiceManager runs a Service Manager on a dedicated background
@@ -43,6 +46,12 @@ class BackgroundServiceManager {
mojom::ServicePtr service,
mojom::PIDReceiverRequest pid_receiver_request);
+ // Provide a callback to be notified whenever a service is destroyed.
+ // Typically the creator of BackgroundServiceManager will use this to shut
+ // down when some set of services it created is destroyed. The |callback| is
+ // called on whichever thread called this function.
+ void SetInstanceQuitCallback(base::Callback<void(const Identity&)> callback);
+
private:
void InitializeOnBackgroundThread(
service_manager::ServiceProcessLauncher::Delegate* launcher_delegate,
@@ -52,6 +61,10 @@ class BackgroundServiceManager {
const Identity& identity,
mojom::ServicePtrInfo service_info,
mojom::PIDReceiverRequest pid_receiver_request);
+ void SetInstanceQuitCallbackOnBackgroundThread(
+ const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner,
+ const base::Callback<void(const Identity&)>& callback);
+ void OnInstanceQuitOnBackgroundThread(const Identity& identity);
base::Thread background_thread_;

Powered by Google App Engine
This is Rietveld 408576698