OLD | NEW |
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 { |
(...skipping 17 matching lines...) Expand all Loading... |
28 if (iter == m_idToNotifierMap.end()) | 28 if (iter == m_idToNotifierMap.end()) |
29 return 0; | 29 return 0; |
30 return iter->value; | 30 return iter->value; |
31 } | 31 } |
32 | 32 |
33 void GeolocationWatchers::remove(int id) { | 33 void GeolocationWatchers::remove(int id) { |
34 DCHECK_GT(id, 0); | 34 DCHECK_GT(id, 0); |
35 IdToNotifierMap::iterator iter = m_idToNotifierMap.find(id); | 35 IdToNotifierMap::iterator iter = m_idToNotifierMap.find(id); |
36 if (iter == m_idToNotifierMap.end()) | 36 if (iter == m_idToNotifierMap.end()) |
37 return; | 37 return; |
38 m_notifierToIdMap.remove(iter->value); | 38 m_notifierToIdMap.erase(iter->value); |
39 m_idToNotifierMap.remove(iter); | 39 m_idToNotifierMap.remove(iter); |
40 } | 40 } |
41 | 41 |
42 void GeolocationWatchers::remove(GeoNotifier* notifier) { | 42 void GeolocationWatchers::remove(GeoNotifier* notifier) { |
43 NotifierToIdMap::iterator iter = m_notifierToIdMap.find(notifier); | 43 NotifierToIdMap::iterator iter = m_notifierToIdMap.find(notifier); |
44 if (iter == m_notifierToIdMap.end()) | 44 if (iter == m_notifierToIdMap.end()) |
45 return; | 45 return; |
46 m_idToNotifierMap.remove(iter->value); | 46 m_idToNotifierMap.erase(iter->value); |
47 m_notifierToIdMap.remove(iter); | 47 m_notifierToIdMap.remove(iter); |
48 } | 48 } |
49 | 49 |
50 bool GeolocationWatchers::contains(GeoNotifier* notifier) const { | 50 bool GeolocationWatchers::contains(GeoNotifier* notifier) const { |
51 return m_notifierToIdMap.contains(notifier); | 51 return m_notifierToIdMap.contains(notifier); |
52 } | 52 } |
53 | 53 |
54 void GeolocationWatchers::clear() { | 54 void GeolocationWatchers::clear() { |
55 m_idToNotifierMap.clear(); | 55 m_idToNotifierMap.clear(); |
56 m_notifierToIdMap.clear(); | 56 m_notifierToIdMap.clear(); |
57 } | 57 } |
58 | 58 |
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 |
OLD | NEW |