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 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 // set in policy. | 1494 // set in policy. |
1495 network_settings.port_range.min_port = NetworkSettings::kDefaultMinPort; | 1495 network_settings.port_range.min_port = NetworkSettings::kDefaultMinPort; |
1496 network_settings.port_range.max_port = NetworkSettings::kDefaultMaxPort; | 1496 network_settings.port_range.max_port = NetworkSettings::kDefaultMaxPort; |
1497 } | 1497 } |
1498 | 1498 |
1499 scoped_ptr<protocol::SessionManager> session_manager; | 1499 scoped_ptr<protocol::SessionManager> session_manager; |
1500 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kEnableWebrtc)) { | 1500 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kEnableWebrtc)) { |
1501 #if !defined(NDEBUG) | 1501 #if !defined(NDEBUG) |
1502 network_settings.flags = protocol::NetworkSettings::NAT_TRAVERSAL_OUTGOING; | 1502 network_settings.flags = protocol::NetworkSettings::NAT_TRAVERSAL_OUTGOING; |
1503 | 1503 |
1504 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 1504 scoped_ptr<protocol::PortAllocatorFactory> port_allocator_factory = |
1505 port_allocator_factory = protocol::ChromiumPortAllocatorFactory::Create( | 1505 protocol::ChromiumPortAllocatorFactory::Create( |
1506 network_settings, context_->url_request_context_getter()); | 1506 network_settings, context_->url_request_context_getter()); |
1507 | 1507 |
1508 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | 1508 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
1509 | 1509 |
1510 // The network thread is also used as worker thread for webrtc. | 1510 // The network thread is also used as worker thread for webrtc. |
1511 // | 1511 // |
1512 // TODO(sergeyu): Figure out if we would benefit from using a separate | 1512 // TODO(sergeyu): Figure out if we would benefit from using a separate |
1513 // thread as a worker thread. | 1513 // thread as a worker thread. |
1514 scoped_ptr<protocol::TransportFactory> transport_factory( | 1514 scoped_ptr<protocol::TransportFactory> transport_factory( |
1515 new protocol::WebrtcTransportFactory( | 1515 new protocol::WebrtcTransportFactory( |
1516 jingle_glue::JingleThreadWrapper::current(), signal_strategy_.get(), | 1516 jingle_glue::JingleThreadWrapper::current(), signal_strategy_.get(), |
1517 port_allocator_factory, protocol::TransportRole::SERVER)); | 1517 std::move(port_allocator_factory), |
| 1518 protocol::TransportRole::SERVER)); |
1518 | 1519 |
1519 session_manager.reset( | 1520 session_manager.reset( |
1520 new protocol::JingleSessionManager(transport_factory.Pass())); | 1521 new protocol::JingleSessionManager(transport_factory.Pass())); |
1521 #else // !defined(NDEBUG) | 1522 #else // !defined(NDEBUG) |
1522 LOG(ERROR) << "WebRTC is enabled only in debug builds."; | 1523 LOG(ERROR) << "WebRTC is enabled only in debug builds."; |
1523 ShutdownHost(kUsageExitCode); | 1524 ShutdownHost(kUsageExitCode); |
1524 return; | 1525 return; |
1525 #endif // defined(NDEBUG) | 1526 #endif // defined(NDEBUG) |
1526 } else { | 1527 } else { |
1527 session_manager = | 1528 session_manager = |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1750 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1751 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
1751 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); | 1752 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); |
1752 | 1753 |
1753 // Run the main (also UI) message loop until the host no longer needs it. | 1754 // Run the main (also UI) message loop until the host no longer needs it. |
1754 message_loop.Run(); | 1755 message_loop.Run(); |
1755 | 1756 |
1756 return exit_code; | 1757 return exit_code; |
1757 } | 1758 } |
1758 | 1759 |
1759 } // namespace remoting | 1760 } // namespace remoting |
OLD | NEW |