diff options
author | Steve Block <steveblock@google.com> | 2010-02-23 07:35:51 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-02-23 07:35:51 -0800 |
commit | 0619f0601ffda6f9b1e7ef9870de4a6d14defbd1 (patch) | |
tree | 492a7f9cac3f066dc68b5c1d7a0d462af41d94ca | |
parent | 9ec5bc25beca2ca00218089cf4f3a5efb79f3448 (diff) | |
parent | 602f856d9f84c00d87576a9d5314f42a695d9850 (diff) | |
download | external_webkit-0619f0601ffda6f9b1e7ef9870de4a6d14defbd1.zip external_webkit-0619f0601ffda6f9b1e7ef9870de4a6d14defbd1.tar.gz external_webkit-0619f0601ffda6f9b1e7ef9870de4a6d14defbd1.tar.bz2 |
Merge "Updates Android to final version of Geolocation position cache submitted to webkit.org"
-rw-r--r-- | WebCore/page/GeolocationPositionCache.cpp | 18 | ||||
-rw-r--r-- | WebCore/page/GeolocationPositionCache.h | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/WebCore/page/GeolocationPositionCache.cpp b/WebCore/page/GeolocationPositionCache.cpp index 7bc361a..5796191 100644 --- a/WebCore/page/GeolocationPositionCache.cpp +++ b/WebCore/page/GeolocationPositionCache.cpp @@ -29,13 +29,14 @@ #include "Geoposition.h" #include "SQLValue.h" #include "SQLiteDatabase.h" +#include "SQLiteFileSystem.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" namespace WebCore { -static const char* databaseName = "/CachedPosition.db"; +static const char* databaseName = "CachedGeoposition.db"; int GeolocationPositionCache::s_instances = 0; RefPtr<Geoposition>* GeolocationPositionCache::s_cachedPosition; @@ -60,7 +61,6 @@ GeolocationPositionCache::~GeolocationPositionCache() void GeolocationPositionCache::setCachedPosition(Geoposition* cachedPosition) { - // We do not take owenership from the caller, but add our own ref count. *s_cachedPosition = cachedPosition; } @@ -69,11 +69,11 @@ Geoposition* GeolocationPositionCache::cachedPosition() return s_cachedPosition->get(); } -void GeolocationPositionCache::setDatabasePath(String databasePath) +void GeolocationPositionCache::setDatabasePath(const String& databasePath) { if (!s_databaseFile) s_databaseFile = new String; - *s_databaseFile = databasePath + databaseName; + *s_databaseFile = SQLiteFileSystem::appendDatabaseFileNameToPath(databasePath, databaseName); // If we don't have have a cached position, attempt to read one from the // DB at the new path. if (s_instances && !(*s_cachedPosition)) @@ -110,17 +110,17 @@ PassRefPtr<Geoposition> GeolocationPositionCache::readFromDB() bool providesAltitudeAccuracy = statement.getColumnValue(4).type() != SQLValue::NullValue; bool providesHeading = statement.getColumnValue(5).type() != SQLValue::NullValue; bool providesSpeed = statement.getColumnValue(6).type() != SQLValue::NullValue; - RefPtr<Coordinates> coordinates = Coordinates::create(statement.getColumnDouble(0), // latitude - statement.getColumnDouble(1), // longitude + RefPtr<Coordinates> coordinates = Coordinates::create(statement.getColumnDouble(0), // latitude + statement.getColumnDouble(1), // longitude providesAltitude, statement.getColumnDouble(2), // altitude - statement.getColumnDouble(3), // accuracy + statement.getColumnDouble(3), // accuracy providesAltitudeAccuracy, statement.getColumnDouble(4), // altitudeAccuracy providesHeading, statement.getColumnDouble(5), // heading providesSpeed, statement.getColumnDouble(6)); // speed - return Geoposition::create(coordinates.release(), statement.getColumnInt64(7)); // timestamp + return Geoposition::create(coordinates.release(), statement.getColumnInt64(7)); // timestamp } -void GeolocationPositionCache::writeToDB(Geoposition* position) +void GeolocationPositionCache::writeToDB(const Geoposition* position) { ASSERT(position); diff --git a/WebCore/page/GeolocationPositionCache.h b/WebCore/page/GeolocationPositionCache.h index 2dcfc57..c7f7e49 100644 --- a/WebCore/page/GeolocationPositionCache.h +++ b/WebCore/page/GeolocationPositionCache.h @@ -42,11 +42,11 @@ class GeolocationPositionCache { void setCachedPosition(Geoposition*); Geoposition* cachedPosition(); - static void setDatabasePath(String); + static void setDatabasePath(const String&); private: static PassRefPtr<Geoposition> readFromDB(); - static void writeToDB(Geoposition*); + static void writeToDB(const Geoposition*); static int s_instances; static RefPtr<Geoposition>* s_cachedPosition; |