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

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

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 8 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/dns/mdns_client_impl.h ('k') | net/dns/mock_host_resolver.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 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/stl_util.h" 11 #include "base/stl_util.h"
13 #include "base/time/clock.h" 12 #include "base/time/clock.h"
14 #include "base/time/default_clock.h" 13 #include "base/time/default_clock.h"
15 #include "base/time/time.h" 14 #include "base/time/time.h"
16 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
17 #include "net/base/dns_util.h" 16 #include "net/base/dns_util.h"
18 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
19 #include "net/base/rand_callback.h" 18 #include "net/base/rand_callback.h"
20 #include "net/dns/dns_protocol.h" 19 #include "net/dns/dns_protocol.h"
21 #include "net/dns/record_rdata.h" 20 #include "net/dns/record_rdata.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 if (listener_map_iterator == listeners_.end()) return; 333 if (listener_map_iterator == listeners_.end()) return;
335 334
336 FOR_EACH_OBSERVER(MDnsListenerImpl, *listener_map_iterator->second, 335 FOR_EACH_OBSERVER(MDnsListenerImpl, *listener_map_iterator->second,
337 HandleRecordUpdate(update_type, record)); 336 HandleRecordUpdate(update_type, record));
338 } 337 }
339 338
340 void MDnsClientImpl::Core::AddListener( 339 void MDnsClientImpl::Core::AddListener(
341 MDnsListenerImpl* listener) { 340 MDnsListenerImpl* listener) {
342 ListenerKey key(listener->GetName(), listener->GetType()); 341 ListenerKey key(listener->GetName(), listener->GetType());
343 std::pair<ListenerMap::iterator, bool> observer_insert_result = 342 std::pair<ListenerMap::iterator, bool> observer_insert_result =
344 listeners_.insert( 343 listeners_.insert(make_pair(
345 make_pair(key, static_cast<ObserverList<MDnsListenerImpl>*>(NULL))); 344 key, static_cast<base::ObserverList<MDnsListenerImpl>*>(NULL)));
346 345
347 // If an equivalent key does not exist, actually create the observer list. 346 // If an equivalent key does not exist, actually create the observer list.
348 if (observer_insert_result.second) 347 if (observer_insert_result.second) {
349 observer_insert_result.first->second = new ObserverList<MDnsListenerImpl>(); 348 observer_insert_result.first->second =
349 new base::ObserverList<MDnsListenerImpl>();
350 }
350 351
351 ObserverList<MDnsListenerImpl>* observer_list = 352 base::ObserverList<MDnsListenerImpl>* observer_list =
352 observer_insert_result.first->second; 353 observer_insert_result.first->second;
353 354
354 observer_list->AddObserver(listener); 355 observer_list->AddObserver(listener);
355 } 356 }
356 357
357 void MDnsClientImpl::Core::RemoveListener(MDnsListenerImpl* listener) { 358 void MDnsClientImpl::Core::RemoveListener(MDnsListenerImpl* listener) {
358 ListenerKey key(listener->GetName(), listener->GetType()); 359 ListenerKey key(listener->GetName(), listener->GetType());
359 ListenerMap::iterator observer_list_iterator = listeners_.find(key); 360 ListenerMap::iterator observer_list_iterator = listeners_.find(key);
360 361
361 DCHECK(observer_list_iterator != listeners_.end()); 362 DCHECK(observer_list_iterator != listeners_.end());
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 739
739 void MDnsTransactionImpl::OnNsecRecord(const std::string& name, unsigned type) { 740 void MDnsTransactionImpl::OnNsecRecord(const std::string& name, unsigned type) {
740 TriggerCallback(RESULT_NSEC, NULL); 741 TriggerCallback(RESULT_NSEC, NULL);
741 } 742 }
742 743
743 void MDnsTransactionImpl::OnCachePurged() { 744 void MDnsTransactionImpl::OnCachePurged() {
744 // TODO(noamsml): Cache purge situations not yet implemented 745 // TODO(noamsml): Cache purge situations not yet implemented
745 } 746 }
746 747
747 } // namespace net 748 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/mdns_client_impl.h ('k') | net/dns/mock_host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698