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