OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_ | 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_ |
6 #define SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_ | 6 #define SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "services/shell/public/cpp/connection.h" | 10 #include "services/shell/public/cpp/connection.h" |
11 #include "services/shell/public/cpp/identity.h" | 11 #include "services/shell/public/cpp/identity.h" |
12 #include "services/shell/public/interfaces/connector.mojom.h" | 12 #include "services/shell/public/interfaces/connector.mojom.h" |
13 #include "services/shell/public/interfaces/service.mojom.h" | 13 #include "services/shell/public/interfaces/service.mojom.h" |
14 #include "services/shell/public/interfaces/service_manager.mojom.h" | 14 #include "services/shell/public/interfaces/service_manager.mojom.h" |
15 | 15 |
16 namespace shell { | 16 namespace shell { |
17 | 17 |
18 // An interface that encapsulates the Mojo Shell's broker interface by which | 18 // An interface that encapsulates the Mojo Shell's broker interface by which |
19 // connections between applications are established. Once Connect() is called, | 19 // connections between applications are established. Once Connect() is called, |
20 // this class is bound to the thread the call was made on and it cannot be | 20 // this class is bound to the thread the call was made on and it cannot be |
21 // passed to another thread without calling Clone(). | 21 // passed to another thread without calling Clone(). |
22 // An instance of this class is created internally by ShellConnection for use | 22 // An instance of this class is created internally by ServiceContext for use |
23 // on the thread ShellConnection is instantiated on, and this interface is | 23 // on the thread ServiceContext is instantiated on, and this interface is |
24 // wrapped by the Shell interface. | 24 // wrapped by the Shell interface. |
25 // To use this interface on other threads, call Shell::CloneConnector() and | 25 // To use this interface on other threads, call Shell::CloneConnector() and |
26 // pass the result to another thread. To pass to subsequent threads, call | 26 // pass the result to another thread. To pass to subsequent threads, call |
27 // Clone() on instances of this object. | 27 // Clone() on instances of this object. |
28 // While instances of this object are owned by the caller, the underlying | 28 // While instances of this object are owned by the caller, the underlying |
29 // connection with the shell is bound to the lifetime of the instance that | 29 // connection with the shell is bound to the lifetime of the instance that |
30 // created it, i.e. when the application is terminated the Connector pipe is | 30 // created it, i.e. when the application is terminated the Connector pipe is |
31 // closed. | 31 // closed. |
32 class Connector { | 32 class Connector { |
33 public: | 33 public: |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 // Creates a new instance of this class which may be passed to another thread. | 106 // Creates a new instance of this class which may be passed to another thread. |
107 // The returned object may be passed multiple times until Connect() is called, | 107 // The returned object may be passed multiple times until Connect() is called, |
108 // at which point this method must be called again to pass again. | 108 // at which point this method must be called again to pass again. |
109 virtual std::unique_ptr<Connector> Clone() = 0; | 109 virtual std::unique_ptr<Connector> Clone() = 0; |
110 }; | 110 }; |
111 | 111 |
112 } // namespace shell | 112 } // namespace shell |
113 | 113 |
114 #endif // SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_ | 114 #endif // SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_ |
OLD | NEW |