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

Unified Diff: services/shell/public/cpp/service_context.h

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « services/shell/public/cpp/service.gni ('k') | services/shell/public/cpp/service_context_ref.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/public/cpp/service_context.h
diff --git a/services/shell/public/cpp/service_context.h b/services/shell/public/cpp/service_context.h
deleted file mode 100644
index 4c22f529c26a61658c15ef7d861437a4b57a2b48..0000000000000000000000000000000000000000
--- a/services/shell/public/cpp/service_context.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2014 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.
-
-#ifndef SERVICES_SHELL_PUBLIC_CPP_SERVICE_CONTEXT_H_
-#define SERVICES_SHELL_PUBLIC_CPP_SERVICE_CONTEXT_H_
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/system/core.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/public/interfaces/service.mojom.h"
-
-namespace shell {
-
-// Encapsulates a connection to the Service Manager in two parts:
-// - a bound InterfacePtr to mojom::Connector, the primary mechanism
-// by which the instantiating service connects to other services,
-// brokered by the Service Manager.
-// - a bound InterfaceRequest of mojom::Service, an interface used by the
-// Service Manager to inform this service of lifecycle events and
-// inbound connections brokered by it.
-//
-// This class should be used in two scenarios:
-// - During early startup to bind the mojom::ServiceRequest obtained from
-// the Service Manager, typically in response to either ServiceMain() or
-// main().
-// - In an implementation of mojom::ServiceFactory to bind the
-// mojom::ServiceRequest passed via CreateService. In this scenario there can
-// be many instances of this class per process.
-//
-// Instances of this class are constructed with an implementation of the Service
-// Manager Client Lib's Service interface. See documentation in service.h
-// for details.
-//
-class ServiceContext : public mojom::Service {
- public:
- // Creates a new ServiceContext bound to |request|. This connection may be
- // used immediately to make outgoing connections via connector(). Does not
- // take ownership of |service|, which must remain valid for the lifetime of
- // ServiceContext. If either |connector| or |connector_request| is non-null
- // both must be non-null. If both are null, the connection will create its own
- // Connector and request to pass to the Service Manager on initialization.
- ServiceContext(shell::Service* service,
- mojom::ServiceRequest request,
- std::unique_ptr<Connector> connector = nullptr,
- mojom::ConnectorRequest connector_request = nullptr);
-
- ~ServiceContext() override;
-
- Connector* connector() { return connector_.get(); }
- const Identity& identity() { return identity_; }
-
- // Specify a function to be called when the connection to the shell is lost.
- // Note that if connection has already been lost, then |closure| is called
- // immediately.
- void SetConnectionLostClosure(const base::Closure& closure);
-
- private:
- // mojom::Service:
- void OnStart(const Identity& identity,
- const OnStartCallback& callback) override;
- void OnConnect(const Identity& source,
- mojom::InterfaceProviderRequest interfaces,
- const Interfaces& allowed_interfaces,
- const Classes& allowed_classes) override;
-
- void OnConnectionError();
-
- // A callback called when OnStart() is run.
- base::Closure initialize_handler_;
-
- // We track the lifetime of incoming connection registries as it more
- // convenient for the client.
- std::vector<std::unique_ptr<InterfaceRegistry>> incoming_connections_;
-
- // A pending Connector request which will eventually be passed to the Service
- // Manager.
- mojom::ConnectorRequest pending_connector_request_;
-
- shell::Service* service_;
- mojo::Binding<mojom::Service> binding_;
- std::unique_ptr<Connector> connector_;
- shell::Identity identity_;
- bool should_run_connection_lost_closure_ = false;
-
- base::Closure connection_lost_closure_;
-
- DISALLOW_COPY_AND_ASSIGN(ServiceContext);
-};
-
-} // namespace shell
-
-#endif // SERVICES_SHELL_PUBLIC_CPP_SERVICE_CONTEXT_H_
« no previous file with comments | « services/shell/public/cpp/service.gni ('k') | services/shell/public/cpp/service_context_ref.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698