OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signaling/fake_signal_strategy.h" | 5 #include "remoting/signaling/fake_signal_strategy.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/location.h" | 10 #include "base/location.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
11 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
12 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
13 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
14 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 16 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
15 #include "third_party/webrtc/libjingle/xmpp/constants.h" | 17 #include "third_party/webrtc/libjingle/xmpp/constants.h" |
16 | 18 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 DCHECK(CalledOnValidThread()); | 102 DCHECK(CalledOnValidThread()); |
101 | 103 |
102 stanza->SetAttr(buzz::QN_FROM, jid_); | 104 stanza->SetAttr(buzz::QN_FROM, jid_); |
103 | 105 |
104 if (!peer_callback_.is_null()) { | 106 if (!peer_callback_.is_null()) { |
105 if (send_delay_ != base::TimeDelta()) { | 107 if (send_delay_ != base::TimeDelta()) { |
106 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 108 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
107 FROM_HERE, base::Bind(peer_callback_, base::Passed(&stanza)), | 109 FROM_HERE, base::Bind(peer_callback_, base::Passed(&stanza)), |
108 send_delay_); | 110 send_delay_); |
109 } else { | 111 } else { |
110 peer_callback_.Run(stanza.Pass()); | 112 peer_callback_.Run(std::move(stanza)); |
111 } | 113 } |
112 return true; | 114 return true; |
113 } else { | 115 } else { |
114 return false; | 116 return false; |
115 } | 117 } |
116 } | 118 } |
117 | 119 |
118 std::string FakeSignalStrategy::GetNextId() { | 120 std::string FakeSignalStrategy::GetNextId() { |
119 ++last_id_; | 121 ++last_id_; |
120 return base::IntToString(last_id_); | 122 return base::IntToString(last_id_); |
(...skipping 30 matching lines...) Expand all Loading... |
151 if (listener->OnSignalStrategyIncomingStanza(stanza_ptr)) | 153 if (listener->OnSignalStrategyIncomingStanza(stanza_ptr)) |
152 break; | 154 break; |
153 } | 155 } |
154 } | 156 } |
155 | 157 |
156 void FakeSignalStrategy::SetPeerCallback(const PeerCallback& peer_callback) { | 158 void FakeSignalStrategy::SetPeerCallback(const PeerCallback& peer_callback) { |
157 peer_callback_ = peer_callback; | 159 peer_callback_ = peer_callback; |
158 } | 160 } |
159 | 161 |
160 } // namespace remoting | 162 } // namespace remoting |
OLD | NEW |