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

Side by Side Diff: services/service_manager/public/interfaces/connector.mojom

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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 module service_manager.mojom; 5 module service_manager.mojom;
6 6
7 import "services/service_manager/public/interfaces/interface_provider.mojom"; 7 import "services/service_manager/public/interfaces/interface_provider.mojom";
8 8
9 const string kRootUserID = "505C0EE9-3013-43C0-82B0-A84F50CF8D84"; 9 const string kRootUserID = "505C0EE9-3013-43C0-82B0-A84F50CF8D84";
10 const string kInheritUserID = "D26290E4-4485-4EAE-81A2-66D1EEB40A9D"; 10 const string kInheritUserID = "D26290E4-4485-4EAE-81A2-66D1EEB40A9D";
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 string instance; 60 string instance;
61 }; 61 };
62 62
63 // Implemented by an object in the service manager associated with a specific 63 // Implemented by an object in the service manager associated with a specific
64 // instance. Tells the service manager the PID for a process launched by the 64 // instance. Tells the service manager the PID for a process launched by the
65 // client. See |ClientProcessConnection|. 65 // client. See |ClientProcessConnection|.
66 interface PIDReceiver { 66 interface PIDReceiver {
67 SetPID(uint32 pid); 67 SetPID(uint32 pid);
68 }; 68 };
69 69
70 // Typically, the service manager will start a process for a service the first
71 // time it receives a connection request for it. This struct allows a client to
72 // start the process itself and provide the service manager the pipes it needs
73 // to communicate with it. When an instance of this struct is supplied to
74 // Connect(), the client owns the lifetime of the child process, not the service
75 // manager. The service manager binds the |service| pipe, and when it closes
76 // destroys the associated instance but the process stays alive.
77 struct ClientProcessConnection {
78 // Provides the service manager the ability to bind a Service from the client
79 // process to the instance it creates.
80 handle<message_pipe> service;
81
82 // Allows the client process launcher to tell the service manager the PID of
83 // the process it created (the pid isn't supplied directly here as the process
84 // may not have been launched by the time Connect() is called.)
85 handle<message_pipe> pid_receiver_request;
86 };
87
88 // Encapsulates establishing connections with other Services. 70 // Encapsulates establishing connections with other Services.
89 interface Connector { 71 interface Connector {
72 // Typically, the service manager will start a process for a service the first
73 // time it receives a connection request for it. This struct allows a client
74 // to start the process itself and provide the service manager the pipes it
75 // needs to communicate with it. When this function is called, the client owns
76 // the lifetime of the child process it started, not the service manager. The
77 // service manager binds the |service| pipe, and when it closes destroys the
78 // associated instance but the process stays alive.
79 //
80 // Parameters:
81 //
82 // service
83 // A pipe to an implementation of Service that the service manager can use
84 // to communicate with the service.
85 //
86 // pid_receiver_request
87 // Allows the client process launcher to tell the service manager the PID of
88 // the process it created (the pid isn't supplied directly here as the
89 // process may not have been launched by the time Connect() is called.)
90 //
91 Start(Identity name,
92 handle<message_pipe> service,
93 PIDReceiver& pid_receiver_request);
94
90 // Requests a connection with another service. The service originating the 95 // Requests a connection with another service. The service originating the
91 // request is referred to as the "source" and the one receiving the "target". 96 // request is referred to as the "source" and the one receiving the "target".
92 // 97 //
93 // The connection is embodied by a pair of message pipes binding the 98 // The connection is embodied by a pair of message pipes binding the
94 // InterfaceProvider interface, which allows both the source and target 99 // InterfaceProvider interface, which allows both the source and target
95 // services to export interfaces to one another. The interfaces bound via 100 // services to export interfaces to one another. The interfaces bound via
96 // these InterfaceProviders are brokered by the service manager according to 101 // these InterfaceProviders are brokered by the service manager according to
97 // the security policy defined by each service in its manifest. 102 // the security policy defined by each service in its manifest.
98 // 103 //
99 // If the target service is not running, the service manager will run it, 104 // If the target service is not running, the service manager will run it,
100 // calling its OnStart() method before completing the connection. 105 // calling its OnStart() method before completing the connection.
101 // 106 //
102 // Parameters: 107 // Parameters:
103 // 108 //
104 // target 109 // target
105 // Identifies the target service instance to connect to. 110 // Identifies the target service instance to connect to.
106 // 111 //
107 // remote_interfaces 112 // remote_interfaces
108 // Allows the source service access to interface implementations exposed by 113 // Allows the source service access to interface implementations exposed by
109 // the target service. The interfaces accessible via this InterfaceProvider 114 // the target service. The interfaces accessible via this InterfaceProvider
110 // are filtered by the security policy described by the source and target 115 // are filtered by the security policy described by the source and target
111 // service manifests. 116 // service manifests.
112 // 117 //
113 // client_process_connection
114 // When non-null, supplies control pipes the service manager can use to
115 // bind a process created by the client, instead of creating one itself.
116 //
117 // Response parameters: 118 // Response parameters:
118 // 119 //
119 // result 120 // result
120 // Indicates the result of the Connect() operation. 121 // Indicates the result of the Connect() operation.
121 // 122 //
122 // user_id 123 // user_id
123 // The user id the service manager ran the target service as. Typically a 124 // The user id the service manager ran the target service as. Typically a
124 // client passes |kInheritUserID| as the user id to Connect(), which is 125 // client passes |kInheritUserID| as the user id to Connect(), which is
125 // resolved by the service manager into a valid user id returned through 126 // resolved by the service manager into a valid user id returned through
126 // this callback. 127 // this callback.
127 // 128 //
128 Connect(Identity target, 129 Connect(Identity target, InterfaceProvider&? remote_interfaces) =>
129 InterfaceProvider&? remote_interfaces,
130 ClientProcessConnection? client_process_connection) =>
131 (ConnectResult result, string user_id); 130 (ConnectResult result, string user_id);
132 131
133 // Clones this Connector so it can be passed to another thread. 132 // Clones this Connector so it can be passed to another thread.
134 Clone(Connector& request); 133 Clone(Connector& request);
135 }; 134 };
OLDNEW
« no previous file with comments | « services/service_manager/public/cpp/lib/connector_impl.cc ('k') | services/service_manager/service_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698