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/base64.h" | 7 #include "base/base64.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
13 #include "jingle/glue/channel_socket_adapter.h" | 13 #include "jingle/glue/channel_socket_adapter.h" |
14 #include "jingle/glue/pseudotcp_adapter.h" | 14 #include "jingle/glue/pseudotcp_adapter.h" |
15 #include "jingle/glue/thread_wrapper.h" | |
16 #include "jingle/glue/utils.h" | 15 #include "jingle/glue/utils.h" |
17 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
18 #include "remoting/base/constants.h" | 17 #include "remoting/base/constants.h" |
19 #include "remoting/jingle_glue/jingle_info_request.h" | 18 #include "remoting/jingle_glue/jingle_info_request.h" |
20 #include "remoting/jingle_glue/network_settings.h" | 19 #include "remoting/jingle_glue/network_settings.h" |
21 #include "remoting/protocol/channel_authenticator.h" | 20 #include "remoting/protocol/channel_authenticator.h" |
22 #include "third_party/libjingle/source/talk/base/network.h" | 21 #include "third_party/libjingle/source/talk/base/network.h" |
23 #include "third_party/libjingle/source/talk/p2p/base/constants.h" | 22 #include "third_party/libjingle/source/talk/p2p/base/constants.h" |
24 #include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h" | 23 #include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h" |
25 #include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h" | 24 #include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 416 |
418 } // namespace | 417 } // namespace |
419 | 418 |
420 LibjingleTransportFactory::LibjingleTransportFactory( | 419 LibjingleTransportFactory::LibjingleTransportFactory( |
421 SignalStrategy* signal_strategy, | 420 SignalStrategy* signal_strategy, |
422 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator, | 421 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator, |
423 const NetworkSettings& network_settings) | 422 const NetworkSettings& network_settings) |
424 : signal_strategy_(signal_strategy), | 423 : signal_strategy_(signal_strategy), |
425 port_allocator_(port_allocator.Pass()), | 424 port_allocator_(port_allocator.Pass()), |
426 network_settings_(network_settings) { | 425 network_settings_(network_settings) { |
427 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | |
428 } | 426 } |
429 | 427 |
430 LibjingleTransportFactory::~LibjingleTransportFactory() { | 428 LibjingleTransportFactory::~LibjingleTransportFactory() { |
431 // This method may be called in response to a libjingle signal, so | 429 // This method may be called in response to a libjingle signal, so |
432 // libjingle objects must be deleted asynchronously. | 430 // libjingle objects must be deleted asynchronously. |
433 scoped_refptr<base::SingleThreadTaskRunner> task_runner = | 431 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
434 base::ThreadTaskRunnerHandle::Get(); | 432 base::ThreadTaskRunnerHandle::Get(); |
435 task_runner->DeleteSoon(FROM_HERE, port_allocator_.release()); | 433 task_runner->DeleteSoon(FROM_HERE, port_allocator_.release()); |
436 } | 434 } |
437 | 435 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 last_jingle_info_update_time_ = base::TimeTicks::Now(); | 495 last_jingle_info_update_time_ = base::TimeTicks::Now(); |
498 | 496 |
499 while (!on_jingle_info_callbacks_.empty()) { | 497 while (!on_jingle_info_callbacks_.empty()) { |
500 on_jingle_info_callbacks_.begin()->Run(); | 498 on_jingle_info_callbacks_.begin()->Run(); |
501 on_jingle_info_callbacks_.pop_front(); | 499 on_jingle_info_callbacks_.pop_front(); |
502 } | 500 } |
503 } | 501 } |
504 | 502 |
505 } // namespace protocol | 503 } // namespace protocol |
506 } // namespace remoting | 504 } // namespace remoting |
OLD | NEW |