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

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

Issue 2610173003: Add RegisterService, split out of Connect(). (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
« no previous file with comments | « services/service_manager/connect_params.h ('k') | services/service_manager/public/cpp/lib/connector_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/service_manager/public/cpp/connector.h
diff --git a/services/service_manager/public/cpp/connector.h b/services/service_manager/public/cpp/connector.h
index 5251b26feea9cc5ffc318fb3eac2fc408cc066db..73560d3e948a5c13c0f288411fa69b5a78673a99 100644
--- a/services/service_manager/public/cpp/connector.h
+++ b/services/service_manager/public/cpp/connector.h
@@ -36,73 +36,39 @@ class Connector {
public:
virtual ~Connector() {}
- class ConnectParams {
- public:
- explicit ConnectParams(const Identity& target);
- explicit ConnectParams(const std::string& name);
- ~ConnectParams();
-
- const Identity& target() { return target_; }
- void set_target(const Identity& target) { target_ = target; }
- void set_client_process_connection(
- mojom::ServicePtr service,
- mojom::PIDReceiverRequest pid_receiver_request) {
- service_ = std::move(service);
- pid_receiver_request_ = std::move(pid_receiver_request);
- }
- void TakeClientProcessConnection(
- mojom::ServicePtr* service,
- mojom::PIDReceiverRequest* pid_receiver_request) {
- *service = std::move(service_);
- *pid_receiver_request = std::move(pid_receiver_request_);
- }
- InterfaceProvider* remote_interfaces() { return remote_interfaces_; }
- void set_remote_interfaces(InterfaceProvider* remote_interfaces) {
- remote_interfaces_ = remote_interfaces;
- }
-
- private:
- Identity target_;
- mojom::ServicePtr service_;
- mojom::PIDReceiverRequest pid_receiver_request_;
- InterfaceProvider* remote_interfaces_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(ConnectParams);
- };
-
// Creates a new Connector instance and fills in |*request| with a request
// for the other end the Connector's interface.
static std::unique_ptr<Connector> Create(mojom::ConnectorRequest* request);
- // Requests a new connection to an application. Returns a pointer to the
- // connection if the connection is permitted by this application's delegate,
- // or nullptr otherwise. Caller takes ownership.
- // Once this method is called, this object is bound to the thread on which the
- // call took place. To pass to another thread, call Clone() and pass the
- // result.
+ // Creates an instance of a service for |identity| in a process started by the
+ // client (or someone else). Must be called before Connect() may be called to
+ // |identity|.
+ virtual void Start(
+ const Identity& identity,
+ mojom::ServicePtr service,
+ mojom::PIDReceiverRequest pid_receiver_request) = 0;
+
+ // Requests a new connection to a service. Returns a pointer to the
+ // connection if the connection is permitted by that service, nullptr
+ // otherwise. Once this method is called, this object is bound to the thread
+ // on which the call took place. To pass to another thread, call Clone() and
+ // pass the result.
virtual std::unique_ptr<Connection> Connect(const std::string& name) = 0;
- virtual std::unique_ptr<Connection> Connect(ConnectParams* params) = 0;
+ virtual std::unique_ptr<Connection> Connect(const Identity& target) = 0;
- // Connect to application identified by |request->name| and connect to the
- // service implementation of the interface identified by |Interface|.
+ // Connect to |target| & request to bind |Interface|. Does not retain a
+ // connection to |target|.
template <typename Interface>
- void ConnectToInterface(ConnectParams* params,
+ void ConnectToInterface(const Identity& target,
mojo::InterfacePtr<Interface>* ptr) {
- std::unique_ptr<Connection> connection = Connect(params);
+ std::unique_ptr<Connection> connection = Connect(target);
if (connection)
connection->GetInterface(ptr);
}
template <typename Interface>
- void ConnectToInterface(const Identity& target,
- mojo::InterfacePtr<Interface>* ptr) {
- ConnectParams params(target);
- return ConnectToInterface(&params, ptr);
- }
- template <typename Interface>
void ConnectToInterface(const std::string& name,
mojo::InterfacePtr<Interface>* ptr) {
- ConnectParams params(name);
- return ConnectToInterface(&params, ptr);
+ return ConnectToInterface(Identity(name, mojom::kInheritUserID), ptr);
}
// Creates a new instance of this class which may be passed to another thread.
« no previous file with comments | « services/service_manager/connect_params.h ('k') | services/service_manager/public/cpp/lib/connector_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698