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