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