OLD | NEW |
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" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 if (listener_map_iterator == listeners_.end()) return; | 334 if (listener_map_iterator == listeners_.end()) return; |
335 | 335 |
336 FOR_EACH_OBSERVER(MDnsListenerImpl, *listener_map_iterator->second, | 336 FOR_EACH_OBSERVER(MDnsListenerImpl, *listener_map_iterator->second, |
337 HandleRecordUpdate(update_type, record)); | 337 HandleRecordUpdate(update_type, record)); |
338 } | 338 } |
339 | 339 |
340 void MDnsClientImpl::Core::AddListener( | 340 void MDnsClientImpl::Core::AddListener( |
341 MDnsListenerImpl* listener) { | 341 MDnsListenerImpl* listener) { |
342 ListenerKey key(listener->GetName(), listener->GetType()); | 342 ListenerKey key(listener->GetName(), listener->GetType()); |
343 std::pair<ListenerMap::iterator, bool> observer_insert_result = | 343 std::pair<ListenerMap::iterator, bool> observer_insert_result = |
344 listeners_.insert( | 344 listeners_.insert(make_pair( |
345 make_pair(key, static_cast<ObserverList<MDnsListenerImpl>*>(NULL))); | 345 key, static_cast<base::ObserverList<MDnsListenerImpl>*>(NULL))); |
346 | 346 |
347 // If an equivalent key does not exist, actually create the observer list. | 347 // If an equivalent key does not exist, actually create the observer list. |
348 if (observer_insert_result.second) | 348 if (observer_insert_result.second) |
349 observer_insert_result.first->second = new ObserverList<MDnsListenerImpl>(); | 349 observer_insert_result.first->second = |
| 350 new base::ObserverList<MDnsListenerImpl>(); |
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 Loading... |
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 |
OLD | NEW |