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

Side by Side Diff: net/dns/mdns_client_impl.cc

Issue 2423713002: Remove usage of FOR_EACH_OBSERVER macro in net (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
« no previous file with comments | « net/cert/sth_distributor.cc ('k') | net/log/net_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/dns/mdns_client_impl.h" 5 #include "net/dns/mdns_client_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <queue> 8 #include <queue>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 DCHECK(record_removed); 316 DCHECK(record_removed);
317 OnRecordRemoved(record_removed.get()); 317 OnRecordRemoved(record_removed.get());
318 } 318 }
319 } 319 }
320 320
321 // Alert all listeners waiting for the nonexistent RR types. 321 // Alert all listeners waiting for the nonexistent RR types.
322 ListenerMap::iterator i = 322 ListenerMap::iterator i =
323 listeners_.upper_bound(ListenerKey(record->name(), 0)); 323 listeners_.upper_bound(ListenerKey(record->name(), 0));
324 for (; i != listeners_.end() && i->first.first == record->name(); i++) { 324 for (; i != listeners_.end() && i->first.first == record->name(); i++) {
325 if (!rdata->GetBit(i->first.second)) { 325 if (!rdata->GetBit(i->first.second)) {
326 FOR_EACH_OBSERVER(MDnsListenerImpl, *i->second, AlertNsecRecord()); 326 for (auto& observer : *i->second)
327 observer.AlertNsecRecord();
327 } 328 }
328 } 329 }
329 } 330 }
330 331
331 void MDnsClientImpl::Core::OnConnectionError(int error) { 332 void MDnsClientImpl::Core::OnConnectionError(int error) {
332 // TODO(noamsml): On connection error, recreate connection and flush cache. 333 // TODO(noamsml): On connection error, recreate connection and flush cache.
333 VLOG(1) << "MDNS OnConnectionError (code: " << error << ")"; 334 VLOG(1) << "MDNS OnConnectionError (code: " << error << ")";
334 } 335 }
335 336
336 void MDnsClientImpl::Core::AlertListeners( 337 void MDnsClientImpl::Core::AlertListeners(
337 MDnsCache::UpdateType update_type, 338 MDnsCache::UpdateType update_type,
338 const ListenerKey& key, 339 const ListenerKey& key,
339 const RecordParsed* record) { 340 const RecordParsed* record) {
340 ListenerMap::iterator listener_map_iterator = listeners_.find(key); 341 ListenerMap::iterator listener_map_iterator = listeners_.find(key);
341 if (listener_map_iterator == listeners_.end()) return; 342 if (listener_map_iterator == listeners_.end()) return;
342 343
343 FOR_EACH_OBSERVER(MDnsListenerImpl, *listener_map_iterator->second, 344 for (auto& observer : *listener_map_iterator->second)
344 HandleRecordUpdate(update_type, record)); 345 observer.HandleRecordUpdate(update_type, record);
345 } 346 }
346 347
347 void MDnsClientImpl::Core::AddListener( 348 void MDnsClientImpl::Core::AddListener(
348 MDnsListenerImpl* listener) { 349 MDnsListenerImpl* listener) {
349 ListenerKey key(listener->GetName(), listener->GetType()); 350 ListenerKey key(listener->GetName(), listener->GetType());
350 std::pair<ListenerMap::iterator, bool> observer_insert_result = 351 std::pair<ListenerMap::iterator, bool> observer_insert_result =
351 listeners_.insert(make_pair( 352 listeners_.insert(make_pair(
352 key, static_cast<base::ObserverList<MDnsListenerImpl>*>(NULL))); 353 key, static_cast<base::ObserverList<MDnsListenerImpl>*>(NULL)));
353 354
354 // If an equivalent key does not exist, actually create the observer list. 355 // If an equivalent key does not exist, actually create the observer list.
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 749
749 void MDnsTransactionImpl::OnNsecRecord(const std::string& name, unsigned type) { 750 void MDnsTransactionImpl::OnNsecRecord(const std::string& name, unsigned type) {
750 TriggerCallback(RESULT_NSEC, NULL); 751 TriggerCallback(RESULT_NSEC, NULL);
751 } 752 }
752 753
753 void MDnsTransactionImpl::OnCachePurged() { 754 void MDnsTransactionImpl::OnCachePurged() {
754 // TODO(noamsml): Cache purge situations not yet implemented 755 // TODO(noamsml): Cache purge situations not yet implemented
755 } 756 }
756 757
757 } // namespace net 758 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/sth_distributor.cc ('k') | net/log/net_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698