| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 DCHECK(peer2->main_thread_->BelongsToCurrentThread()); | 25 DCHECK(peer2->main_thread_->BelongsToCurrentThread()); |
| 26 peer1->ConnectTo(peer2); | 26 peer1->ConnectTo(peer2); |
| 27 peer2->ConnectTo(peer1); | 27 peer2->ConnectTo(peer1); |
| 28 } | 28 } |
| 29 | 29 |
| 30 FakeSignalStrategy::FakeSignalStrategy(const std::string& jid) | 30 FakeSignalStrategy::FakeSignalStrategy(const std::string& jid) |
| 31 : main_thread_(base::ThreadTaskRunnerHandle::Get()), | 31 : main_thread_(base::ThreadTaskRunnerHandle::Get()), |
| 32 jid_(jid), | 32 jid_(jid), |
| 33 last_id_(0), | 33 last_id_(0), |
| 34 weak_factory_(this) { | 34 weak_factory_(this) { |
| 35 DetachFromThread(); |
| 35 } | 36 } |
| 36 | 37 |
| 37 FakeSignalStrategy::~FakeSignalStrategy() { | 38 FakeSignalStrategy::~FakeSignalStrategy() { |
| 38 while (!received_messages_.empty()) { | 39 while (!received_messages_.empty()) { |
| 39 delete received_messages_.front(); | 40 delete received_messages_.front(); |
| 40 received_messages_.pop_front(); | 41 received_messages_.pop_front(); |
| 41 } | 42 } |
| 42 } | 43 } |
| 43 | 44 |
| 44 void FakeSignalStrategy::ConnectTo(FakeSignalStrategy* peer) { | 45 void FakeSignalStrategy::ConnectTo(FakeSignalStrategy* peer) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (listener->OnSignalStrategyIncomingStanza(stanza_ptr)) | 152 if (listener->OnSignalStrategyIncomingStanza(stanza_ptr)) |
| 152 break; | 153 break; |
| 153 } | 154 } |
| 154 } | 155 } |
| 155 | 156 |
| 156 void FakeSignalStrategy::SetPeerCallback(const PeerCallback& peer_callback) { | 157 void FakeSignalStrategy::SetPeerCallback(const PeerCallback& peer_callback) { |
| 157 peer_callback_ = peer_callback; | 158 peer_callback_ = peer_callback; |
| 158 } | 159 } |
| 159 | 160 |
| 160 } // namespace remoting | 161 } // namespace remoting |
| OLD | NEW |