Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: remoting/signaling/delegating_signal_strategy.cc

Issue 2415753002: Remove usage of base::ObserverList<T>::Iter::GetNext() in //remoting. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/delegating_signal_strategy.h" 5 #include "remoting/signaling/delegating_signal_strategy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" 10 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
(...skipping 20 matching lines...) Expand all
31 weak_factory_.GetWeakPtr(), message)); 31 weak_factory_.GetWeakPtr(), message));
32 return; 32 return;
33 } 33 }
34 34
35 std::unique_ptr<buzz::XmlElement> stanza(buzz::XmlElement::ForStr(message)); 35 std::unique_ptr<buzz::XmlElement> stanza(buzz::XmlElement::ForStr(message));
36 if (!stanza.get()) { 36 if (!stanza.get()) {
37 LOG(WARNING) << "Malformed XMPP stanza received: " << message; 37 LOG(WARNING) << "Malformed XMPP stanza received: " << message;
38 return; 38 return;
39 } 39 }
40 40
41 base::ObserverListBase<Listener>::Iterator it(&listeners_); 41 for (auto& listener : listeners_) {
42 Listener* listener; 42 if (listener.OnSignalStrategyIncomingStanza(stanza.get()))
43 while ((listener = it.GetNext()) != nullptr) {
44 if (listener->OnSignalStrategyIncomingStanza(stanza.get()))
45 break; 43 break;
46 } 44 }
47 } 45 }
48 46
49 void DelegatingSignalStrategy::Connect() { 47 void DelegatingSignalStrategy::Connect() {
50 DCHECK(client_task_runner_->BelongsToCurrentThread()); 48 DCHECK(client_task_runner_->BelongsToCurrentThread());
51 FOR_EACH_OBSERVER(Listener, listeners_, 49 FOR_EACH_OBSERVER(Listener, listeners_,
52 OnSignalStrategyStateChange(CONNECTED)); 50 OnSignalStrategyStateChange(CONNECTED));
53 } 51 }
54 52
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 delegate_task_runner_->PostTask(FROM_HERE, 86 delegate_task_runner_->PostTask(FROM_HERE,
89 base::Bind(send_iq_callback_, stanza->Str())); 87 base::Bind(send_iq_callback_, stanza->Str()));
90 return true; 88 return true;
91 } 89 }
92 90
93 std::string DelegatingSignalStrategy::GetNextId() { 91 std::string DelegatingSignalStrategy::GetNextId() {
94 return base::Uint64ToString(base::RandUint64()); 92 return base::Uint64ToString(base::RandUint64());
95 } 93 }
96 94
97 } // namespace remoting 95 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/register_support_host_request_unittest.cc ('k') | remoting/signaling/fake_signal_strategy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698