| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 context_->network_task_runner()->PostTask( | 857 context_->network_task_runner()->PostTask( |
| 858 FROM_HERE, | 858 FROM_HERE, |
| 859 base::Bind(&HostProcess::ShutdownHost, this, kSuccessExitCode)); | 859 base::Bind(&HostProcess::ShutdownHost, this, kSuccessExitCode)); |
| 860 } | 860 } |
| 861 | 861 |
| 862 void HostProcess::StartOnUiThread() { | 862 void HostProcess::StartOnUiThread() { |
| 863 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); | 863 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 864 | 864 |
| 865 if (!InitWithCommandLine(base::CommandLine::ForCurrentProcess())) { | 865 if (!InitWithCommandLine(base::CommandLine::ForCurrentProcess())) { |
| 866 // Shutdown the host if the command line is invalid. | 866 // Shutdown the host if the command line is invalid. |
| 867 context_->network_task_runner()->PostTask( | 867 ShutdownOnUiThread(); |
| 868 FROM_HERE, base::Bind(&HostProcess::ShutdownHost, this, | |
| 869 kUsageExitCode)); | |
| 870 return; | 868 return; |
| 871 } | 869 } |
| 872 | 870 |
| 873 policy_watcher_ = | 871 policy_watcher_ = |
| 874 PolicyWatcher::Create(nullptr, context_->file_task_runner()); | 872 PolicyWatcher::Create(nullptr, context_->file_task_runner()); |
| 875 policy_watcher_->StartWatching( | 873 policy_watcher_->StartWatching( |
| 876 base::Bind(&HostProcess::OnPolicyUpdate, base::Unretained(this)), | 874 base::Bind(&HostProcess::OnPolicyUpdate, base::Unretained(this)), |
| 877 base::Bind(&HostProcess::OnPolicyError, base::Unretained(this))); | 875 base::Bind(&HostProcess::OnPolicyError, base::Unretained(this))); |
| 878 | 876 |
| 879 #if defined(OS_LINUX) | 877 #if defined(OS_LINUX) |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1739 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
| 1742 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1740 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
| 1743 | 1741 |
| 1744 // Run the main (also UI) message loop until the host no longer needs it. | 1742 // Run the main (also UI) message loop until the host no longer needs it. |
| 1745 message_loop.Run(); | 1743 message_loop.Run(); |
| 1746 | 1744 |
| 1747 return exit_code; | 1745 return exit_code; |
| 1748 } | 1746 } |
| 1749 | 1747 |
| 1750 } // namespace remoting | 1748 } // namespace remoting |
| OLD | NEW |