From 83f3b26b82c3fd2f912233436ddf583371457034 Mon Sep 17 00:00:00 2001 From: "jknotten@chromium.org" Date: Wed, 16 May 2012 16:28:46 +0000 Subject: Upstream Geolocation timestamp fix. We need to pass the timestamp as a double rather than as a long to avoid overflow. Review URL: https://chromiumcodereview.appspot.com/10392128 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137438 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/geolocation/location_api_adapter_android.cc | 6 +++--- content/browser/geolocation/location_api_adapter_android.h | 2 +- .../android/java/org/chromium/content/browser/LocationProvider.java | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/content/browser/geolocation/location_api_adapter_android.cc b/content/browser/geolocation/location_api_adapter_android.cc index f1c8948..9c2356c 100644 --- a/content/browser/geolocation/location_api_adapter_android.cc +++ b/content/browser/geolocation/location_api_adapter_android.cc @@ -19,7 +19,7 @@ using base::android::GetMethodID; static void NewLocationAvailable(JNIEnv* env, jclass, jdouble latitude, jdouble longitude, - jlong time_stamp, + jdouble time_stamp, jboolean has_altitude, jdouble altitude, jboolean has_accuracy, jdouble accuracy, jboolean has_heading, jdouble heading, @@ -98,7 +98,7 @@ void AndroidLocationApiAdapter::NotifyProviderNewGeoposition( // static void AndroidLocationApiAdapter::OnNewLocationAvailable( - double latitude, double longitude, long time_stamp, + double latitude, double longitude, double time_stamp, bool has_altitude, double altitude, bool has_accuracy, double accuracy, bool has_heading, double heading, @@ -106,7 +106,7 @@ void AndroidLocationApiAdapter::OnNewLocationAvailable( content::Geoposition position; position.latitude = latitude; position.longitude = longitude; - position.timestamp = base::Time::FromDoubleT(time_stamp / 1000.0); + position.timestamp = base::Time::FromDoubleT(time_stamp); if (has_altitude) position.altitude = altitude; if (has_accuracy) diff --git a/content/browser/geolocation/location_api_adapter_android.h b/content/browser/geolocation/location_api_adapter_android.h index c2b4f85..06d7195 100644 --- a/content/browser/geolocation/location_api_adapter_android.h +++ b/content/browser/geolocation/location_api_adapter_android.h @@ -49,7 +49,7 @@ class AndroidLocationApiAdapter { // Called by JNI on main thread looper. static void OnNewLocationAvailable(double latitude, double longitude, - long time_stamp, + double time_stamp, bool has_altitude, double altitude, bool has_accuracy, double accuracy, bool has_heading, double heading, diff --git a/content/public/android/java/org/chromium/content/browser/LocationProvider.java b/content/public/android/java/org/chromium/content/browser/LocationProvider.java index 6a89eef..75be3dd 100644 --- a/content/public/android/java/org/chromium/content/browser/LocationProvider.java +++ b/content/public/android/java/org/chromium/content/browser/LocationProvider.java @@ -102,7 +102,8 @@ class LocationProvider { // native object will no longer exist. if (mIsRunning) { nativeNewLocationAvailable(location.getLatitude(), location.getLongitude(), - location.getTime(), location.hasAltitude(), location.getAltitude(), + location.getTime() / 1000.0, + location.hasAltitude(), location.getAltitude(), location.hasAccuracy(), location.getAccuracy(), location.hasBearing(), location.getBearing(), location.hasSpeed(), location.getSpeed()); @@ -223,7 +224,7 @@ class LocationProvider { // Native functions public static native void nativeNewLocationAvailable( - double latitude, double longitude, long timeStamp, + double latitude, double longitude, double timeStamp, boolean hasAltitude, double altitude, boolean hasAccuracy, double accuracy, boolean hasHeading, double heading, -- cgit v1.1