| OLD | NEW |
| 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 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ | 5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ |
| 6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ | 6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // Immediately severs the connection to the Service Manager and invokes the | 101 // Immediately severs the connection to the Service Manager and invokes the |
| 102 // quit closure (see SetQuitClosure() above) if one has been set. | 102 // quit closure (see SetQuitClosure() above) if one has been set. |
| 103 // | 103 // |
| 104 // See comments on DisconnectFromServiceManager() regarding abrupt | 104 // See comments on DisconnectFromServiceManager() regarding abrupt |
| 105 // disconnection from the Service Manager. | 105 // disconnection from the Service Manager. |
| 106 void QuitNow(); | 106 void QuitNow(); |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 friend class service_manager::Service; | 109 friend class service_manager::Service; |
| 110 | 110 |
| 111 using InterfaceRegistryMap = | |
| 112 std::map<InterfaceRegistry*, std::unique_ptr<InterfaceRegistry>>; | |
| 113 | |
| 114 // mojom::Service: | 111 // mojom::Service: |
| 115 void OnStart(const ServiceInfo& info, | 112 void OnStart(const ServiceInfo& info, |
| 116 const OnStartCallback& callback) override; | 113 const OnStartCallback& callback) override; |
| 117 void OnConnect(const ServiceInfo& source_info, | |
| 118 mojom::InterfaceProviderRequest interfaces, | |
| 119 const OnConnectCallback& callback) override; | |
| 120 void OnBindInterface( | 114 void OnBindInterface( |
| 121 const ServiceInfo& source_info, | 115 const ServiceInfo& source_info, |
| 122 const std::string& interface_name, | 116 const std::string& interface_name, |
| 123 mojo::ScopedMessagePipeHandle interface_pipe, | 117 mojo::ScopedMessagePipeHandle interface_pipe, |
| 124 const OnBindInterfaceCallback& callback) override; | 118 const OnBindInterfaceCallback& callback) override; |
| 125 | 119 |
| 126 void CallOnConnect(const ServiceInfo& source_info, | |
| 127 const InterfaceProviderSpec& source_spec, | |
| 128 const InterfaceProviderSpec& target_spec, | |
| 129 mojom::InterfaceProviderRequest request); | |
| 130 | |
| 131 void OnConnectionError(); | 120 void OnConnectionError(); |
| 132 void OnRegistryConnectionError(InterfaceRegistry* registry); | |
| 133 void DestroyConnectionInterfaceRegistry(InterfaceRegistry* registry); | |
| 134 | |
| 135 // We track the lifetime of incoming connection registries as a convenience | |
| 136 // for the client. | |
| 137 InterfaceRegistryMap connection_interface_registries_; | |
| 138 | 121 |
| 139 // A pending Connector request which will eventually be passed to the Service | 122 // A pending Connector request which will eventually be passed to the Service |
| 140 // Manager. | 123 // Manager. |
| 141 mojom::ConnectorRequest pending_connector_request_; | 124 mojom::ConnectorRequest pending_connector_request_; |
| 142 | 125 |
| 143 std::unique_ptr<service_manager::Service> service_; | 126 std::unique_ptr<service_manager::Service> service_; |
| 144 mojo::Binding<mojom::Service> binding_; | 127 mojo::Binding<mojom::Service> binding_; |
| 145 std::unique_ptr<Connector> connector_; | 128 std::unique_ptr<Connector> connector_; |
| 146 service_manager::ServiceInfo local_info_; | 129 service_manager::ServiceInfo local_info_; |
| 147 | 130 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 161 base::Closure quit_closure_; | 144 base::Closure quit_closure_; |
| 162 | 145 |
| 163 base::WeakPtrFactory<ServiceContext> weak_factory_; | 146 base::WeakPtrFactory<ServiceContext> weak_factory_; |
| 164 | 147 |
| 165 DISALLOW_COPY_AND_ASSIGN(ServiceContext); | 148 DISALLOW_COPY_AND_ASSIGN(ServiceContext); |
| 166 }; | 149 }; |
| 167 | 150 |
| 168 } // namespace service_manager | 151 } // namespace service_manager |
| 169 | 152 |
| 170 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ | 153 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ |
| OLD | NEW |