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 "core/dom/TaskRunnerHelper.h" |
7 #include "modules/geolocation/Geolocation.h" | 8 #include "modules/geolocation/Geolocation.h" |
8 #include "modules/geolocation/PositionError.h" | 9 #include "modules/geolocation/PositionError.h" |
9 #include "modules/geolocation/PositionOptions.h" | 10 #include "modules/geolocation/PositionOptions.h" |
10 #include "platform/Histogram.h" | 11 #include "platform/Histogram.h" |
11 #include "wtf/Assertions.h" | 12 #include "wtf/Assertions.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 GeoNotifier::GeoNotifier(Geolocation* geolocation, | 16 GeoNotifier::GeoNotifier(Geolocation* geolocation, |
16 PositionCallback* successCallback, | 17 PositionCallback* successCallback, |
17 PositionErrorCallback* errorCallback, | 18 PositionErrorCallback* errorCallback, |
18 const PositionOptions& options) | 19 const PositionOptions& options) |
19 : m_geolocation(geolocation), | 20 : m_geolocation(geolocation), |
20 m_successCallback(successCallback), | 21 m_successCallback(successCallback), |
21 m_errorCallback(errorCallback), | 22 m_errorCallback(errorCallback), |
22 m_options(options), | 23 m_options(options), |
23 m_timer(this, &GeoNotifier::timerFired), | 24 m_timer(TaskRunnerHelper::get(TaskType::MiscPlatformAPI, |
| 25 geolocation->frame()), |
| 26 this, |
| 27 &GeoNotifier::timerFired), |
24 m_useCachedPosition(false) { | 28 m_useCachedPosition(false) { |
25 DCHECK(m_geolocation); | 29 DCHECK(m_geolocation); |
26 DCHECK(m_successCallback); | 30 DCHECK(m_successCallback); |
27 | 31 |
28 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeoutHistogram, | 32 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeoutHistogram, |
29 ("Geolocation.Timeout", 0, | 33 ("Geolocation.Timeout", 0, |
30 1000 * 60 * 10 /* 10 minute max */, 20 /* buckets */)); | 34 1000 * 60 * 10 /* 10 minute max */, 20 /* buckets */)); |
31 timeoutHistogram.count(m_options.timeout()); | 35 timeoutHistogram.count(m_options.timeout()); |
32 } | 36 } |
33 | 37 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 103 |
100 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeoutExpiredHistogram, | 104 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeoutExpiredHistogram, |
101 ("Geolocation.TimeoutExpired", 0, | 105 ("Geolocation.TimeoutExpired", 0, |
102 1000 * 60 * 10 /* 10 minute max */, 20 /* buckets */)); | 106 1000 * 60 * 10 /* 10 minute max */, 20 /* buckets */)); |
103 timeoutExpiredHistogram.count(m_options.timeout()); | 107 timeoutExpiredHistogram.count(m_options.timeout()); |
104 | 108 |
105 m_geolocation->requestTimedOut(this); | 109 m_geolocation->requestTimedOut(this); |
106 } | 110 } |
107 | 111 |
108 } // namespace blink | 112 } // namespace blink |
OLD | NEW |