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/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 scoped_ptr<ChromotingHostContext> context = | 1538 scoped_ptr<ChromotingHostContext> context = |
1539 ChromotingHostContext::Create(new AutoThreadTaskRunner( | 1539 ChromotingHostContext::Create(new AutoThreadTaskRunner( |
1540 message_loop.message_loop_proxy(), base::MessageLoop::QuitClosure())); | 1540 message_loop.message_loop_proxy(), base::MessageLoop::QuitClosure())); |
1541 if (!context) | 1541 if (!context) |
1542 return kInitializationFailed; | 1542 return kInitializationFailed; |
1543 | 1543 |
1544 // NetworkChangeNotifier must be initialized after MessageLoop. | 1544 // NetworkChangeNotifier must be initialized after MessageLoop. |
1545 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( | 1545 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( |
1546 net::NetworkChangeNotifier::Create()); | 1546 net::NetworkChangeNotifier::Create()); |
1547 | 1547 |
1548 // BasicURLRequestContext holds references to threads, so it needs to be | |
1549 // dereferences on UI threads. Store the reference to the URLRequestGetter to | |
1550 // make sure it's not destroyed on other threads. | |
1551 // TODO(sergeyu): Consider fixing it in BasicURLRequestContext. | |
1552 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = | |
1553 context->url_request_context_getter(); | |
1554 | |
1555 // Create & start the HostProcess using these threads. | 1548 // Create & start the HostProcess using these threads. |
1556 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). | 1549 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). |
1557 // Remove this hack as part of the multi-process refactoring. | 1550 // Remove this hack as part of the multi-process refactoring. |
1558 int exit_code = kSuccessExitCode; | 1551 int exit_code = kSuccessExitCode; |
1559 ShutdownWatchdog shutdown_watchdog( | 1552 ShutdownWatchdog shutdown_watchdog( |
1560 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1553 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
1561 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); | 1554 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); |
1562 | 1555 |
1563 // Run the main (also UI) message loop until the host no longer needs it. | 1556 // Run the main (also UI) message loop until the host no longer needs it. |
1564 message_loop.Run(); | 1557 message_loop.Run(); |
1565 | 1558 |
1566 return exit_code; | 1559 return exit_code; |
1567 } | 1560 } |
1568 | 1561 |
1569 } // namespace remoting | 1562 } // namespace remoting |
OLD | NEW |