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

Side by Side Diff: third_party/WebKit/Source/modules/geolocation/GeolocationWatchers.cpp

Issue 2671933002: Migrate WTF::HashMap::add() to ::insert() (Closed)
Patch Set: rebase, add TODOs Created 3 years, 10 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 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 "modules/geolocation/GeolocationWatchers.h" 5 #include "modules/geolocation/GeolocationWatchers.h"
6 6
7 #include "modules/geolocation/GeoNotifier.h" 7 #include "modules/geolocation/GeoNotifier.h"
8 #include "wtf/Assertions.h" 8 #include "wtf/Assertions.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 DEFINE_TRACE(GeolocationWatchers) { 12 DEFINE_TRACE(GeolocationWatchers) {
13 visitor->trace(m_idToNotifierMap); 13 visitor->trace(m_idToNotifierMap);
14 visitor->trace(m_notifierToIdMap); 14 visitor->trace(m_notifierToIdMap);
15 } 15 }
16 16
17 bool GeolocationWatchers::add(int id, GeoNotifier* notifier) { 17 bool GeolocationWatchers::add(int id, GeoNotifier* notifier) {
18 DCHECK_GT(id, 0); 18 DCHECK_GT(id, 0);
19 if (!m_idToNotifierMap.add(id, notifier).isNewEntry) 19 if (!m_idToNotifierMap.insert(id, notifier).isNewEntry)
20 return false; 20 return false;
21 m_notifierToIdMap.set(notifier, id); 21 m_notifierToIdMap.set(notifier, id);
22 return true; 22 return true;
23 } 23 }
24 24
25 GeoNotifier* GeolocationWatchers::find(int id) { 25 GeoNotifier* GeolocationWatchers::find(int id) {
26 DCHECK_GT(id, 0); 26 DCHECK_GT(id, 0);
27 IdToNotifierMap::iterator iter = m_idToNotifierMap.find(id); 27 IdToNotifierMap::iterator iter = m_idToNotifierMap.find(id);
28 if (iter == m_idToNotifierMap.end()) 28 if (iter == m_idToNotifierMap.end())
29 return 0; 29 return 0;
(...skipping 29 matching lines...) Expand all
59 bool GeolocationWatchers::isEmpty() const { 59 bool GeolocationWatchers::isEmpty() const {
60 return m_idToNotifierMap.isEmpty(); 60 return m_idToNotifierMap.isEmpty();
61 } 61 }
62 62
63 void GeolocationWatchers::getNotifiersVector( 63 void GeolocationWatchers::getNotifiersVector(
64 HeapVector<Member<GeoNotifier>>& copy) const { 64 HeapVector<Member<GeoNotifier>>& copy) const {
65 copyValuesToVector(m_idToNotifierMap, copy); 65 copyValuesToVector(m_idToNotifierMap, copy);
66 } 66 }
67 67
68 } // namespace blink 68 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698