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