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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 // network thread. base::GetLinuxDistro() caches the result. | 1621 // network thread. base::GetLinuxDistro() caches the result. |
1622 base::GetLinuxDistro(); | 1622 base::GetLinuxDistro(); |
1623 #endif | 1623 #endif |
1624 | 1624 |
1625 // Enable support for SSL server sockets, which must be done while still | 1625 // Enable support for SSL server sockets, which must be done while still |
1626 // single-threaded. | 1626 // single-threaded. |
1627 net::EnableSSLServerSockets(); | 1627 net::EnableSSLServerSockets(); |
1628 | 1628 |
1629 // Create the main message loop and start helper threads. | 1629 // Create the main message loop and start helper threads. |
1630 base::MessageLoopForUI message_loop; | 1630 base::MessageLoopForUI message_loop; |
1631 scoped_ptr<ChromotingHostContext> context = | 1631 scoped_ptr<ChromotingHostContext> context = ChromotingHostContext::Create( |
1632 ChromotingHostContext::Create(new AutoThreadTaskRunner( | 1632 new AutoThreadTaskRunner(message_loop.task_runner(), |
1633 message_loop.task_runner(), base::MessageLoop::QuitClosure())); | 1633 base::MessageLoop::QuitWhenIdleClosure())); |
1634 if (!context) | 1634 if (!context) |
1635 return kInitializationFailed; | 1635 return kInitializationFailed; |
1636 | 1636 |
1637 // NetworkChangeNotifier must be initialized after MessageLoop. | 1637 // NetworkChangeNotifier must be initialized after MessageLoop. |
1638 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( | 1638 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( |
1639 net::NetworkChangeNotifier::Create()); | 1639 net::NetworkChangeNotifier::Create()); |
1640 | 1640 |
1641 // Create & start the HostProcess using these threads. | 1641 // Create & start the HostProcess using these threads. |
1642 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). | 1642 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). |
1643 // Remove this hack as part of the multi-process refactoring. | 1643 // Remove this hack as part of the multi-process refactoring. |
1644 int exit_code = kSuccessExitCode; | 1644 int exit_code = kSuccessExitCode; |
1645 ShutdownWatchdog shutdown_watchdog( | 1645 ShutdownWatchdog shutdown_watchdog( |
1646 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1646 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
1647 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); | 1647 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); |
1648 | 1648 |
1649 // Run the main (also UI) message loop until the host no longer needs it. | 1649 // Run the main (also UI) message loop until the host no longer needs it. |
1650 message_loop.Run(); | 1650 message_loop.Run(); |
1651 | 1651 |
1652 return exit_code; | 1652 return exit_code; |
1653 } | 1653 } |
1654 | 1654 |
1655 } // namespace remoting | 1655 } // namespace remoting |
OLD | NEW |