OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "components/arc/arc_bridge_service_impl.h" | 5 #include "components/arc/arc_bridge_service_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 void ArcBridgeServiceImpl::OnChannelClosed() { | 165 void ArcBridgeServiceImpl::OnChannelClosed() { |
166 DCHECK(CalledOnValidThread()); | 166 DCHECK(CalledOnValidThread()); |
167 if (state() == State::STOPPED || state() == State::STOPPING) { | 167 if (state() == State::STOPPED || state() == State::STOPPING) { |
168 // This will happen when the instance is shut down. Ignore that case. | 168 // This will happen when the instance is shut down. Ignore that case. |
169 return; | 169 return; |
170 } | 170 } |
171 VLOG(1) << "Mojo connection lost"; | 171 VLOG(1) << "Mojo connection lost"; |
172 instance_ptr_.reset(); | 172 instance_ptr_.reset(); |
173 if (binding_.is_bound()) | 173 if (binding_.is_bound()) |
174 binding_.Close(); | 174 binding_.Close(); |
175 CloseAllChannels(); | 175 |
| 176 // Call all the error handlers of all the channels to both close the channel |
| 177 // and notify any observers that the channel is closed. |
| 178 app_.CloseChannel(); |
| 179 audio_.CloseChannel(); |
| 180 auth_.CloseChannel(); |
| 181 bluetooth_.CloseChannel(); |
| 182 clipboard_.CloseChannel(); |
| 183 crash_collector_.CloseChannel(); |
| 184 file_system_.CloseChannel(); |
| 185 ime_.CloseChannel(); |
| 186 intent_helper_.CloseChannel(); |
| 187 metrics_.CloseChannel(); |
| 188 net_.CloseChannel(); |
| 189 notifications_.CloseChannel(); |
| 190 obb_mounter_.CloseChannel(); |
| 191 policy_.CloseChannel(); |
| 192 power_.CloseChannel(); |
| 193 process_.CloseChannel(); |
| 194 storage_manager_.CloseChannel(); |
| 195 video_.CloseChannel(); |
| 196 window_manager_.CloseChannel(); |
| 197 } |
| 198 |
| 199 void ArcBridgeServiceImpl::OnAppInstanceReady(mojom::AppInstancePtr app_ptr) { |
| 200 DCHECK(CalledOnValidThread()); |
| 201 app_.OnInstanceReady(std::move(app_ptr)); |
| 202 } |
| 203 |
| 204 void ArcBridgeServiceImpl::OnAudioInstanceReady( |
| 205 mojom::AudioInstancePtr audio_ptr) { |
| 206 DCHECK(CalledOnValidThread()); |
| 207 audio_.OnInstanceReady(std::move(audio_ptr)); |
| 208 } |
| 209 |
| 210 void ArcBridgeServiceImpl::OnAuthInstanceReady( |
| 211 mojom::AuthInstancePtr auth_ptr) { |
| 212 DCHECK(CalledOnValidThread()); |
| 213 auth_.OnInstanceReady(std::move(auth_ptr)); |
| 214 } |
| 215 |
| 216 void ArcBridgeServiceImpl::OnBluetoothInstanceReady( |
| 217 mojom::BluetoothInstancePtr bluetooth_ptr) { |
| 218 DCHECK(CalledOnValidThread()); |
| 219 bluetooth_.OnInstanceReady(std::move(bluetooth_ptr)); |
| 220 } |
| 221 |
| 222 void ArcBridgeServiceImpl::OnClipboardInstanceReady( |
| 223 mojom::ClipboardInstancePtr clipboard_ptr) { |
| 224 DCHECK(CalledOnValidThread()); |
| 225 clipboard_.OnInstanceReady(std::move(clipboard_ptr)); |
| 226 } |
| 227 |
| 228 void ArcBridgeServiceImpl::OnCrashCollectorInstanceReady( |
| 229 mojom::CrashCollectorInstancePtr crash_collector_ptr) { |
| 230 DCHECK(CalledOnValidThread()); |
| 231 crash_collector_.OnInstanceReady(std::move(crash_collector_ptr)); |
| 232 } |
| 233 |
| 234 void ArcBridgeServiceImpl::OnFileSystemInstanceReady( |
| 235 mojom::FileSystemInstancePtr file_system_ptr) { |
| 236 DCHECK(CalledOnValidThread()); |
| 237 file_system_.OnInstanceReady(std::move(file_system_ptr)); |
| 238 } |
| 239 |
| 240 void ArcBridgeServiceImpl::OnImeInstanceReady(mojom::ImeInstancePtr ime_ptr) { |
| 241 DCHECK(CalledOnValidThread()); |
| 242 ime_.OnInstanceReady(std::move(ime_ptr)); |
| 243 } |
| 244 |
| 245 void ArcBridgeServiceImpl::OnIntentHelperInstanceReady( |
| 246 mojom::IntentHelperInstancePtr intent_helper_ptr) { |
| 247 DCHECK(CalledOnValidThread()); |
| 248 intent_helper_.OnInstanceReady(std::move(intent_helper_ptr)); |
| 249 } |
| 250 |
| 251 void ArcBridgeServiceImpl::OnMetricsInstanceReady( |
| 252 mojom::MetricsInstancePtr metrics_ptr) { |
| 253 DCHECK(CalledOnValidThread()); |
| 254 metrics_.OnInstanceReady(std::move(metrics_ptr)); |
| 255 } |
| 256 |
| 257 void ArcBridgeServiceImpl::OnNetInstanceReady(mojom::NetInstancePtr net_ptr) { |
| 258 DCHECK(CalledOnValidThread()); |
| 259 net_.OnInstanceReady(std::move(net_ptr)); |
| 260 } |
| 261 |
| 262 void ArcBridgeServiceImpl::OnNotificationsInstanceReady( |
| 263 mojom::NotificationsInstancePtr notifications_ptr) { |
| 264 DCHECK(CalledOnValidThread()); |
| 265 notifications_.OnInstanceReady(std::move(notifications_ptr)); |
| 266 } |
| 267 |
| 268 void ArcBridgeServiceImpl::OnObbMounterInstanceReady( |
| 269 mojom::ObbMounterInstancePtr obb_mounter_ptr) { |
| 270 DCHECK(CalledOnValidThread()); |
| 271 obb_mounter_.OnInstanceReady(std::move(obb_mounter_ptr)); |
| 272 } |
| 273 |
| 274 void ArcBridgeServiceImpl::OnPolicyInstanceReady( |
| 275 mojom::PolicyInstancePtr policy_ptr) { |
| 276 DCHECK(CalledOnValidThread()); |
| 277 policy_.OnInstanceReady(std::move(policy_ptr)); |
| 278 } |
| 279 |
| 280 void ArcBridgeServiceImpl::OnPowerInstanceReady( |
| 281 mojom::PowerInstancePtr power_ptr) { |
| 282 DCHECK(CalledOnValidThread()); |
| 283 power_.OnInstanceReady(std::move(power_ptr)); |
| 284 } |
| 285 |
| 286 void ArcBridgeServiceImpl::OnProcessInstanceReady( |
| 287 mojom::ProcessInstancePtr process_ptr) { |
| 288 DCHECK(CalledOnValidThread()); |
| 289 process_.OnInstanceReady(std::move(process_ptr)); |
| 290 } |
| 291 |
| 292 void ArcBridgeServiceImpl::OnStorageManagerInstanceReady( |
| 293 mojom::StorageManagerInstancePtr storage_manager_ptr) { |
| 294 DCHECK(CalledOnValidThread()); |
| 295 storage_manager_.OnInstanceReady(std::move(storage_manager_ptr)); |
| 296 } |
| 297 |
| 298 void ArcBridgeServiceImpl::OnVideoInstanceReady( |
| 299 mojom::VideoInstancePtr video_ptr) { |
| 300 DCHECK(CalledOnValidThread()); |
| 301 video_.OnInstanceReady(std::move(video_ptr)); |
| 302 } |
| 303 |
| 304 void ArcBridgeServiceImpl::OnWindowManagerInstanceReady( |
| 305 mojom::WindowManagerInstancePtr window_manager_ptr) { |
| 306 DCHECK(CalledOnValidThread()); |
| 307 window_manager_.OnInstanceReady(std::move(window_manager_ptr)); |
176 } | 308 } |
177 | 309 |
178 } // namespace arc | 310 } // namespace arc |
OLD | NEW |