| 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..1926d04275671ba7608b382f645223677ff4dd04 100644
|
| --- a/services/service_manager/background/background_service_manager.h
|
| +++ b/services/service_manager/background/background_service_manager.h
|
| @@ -6,57 +6,58 @@
|
| #define SERVICES_SERVICE_MANAGER_BACKGROUND_BACKGROUND_SERVICE_MANAGER_H_
|
|
|
| #include <memory>
|
| +#include <vector>
|
|
|
| #include "base/macros.h"
|
| -#include "base/threading/thread.h"
|
| -#include "services/service_manager/public/cpp/identity.h"
|
| -#include "services/service_manager/public/interfaces/connector.mojom.h"
|
| +#include "mojo/public/cpp/bindings/interface_request.h"
|
| +#include "services/catalog/store.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 runs a Service Manager on a dedicated background
|
| -// thread.
|
| +// 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.
|
| class BackgroundServiceManager {
|
| public:
|
| - BackgroundServiceManager(
|
| - service_manager::ServiceProcessLauncher::Delegate* launcher_delegate,
|
| - std::unique_ptr<base::Value> catalog_contents);
|
| + struct InitParams {
|
| + InitParams();
|
| + ~InitParams();
|
| +
|
| + ServiceProcessLauncher::Delegate*
|
| + service_process_launcher_delegate = nullptr;
|
| +
|
| + // If true the edk is initialized.
|
| + bool init_edk = true;
|
| + };
|
| +
|
| + BackgroundServiceManager();
|
| ~BackgroundServiceManager();
|
|
|
| - // 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);
|
| + // 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);
|
|
|
| private:
|
| - 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);
|
| + class MojoThread;
|
|
|
| - base::Thread background_thread_;
|
| -
|
| - // The ServiceManager context. Must only be used on the background thread.
|
| - std::unique_ptr<Context> context_;
|
| + std::unique_ptr<MojoThread> thread_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(BackgroundServiceManager);
|
| };
|
|
|