diff options
author | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-16 16:28:46 +0000 |
---|---|---|
committer | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-16 16:28:46 +0000 |
commit | 83f3b26b82c3fd2f912233436ddf583371457034 (patch) | |
tree | a42bdd2fdc83f85bc404503d3db91eed408243d3 | |
parent | 4ca76c039697483d5f27accf2772ca9cdcd1a586 (diff) | |
download | chromium_src-83f3b26b82c3fd2f912233436ddf583371457034.zip chromium_src-83f3b26b82c3fd2f912233436ddf583371457034.tar.gz chromium_src-83f3b26b82c3fd2f912233436ddf583371457034.tar.bz2 |
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
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, |