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_bootstrap.h" | 5 #include "components/arc/arc_bridge_bootstrap.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <grp.h> | 8 #include <grp.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/location.h" | 15 #include "base/location.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/posix/eintr_wrapper.h" | 18 #include "base/posix/eintr_wrapper.h" |
19 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
20 #include "base/task_runner_util.h" | 20 #include "base/task_runner_util.h" |
21 #include "base/threading/thread_checker.h" | 21 #include "base/threading/thread_checker.h" |
22 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
23 #include "base/threading/worker_pool.h" | 23 #include "base/threading/worker_pool.h" |
24 #include "chromeos/cryptohome/cryptohome_parameters.h" | 24 #include "chromeos/cryptohome/cryptohome_parameters.h" |
25 #include "chromeos/dbus/dbus_method_call_status.h" | 25 #include "chromeos/dbus/dbus_method_call_status.h" |
26 #include "chromeos/dbus/dbus_thread_manager.h" | 26 #include "chromeos/dbus/dbus_thread_manager.h" |
27 #include "chromeos/dbus/session_manager_client.h" | 27 #include "chromeos/dbus/session_manager_client.h" |
28 #include "components/arc/arc_features.h" | |
28 #include "components/user_manager/user_manager.h" | 29 #include "components/user_manager/user_manager.h" |
29 #include "ipc/unix_domain_socket_util.h" | 30 #include "ipc/unix_domain_socket_util.h" |
30 #include "mojo/edk/embedder/embedder.h" | 31 #include "mojo/edk/embedder/embedder.h" |
31 #include "mojo/edk/embedder/platform_channel_pair.h" | 32 #include "mojo/edk/embedder/platform_channel_pair.h" |
32 #include "mojo/edk/embedder/platform_channel_utils_posix.h" | 33 #include "mojo/edk/embedder/platform_channel_utils_posix.h" |
33 #include "mojo/edk/embedder/platform_handle_vector.h" | 34 #include "mojo/edk/embedder/platform_handle_vector.h" |
34 #include "mojo/edk/embedder/scoped_platform_handle.h" | 35 #include "mojo/edk/embedder/scoped_platform_handle.h" |
35 #include "mojo/public/cpp/bindings/binding.h" | 36 #include "mojo/public/cpp/bindings/binding.h" |
36 | 37 |
37 namespace arc { | 38 namespace arc { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 LOG(ERROR) << "ARC: Error creating socket"; | 290 LOG(ERROR) << "ARC: Error creating socket"; |
290 AbortBoot(ArcBridgeService::StopReason::GENERIC_BOOT_FAILURE); | 291 AbortBoot(ArcBridgeService::StopReason::GENERIC_BOOT_FAILURE); |
291 return; | 292 return; |
292 } | 293 } |
293 | 294 |
294 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 295 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
295 DCHECK(user_manager->GetPrimaryUser()); | 296 DCHECK(user_manager->GetPrimaryUser()); |
296 const cryptohome::Identification cryptohome_id( | 297 const cryptohome::Identification cryptohome_id( |
297 user_manager->GetPrimaryUser()->GetAccountId()); | 298 user_manager->GetPrimaryUser()->GetAccountId()); |
298 | 299 |
300 // Read the arc-boot-completed-broadcast flag | |
Daniel Erat
2016/10/03 22:39:28
nit: remove this unnecessary comment
xzhou
2016/10/03 23:29:31
Done.
| |
301 bool disable_arc_boot_completed_broadcast = | |
302 !base::FeatureList::IsEnabled(arc::kArcBootCompletedBroadcast); | |
303 | |
299 chromeos::SessionManagerClient* session_manager_client = | 304 chromeos::SessionManagerClient* session_manager_client = |
300 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); | 305 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); |
301 session_manager_client->StartArcInstance( | 306 session_manager_client->StartArcInstance( |
302 cryptohome_id, | 307 cryptohome_id, |
308 disable_arc_boot_completed_broadcast, | |
303 base::Bind(&ArcBridgeBootstrapImpl::OnInstanceStarted, | 309 base::Bind(&ArcBridgeBootstrapImpl::OnInstanceStarted, |
304 weak_factory_.GetWeakPtr(), base::Passed(&socket_fd))); | 310 weak_factory_.GetWeakPtr(), base::Passed(&socket_fd))); |
305 } | 311 } |
306 | 312 |
307 void ArcBridgeBootstrapImpl::OnInstanceStarted(base::ScopedFD socket_fd, | 313 void ArcBridgeBootstrapImpl::OnInstanceStarted(base::ScopedFD socket_fd, |
308 bool success) { | 314 bool success) { |
309 DCHECK(thread_checker_.CalledOnValidThread()); | 315 DCHECK(thread_checker_.CalledOnValidThread()); |
310 if (!success) { | 316 if (!success) { |
311 LOG(ERROR) << "Failed to start ARC instance"; | 317 LOG(ERROR) << "Failed to start ARC instance"; |
312 // Roll back the state to SOCKET_CREATING to avoid sending the D-Bus signal | 318 // Roll back the state to SOCKET_CREATING to avoid sending the D-Bus signal |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
441 } | 447 } |
442 | 448 |
443 } // namespace | 449 } // namespace |
444 | 450 |
445 // static | 451 // static |
446 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { | 452 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { |
447 return base::WrapUnique(new ArcBridgeBootstrapImpl()); | 453 return base::WrapUnique(new ArcBridgeBootstrapImpl()); |
448 } | 454 } |
449 | 455 |
450 } // namespace arc | 456 } // namespace arc |
OLD | NEW |