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 #include "remoting/protocol/libjingle_transport_factory.h" | 5 #include "remoting/protocol/libjingle_transport_factory.h" |
6 | 6 |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "jingle/glue/channel_socket_adapter.h" | 9 #include "jingle/glue/channel_socket_adapter.h" |
10 #include "jingle/glue/pseudotcp_adapter.h" | 10 #include "jingle/glue/pseudotcp_adapter.h" |
| 11 #include "jingle/glue/thread_wrapper.h" |
11 #include "jingle/glue/utils.h" | 12 #include "jingle/glue/utils.h" |
12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
13 #include "remoting/base/constants.h" | 14 #include "remoting/base/constants.h" |
14 #include "remoting/protocol/channel_authenticator.h" | 15 #include "remoting/protocol/channel_authenticator.h" |
15 #include "remoting/protocol/transport_config.h" | 16 #include "remoting/protocol/transport_config.h" |
16 #include "third_party/libjingle/source/talk/base/basicpacketsocketfactory.h" | 17 #include "remoting/jingle_glue/chromium_socket_factory.h" |
17 #include "third_party/libjingle/source/talk/base/network.h" | 18 #include "third_party/libjingle/source/talk/base/network.h" |
18 #include "third_party/libjingle/source/talk/p2p/base/constants.h" | 19 #include "third_party/libjingle/source/talk/p2p/base/constants.h" |
19 #include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h" | 20 #include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h" |
20 #include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h" | 21 #include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h" |
21 #include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" | 22 #include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" |
22 | 23 |
23 namespace remoting { | 24 namespace remoting { |
24 namespace protocol { | 25 namespace protocol { |
25 | 26 |
26 namespace { | 27 namespace { |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 } | 305 } |
305 | 306 |
306 } // namespace | 307 } // namespace |
307 | 308 |
308 LibjingleTransportFactory::LibjingleTransportFactory( | 309 LibjingleTransportFactory::LibjingleTransportFactory( |
309 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator, | 310 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator, |
310 bool incoming_only) | 311 bool incoming_only) |
311 : http_port_allocator_(port_allocator.get()), | 312 : http_port_allocator_(port_allocator.get()), |
312 port_allocator_(port_allocator.Pass()), | 313 port_allocator_(port_allocator.Pass()), |
313 incoming_only_(incoming_only) { | 314 incoming_only_(incoming_only) { |
| 315 jingle_glue::JingleThreadWrapper::EnsureForCurrentThread(); |
314 } | 316 } |
315 | 317 |
316 LibjingleTransportFactory::LibjingleTransportFactory() | 318 LibjingleTransportFactory::LibjingleTransportFactory() |
317 : network_manager_(new talk_base::BasicNetworkManager()), | 319 : network_manager_(new talk_base::BasicNetworkManager()), |
318 socket_factory_(new talk_base::BasicPacketSocketFactory()), | 320 socket_factory_(new remoting::ChromiumPacketSocketFactory()), |
319 http_port_allocator_(NULL), | 321 http_port_allocator_(NULL), |
320 port_allocator_(new cricket::BasicPortAllocator( | 322 port_allocator_(new cricket::BasicPortAllocator( |
321 network_manager_.get(), socket_factory_.get())), | 323 network_manager_.get(), socket_factory_.get())), |
322 incoming_only_(false) { | 324 incoming_only_(false) { |
| 325 jingle_glue::JingleThreadWrapper::EnsureForCurrentThread(); |
323 port_allocator_->set_flags( | 326 port_allocator_->set_flags( |
324 cricket::PORTALLOCATOR_DISABLE_TCP | | 327 cricket::PORTALLOCATOR_DISABLE_TCP | |
325 cricket::PORTALLOCATOR_DISABLE_STUN | | 328 cricket::PORTALLOCATOR_DISABLE_STUN | |
326 cricket::PORTALLOCATOR_DISABLE_RELAY | | 329 cricket::PORTALLOCATOR_DISABLE_RELAY | |
327 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG); | 330 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG); |
328 } | 331 } |
329 | 332 |
330 LibjingleTransportFactory::~LibjingleTransportFactory() { | 333 LibjingleTransportFactory::~LibjingleTransportFactory() { |
331 // This method may be called in response to a libjingle signal, so | 334 // This method may be called in response to a libjingle signal, so |
332 // libjingle objects must be deleted asynchronously. | 335 // libjingle objects must be deleted asynchronously. |
(...skipping 30 matching lines...) Expand all Loading... |
363 } | 366 } |
364 | 367 |
365 scoped_ptr<DatagramTransport> | 368 scoped_ptr<DatagramTransport> |
366 LibjingleTransportFactory::CreateDatagramTransport() { | 369 LibjingleTransportFactory::CreateDatagramTransport() { |
367 NOTIMPLEMENTED(); | 370 NOTIMPLEMENTED(); |
368 return scoped_ptr<DatagramTransport>(NULL); | 371 return scoped_ptr<DatagramTransport>(NULL); |
369 } | 372 } |
370 | 373 |
371 } // namespace protocol | 374 } // namespace protocol |
372 } // namespace remoting | 375 } // namespace remoting |
OLD | NEW |