| 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" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 reconnect_timer_.Start( | 229 reconnect_timer_.Start( |
| 230 FROM_HERE, base::TimeDelta::FromSeconds(kReconnectDelaySeconds), | 230 FROM_HERE, base::TimeDelta::FromSeconds(kReconnectDelaySeconds), |
| 231 this, &LibjingleTransport::TryReconnect); | 231 this, &LibjingleTransport::TryReconnect); |
| 232 | 232 |
| 233 base::ThreadTaskRunnerHandle::Get()->PostTask( | 233 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 234 FROM_HERE, base::Bind(&LibjingleTransport::NotifyConnected, | 234 FROM_HERE, base::Bind(&LibjingleTransport::NotifyConnected, |
| 235 weak_factory_.GetWeakPtr())); | 235 weak_factory_.GetWeakPtr())); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void LibjingleTransport::NotifyConnected() { | 238 void LibjingleTransport::NotifyConnected() { |
| 239 // Create net::Socket adapter for the P2PTransportChannel. | 239 // Create P2PDatagramSocket adapter for the P2PTransportChannel. |
| 240 scoped_ptr<TransportChannelSocketAdapter> socket( | 240 scoped_ptr<TransportChannelSocketAdapter> socket( |
| 241 new TransportChannelSocketAdapter(channel_.get())); | 241 new TransportChannelSocketAdapter(channel_.get())); |
| 242 socket->SetOnDestroyedCallback(base::Bind( | 242 socket->SetOnDestroyedCallback(base::Bind( |
| 243 &LibjingleTransport::OnChannelDestroyed, base::Unretained(this))); | 243 &LibjingleTransport::OnChannelDestroyed, base::Unretained(this))); |
| 244 base::ResetAndReturn(&callback_).Run(socket.Pass()); | 244 base::ResetAndReturn(&callback_).Run(socket.Pass()); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void LibjingleTransport::SetRemoteCredentials(const std::string& ufrag, | 247 void LibjingleTransport::SetRemoteCredentials(const std::string& ufrag, |
| 248 const std::string& password) { | 248 const std::string& password) { |
| 249 DCHECK(CalledOnValidThread()); | 249 DCHECK(CalledOnValidThread()); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 last_jingle_info_update_time_ = base::TimeTicks::Now(); | 467 last_jingle_info_update_time_ = base::TimeTicks::Now(); |
| 468 | 468 |
| 469 while (!on_jingle_info_callbacks_.empty()) { | 469 while (!on_jingle_info_callbacks_.empty()) { |
| 470 on_jingle_info_callbacks_.begin()->Run(); | 470 on_jingle_info_callbacks_.begin()->Run(); |
| 471 on_jingle_info_callbacks_.pop_front(); | 471 on_jingle_info_callbacks_.pop_front(); |
| 472 } | 472 } |
| 473 } | 473 } |
| 474 | 474 |
| 475 } // namespace protocol | 475 } // namespace protocol |
| 476 } // namespace remoting | 476 } // namespace remoting |
| OLD | NEW |