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/GeoNotifier.h" | 5 #include "modules/geolocation/GeoNotifier.h" |
6 | 6 |
7 #include "modules/geolocation/Geolocation.h" | 7 #include "modules/geolocation/Geolocation.h" |
8 #include "modules/geolocation/PositionError.h" | 8 #include "modules/geolocation/PositionError.h" |
9 #include "modules/geolocation/PositionOptions.h" | 9 #include "modules/geolocation/PositionOptions.h" |
10 #include "platform/Histogram.h" | 10 #include "platform/Histogram.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 m_timer.stop(); | 75 m_timer.stop(); |
76 } | 76 } |
77 | 77 |
78 void GeoNotifier::timerFired(Timer<GeoNotifier>*) | 78 void GeoNotifier::timerFired(Timer<GeoNotifier>*) |
79 { | 79 { |
80 m_timer.stop(); | 80 m_timer.stop(); |
81 | 81 |
82 // Test for fatal error first. This is required for the case where the Local
Frame is | 82 // Test for fatal error first. This is required for the case where the Local
Frame is |
83 // disconnected and requests are cancelled. | 83 // disconnected and requests are cancelled. |
84 if (m_fatalError) { | 84 if (m_fatalError) { |
85 runErrorCallback(m_fatalError.get()); | 85 runErrorCallback(m_fatalError); |
86 // This will cause this notifier to be deleted. | 86 // This will cause this notifier to be deleted. |
87 m_geolocation->fatalErrorOccurred(this); | 87 m_geolocation->fatalErrorOccurred(this); |
88 return; | 88 return; |
89 } | 89 } |
90 | 90 |
91 if (m_useCachedPosition) { | 91 if (m_useCachedPosition) { |
92 // Clear the cached position flag in case this is a watch request, which | 92 // Clear the cached position flag in case this is a watch request, which |
93 // will continue to run. | 93 // will continue to run. |
94 m_useCachedPosition = false; | 94 m_useCachedPosition = false; |
95 m_geolocation->requestUsesCachedPosition(this); | 95 m_geolocation->requestUsesCachedPosition(this); |
96 return; | 96 return; |
97 } | 97 } |
98 | 98 |
99 if (m_errorCallback) | 99 if (m_errorCallback) |
100 m_errorCallback->handleEvent(PositionError::create(PositionError::TIMEOU
T, "Timeout expired")); | 100 m_errorCallback->handleEvent(PositionError::create(PositionError::TIMEOU
T, "Timeout expired")); |
101 | 101 |
102 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeoutExpiredHistogram, ("Geoloca
tion.TimeoutExpired", 0, 1000 * 60 * 10 /* 10 minute max */, 20 /* buckets */)); | 102 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeoutExpiredHistogram, ("Geoloca
tion.TimeoutExpired", 0, 1000 * 60 * 10 /* 10 minute max */, 20 /* buckets */)); |
103 timeoutExpiredHistogram.count(m_options.timeout()); | 103 timeoutExpiredHistogram.count(m_options.timeout()); |
104 | 104 |
105 m_geolocation->requestTimedOut(this); | 105 m_geolocation->requestTimedOut(this); |
106 } | 106 } |
107 | 107 |
108 } // namespace blink | 108 } // namespace blink |
OLD | NEW |