| 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 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 // Required for any calls into GTK functions, such as the Disconnect and | 1548 // Required for any calls into GTK functions, such as the Disconnect and |
| 1549 // Continue windows, though these should not be used for the Me2Me case | 1549 // Continue windows, though these should not be used for the Me2Me case |
| 1550 // (crbug.com/104377). | 1550 // (crbug.com/104377). |
| 1551 gtk_init(nullptr, nullptr); | 1551 gtk_init(nullptr, nullptr); |
| 1552 #endif | 1552 #endif |
| 1553 | 1553 |
| 1554 // Enable support for SSL server sockets, which must be done while still | 1554 // Enable support for SSL server sockets, which must be done while still |
| 1555 // single-threaded. | 1555 // single-threaded. |
| 1556 net::EnableSSLServerSockets(); | 1556 net::EnableSSLServerSockets(); |
| 1557 | 1557 |
| 1558 // Ensures that media library and specific CPU features are initialized. | 1558 // Ensures runtime specific CPU features are initialized. |
| 1559 media::InitializeMediaLibrary(); | 1559 media::InitializeCPUSpecificMediaFeatures(); |
| 1560 | 1560 |
| 1561 // Create the main message loop and start helper threads. | 1561 // Create the main message loop and start helper threads. |
| 1562 base::MessageLoopForUI message_loop; | 1562 base::MessageLoopForUI message_loop; |
| 1563 scoped_ptr<ChromotingHostContext> context = | 1563 scoped_ptr<ChromotingHostContext> context = |
| 1564 ChromotingHostContext::Create(new AutoThreadTaskRunner( | 1564 ChromotingHostContext::Create(new AutoThreadTaskRunner( |
| 1565 message_loop.message_loop_proxy(), base::MessageLoop::QuitClosure())); | 1565 message_loop.message_loop_proxy(), base::MessageLoop::QuitClosure())); |
| 1566 if (!context) | 1566 if (!context) |
| 1567 return kInitializationFailed; | 1567 return kInitializationFailed; |
| 1568 | 1568 |
| 1569 // NetworkChangeNotifier must be initialized after MessageLoop. | 1569 // NetworkChangeNotifier must be initialized after MessageLoop. |
| 1570 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( | 1570 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( |
| 1571 net::NetworkChangeNotifier::Create()); | 1571 net::NetworkChangeNotifier::Create()); |
| 1572 | 1572 |
| 1573 // Create & start the HostProcess using these threads. | 1573 // Create & start the HostProcess using these threads. |
| 1574 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). | 1574 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). |
| 1575 // Remove this hack as part of the multi-process refactoring. | 1575 // Remove this hack as part of the multi-process refactoring. |
| 1576 int exit_code = kSuccessExitCode; | 1576 int exit_code = kSuccessExitCode; |
| 1577 ShutdownWatchdog shutdown_watchdog( | 1577 ShutdownWatchdog shutdown_watchdog( |
| 1578 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1578 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
| 1579 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); | 1579 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); |
| 1580 | 1580 |
| 1581 // Run the main (also UI) message loop until the host no longer needs it. | 1581 // Run the main (also UI) message loop until the host no longer needs it. |
| 1582 message_loop.Run(); | 1582 message_loop.Run(); |
| 1583 | 1583 |
| 1584 return exit_code; | 1584 return exit_code; |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 } // namespace remoting | 1587 } // namespace remoting |
| OLD | NEW |