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

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

Issue 2645973006: [Service Manager] Get rid of dynamic service discovery (Closed)
Patch Set: . 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 1926d04275671ba7608b382f645223677ff4dd04..eb024f82c3786840c9cbe999c1d314ccf0cd0190 100644
--- a/services/service_manager/background/background_service_manager.h
+++ b/services/service_manager/background/background_service_manager.h
@@ -6,58 +6,57 @@
#define SERVICES_SERVICE_MANAGER_BACKGROUND_BACKGROUND_SERVICE_MANAGER_H_
#include <memory>
-#include <vector>
#include "base/macros.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/catalog/store.h"
+#include "base/threading/thread.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
#include "services/service_manager/public/interfaces/service.mojom.h"
#include "services/service_manager/runner/host/service_process_launcher.h"
+namespace base {
+class Value;
+class WaitableEvent;
+}
+
namespace service_manager {
+class Context;
class ServiceManager;
-// BackgroundServiceManager starts up a Service Manager on a background thread,
-// and
-// destroys the thread in the destructor. Once created use CreateApplication()
-// to obtain an InterfaceRequest for the Application. The InterfaceRequest can
-// then be bound to an ApplicationImpl.
+// BackgroundServiceManager runs a Service Manager on a dedicated background
+// thread.
class BackgroundServiceManager {
public:
- struct InitParams {
- InitParams();
- ~InitParams();
-
- ServiceProcessLauncher::Delegate*
- service_process_launcher_delegate = nullptr;
-
- // If true the edk is initialized.
- bool init_edk = true;
- };
-
- BackgroundServiceManager();
+ BackgroundServiceManager(
+ service_manager::ServiceProcessLauncher::Delegate* launcher_delegate,
+ std::unique_ptr<base::Value> catalog_contents);
~BackgroundServiceManager();
- // Starts the background service manager. |command_line_switches| are
- // additional
- // switches applied to any processes spawned by this call.
- void Init(std::unique_ptr<InitParams> init_params);
-
- // Obtains an InterfaceRequest for the specified name.
- mojom::ServiceRequest CreateServiceRequest(const std::string& name);
-
- // Use to do processing on the thread running the Service Manager. The
- // callback is supplied a pointer to the Service Manager. The callback does
- // *not* own the Service Manager.
- using ServiceManagerThreadCallback = base::Callback<void(ServiceManager*)>;
- void ExecuteOnServiceManagerThread(
- const ServiceManagerThreadCallback& callback);
+ // Creates a service instance for |identity|. This is intended for use by the
+ // Service Manager's embedder to register instances directly, without
+ // requiring a Connector.
+ //
+ // |pid_receiver_request| may be null, in which case the service manager
+ // assumes the new service is running in this process.
+ void RegisterService(const Identity& identity,
+ mojom::ServicePtr service,
+ mojom::PIDReceiverRequest pid_receiver_request);
private:
- class MojoThread;
-
- std::unique_ptr<MojoThread> thread_;
+ void InitializeOnBackgroundThread(
+ service_manager::ServiceProcessLauncher::Delegate* launcher_delegate,
+ std::unique_ptr<base::Value> catalog_contents);
+ void ShutDownOnBackgroundThread(base::WaitableEvent* done_event);
+ void RegisterServiceOnBackgroundThread(
+ const Identity& identity,
+ mojom::ServicePtrInfo service_info,
+ mojom::PIDReceiverRequest pid_receiver_request);
+
+ base::Thread background_thread_;
+
+ // The ServiceManager context. Must only be used on the background thread.
+ std::unique_ptr<Context> context_;
DISALLOW_COPY_AND_ASSIGN(BackgroundServiceManager);
};
« no previous file with comments | « services/service_manager/BUILD.gn ('k') | services/service_manager/background/background_service_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698