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