Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "jingle/glue/utils.h" | 14 #include "jingle/glue/utils.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "remoting/protocol/channel_socket_adapter.h" | 16 #include "remoting/protocol/channel_socket_adapter.h" |
| 17 #include "remoting/protocol/network_settings.h" | 17 #include "remoting/protocol/network_settings.h" |
| 18 #include "remoting/protocol/p2p_socket.h" | |
|
Wez
2015/06/22 15:49:07
Doesn't look like you need this include here?
Sergey Ulanov
2015/07/10 00:49:54
Done.
| |
| 18 #include "remoting/signaling/jingle_info_request.h" | 19 #include "remoting/signaling/jingle_info_request.h" |
| 19 #include "third_party/webrtc/base/network.h" | 20 #include "third_party/webrtc/base/network.h" |
| 20 #include "third_party/webrtc/p2p/base/constants.h" | 21 #include "third_party/webrtc/p2p/base/constants.h" |
| 21 #include "third_party/webrtc/p2p/base/p2ptransportchannel.h" | 22 #include "third_party/webrtc/p2p/base/p2ptransportchannel.h" |
| 22 #include "third_party/webrtc/p2p/base/port.h" | 23 #include "third_party/webrtc/p2p/base/port.h" |
| 23 #include "third_party/webrtc/p2p/client/basicportallocator.h" | 24 #include "third_party/webrtc/p2p/client/basicportallocator.h" |
| 24 #include "third_party/webrtc/p2p/client/httpportallocator.h" | 25 #include "third_party/webrtc/p2p/client/httpportallocator.h" |
| 25 | 26 |
| 26 namespace remoting { | 27 namespace remoting { |
| 27 namespace protocol { | 28 namespace protocol { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 reconnect_timer_.Start( | 230 reconnect_timer_.Start( |
| 230 FROM_HERE, base::TimeDelta::FromSeconds(kReconnectDelaySeconds), | 231 FROM_HERE, base::TimeDelta::FromSeconds(kReconnectDelaySeconds), |
| 231 this, &LibjingleTransport::TryReconnect); | 232 this, &LibjingleTransport::TryReconnect); |
| 232 | 233 |
| 233 base::ThreadTaskRunnerHandle::Get()->PostTask( | 234 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 234 FROM_HERE, base::Bind(&LibjingleTransport::NotifyConnected, | 235 FROM_HERE, base::Bind(&LibjingleTransport::NotifyConnected, |
| 235 weak_factory_.GetWeakPtr())); | 236 weak_factory_.GetWeakPtr())); |
| 236 } | 237 } |
| 237 | 238 |
| 238 void LibjingleTransport::NotifyConnected() { | 239 void LibjingleTransport::NotifyConnected() { |
| 239 // Create net::Socket adapter for the P2PTransportChannel. | 240 // Create P2PDatagramSocket adapter for the P2PTransportChannel. |
| 240 scoped_ptr<TransportChannelSocketAdapter> socket( | 241 scoped_ptr<TransportChannelSocketAdapter> socket( |
| 241 new TransportChannelSocketAdapter(channel_.get())); | 242 new TransportChannelSocketAdapter(channel_.get())); |
| 242 socket->SetOnDestroyedCallback(base::Bind( | 243 socket->SetOnDestroyedCallback(base::Bind( |
| 243 &LibjingleTransport::OnChannelDestroyed, base::Unretained(this))); | 244 &LibjingleTransport::OnChannelDestroyed, base::Unretained(this))); |
| 244 base::ResetAndReturn(&callback_).Run(socket.Pass()); | 245 base::ResetAndReturn(&callback_).Run(socket.Pass()); |
| 245 } | 246 } |
| 246 | 247 |
| 247 void LibjingleTransport::SetRemoteCredentials(const std::string& ufrag, | 248 void LibjingleTransport::SetRemoteCredentials(const std::string& ufrag, |
| 248 const std::string& password) { | 249 const std::string& password) { |
| 249 DCHECK(CalledOnValidThread()); | 250 DCHECK(CalledOnValidThread()); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 last_jingle_info_update_time_ = base::TimeTicks::Now(); | 468 last_jingle_info_update_time_ = base::TimeTicks::Now(); |
| 468 | 469 |
| 469 while (!on_jingle_info_callbacks_.empty()) { | 470 while (!on_jingle_info_callbacks_.empty()) { |
| 470 on_jingle_info_callbacks_.begin()->Run(); | 471 on_jingle_info_callbacks_.begin()->Run(); |
| 471 on_jingle_info_callbacks_.pop_front(); | 472 on_jingle_info_callbacks_.pop_front(); |
| 472 } | 473 } |
| 473 } | 474 } |
| 474 | 475 |
| 475 } // namespace protocol | 476 } // namespace protocol |
| 476 } // namespace remoting | 477 } // namespace remoting |
| OLD | NEW |