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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
11 #include "jingle/glue/channel_socket_adapter.h" | 11 #include "jingle/glue/channel_socket_adapter.h" |
12 #include "jingle/glue/pseudotcp_adapter.h" | 12 #include "jingle/glue/pseudotcp_adapter.h" |
| 13 #include "jingle/glue/thread_wrapper.h" |
13 #include "jingle/glue/utils.h" | 14 #include "jingle/glue/utils.h" |
14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
15 #include "remoting/base/constants.h" | 16 #include "remoting/base/constants.h" |
16 #include "remoting/jingle_glue/jingle_info_request.h" | 17 #include "remoting/jingle_glue/jingle_info_request.h" |
17 #include "remoting/jingle_glue/network_settings.h" | 18 #include "remoting/jingle_glue/network_settings.h" |
18 #include "remoting/protocol/channel_authenticator.h" | 19 #include "remoting/protocol/channel_authenticator.h" |
19 #include "third_party/libjingle/source/talk/base/network.h" | 20 #include "third_party/libjingle/source/talk/base/network.h" |
20 #include "third_party/libjingle/source/talk/p2p/base/constants.h" | 21 #include "third_party/libjingle/source/talk/p2p/base/constants.h" |
21 #include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h" | 22 #include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h" |
22 #include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h" | 23 #include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 404 |
404 } // namespace | 405 } // namespace |
405 | 406 |
406 LibjingleTransportFactory::LibjingleTransportFactory( | 407 LibjingleTransportFactory::LibjingleTransportFactory( |
407 SignalStrategy* signal_strategy, | 408 SignalStrategy* signal_strategy, |
408 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator, | 409 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator, |
409 const NetworkSettings& network_settings) | 410 const NetworkSettings& network_settings) |
410 : signal_strategy_(signal_strategy), | 411 : signal_strategy_(signal_strategy), |
411 port_allocator_(port_allocator.Pass()), | 412 port_allocator_(port_allocator.Pass()), |
412 network_settings_(network_settings) { | 413 network_settings_(network_settings) { |
| 414 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
413 } | 415 } |
414 | 416 |
415 LibjingleTransportFactory::~LibjingleTransportFactory() { | 417 LibjingleTransportFactory::~LibjingleTransportFactory() { |
416 // This method may be called in response to a libjingle signal, so | 418 // This method may be called in response to a libjingle signal, so |
417 // libjingle objects must be deleted asynchronously. | 419 // libjingle objects must be deleted asynchronously. |
418 scoped_refptr<base::SingleThreadTaskRunner> task_runner = | 420 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
419 base::ThreadTaskRunnerHandle::Get(); | 421 base::ThreadTaskRunnerHandle::Get(); |
420 task_runner->DeleteSoon(FROM_HERE, port_allocator_.release()); | 422 task_runner->DeleteSoon(FROM_HERE, port_allocator_.release()); |
421 } | 423 } |
422 | 424 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 last_jingle_info_update_time_ = base::TimeTicks::Now(); | 483 last_jingle_info_update_time_ = base::TimeTicks::Now(); |
482 | 484 |
483 while (!on_jingle_info_callbacks_.empty()) { | 485 while (!on_jingle_info_callbacks_.empty()) { |
484 on_jingle_info_callbacks_.begin()->Run(); | 486 on_jingle_info_callbacks_.begin()->Run(); |
485 on_jingle_info_callbacks_.pop_front(); | 487 on_jingle_info_callbacks_.pop_front(); |
486 } | 488 } |
487 } | 489 } |
488 | 490 |
489 } // namespace protocol | 491 } // namespace protocol |
490 } // namespace remoting | 492 } // namespace remoting |
OLD | NEW |