2011-02-21 Hans Wennborg <hans@chromium.org>
authorhans@chromium.org <hans@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Feb 2011 09:40:32 +0000 (09:40 +0000)
committerhans@chromium.org <hans@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Feb 2011 09:40:32 +0000 (09:40 +0000)
        Reviewed by Jeremy Orlow.

        IndexedDB: Rename IDBSQLiteDatabase to IDBBackingStore
        https://bugs.webkit.org/show_bug.cgi?id=54864

        No new functionality, so no new tests.

        * GNUmakefile.am:
        * WebCore.gypi:
        * storage/IDBBackingStore.cpp:
        (WebCore::IDBBackingStore::IDBBackingStore):
        (WebCore::IDBBackingStore::~IDBBackingStore):
        * storage/IDBBackingStore.h:
        (WebCore::IDBBackingStore::create):
        (WebCore::IDBBackingStore::db):
        * storage/IDBCursorBackendImpl.cpp:
        (WebCore::IDBCursorBackendImpl::IDBCursorBackendImpl):
        (WebCore::IDBCursorBackendImpl::currentRowExists):
        (WebCore::IDBCursorBackendImpl::database):
        * storage/IDBCursorBackendImpl.h:
        (WebCore::IDBCursorBackendImpl::create):
        * storage/IDBDatabaseBackendImpl.cpp:
        (WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl):
        (WebCore::IDBDatabaseBackendImpl::sqliteDatabase):
        (WebCore::IDBDatabaseBackendImpl::createObjectStore):
        (WebCore::IDBDatabaseBackendImpl::setVersionInternal):
        (WebCore::IDBDatabaseBackendImpl::loadObjectStores):
        * storage/IDBDatabaseBackendImpl.h:
        (WebCore::IDBDatabaseBackendImpl::create):
        * storage/IDBFactoryBackendImpl.cpp:
        (WebCore::IDBFactoryBackendImpl::removeIDBBackingStore):
        (WebCore::openSQLiteDatabase):
        (WebCore::IDBFactoryBackendImpl::open):
        * storage/IDBFactoryBackendImpl.h:
        * storage/IDBIndexBackendImpl.cpp:
        (WebCore::IDBIndexBackendImpl::IDBIndexBackendImpl):
        (WebCore::IDBIndexBackendImpl::openCursorInternal):
        (WebCore::IDBIndexBackendImpl::sqliteDatabase):
        * storage/IDBIndexBackendImpl.h:
        (WebCore::IDBIndexBackendImpl::create):
        * storage/IDBObjectStoreBackendImpl.cpp:
        (WebCore::IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl):
        (WebCore::IDBObjectStoreBackendImpl::createIndex):
        (WebCore::IDBObjectStoreBackendImpl::openCursorInternal):
        (WebCore::IDBObjectStoreBackendImpl::loadIndexes):
        (WebCore::IDBObjectStoreBackendImpl::sqliteDatabase):
        * storage/IDBObjectStoreBackendImpl.h:
        (WebCore::IDBObjectStoreBackendImpl::create):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79426 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/WebCore.gypi
Source/WebCore/storage/IDBBackingStore.cpp [moved from Source/WebCore/storage/IDBSQLiteDatabase.cpp with 85% similarity]
Source/WebCore/storage/IDBBackingStore.h [moved from Source/WebCore/storage/IDBSQLiteDatabase.h with 77% similarity]
Source/WebCore/storage/IDBCursorBackendImpl.cpp
Source/WebCore/storage/IDBCursorBackendImpl.h
Source/WebCore/storage/IDBDatabaseBackendImpl.cpp
Source/WebCore/storage/IDBDatabaseBackendImpl.h
Source/WebCore/storage/IDBFactoryBackendImpl.cpp
Source/WebCore/storage/IDBFactoryBackendImpl.h
Source/WebCore/storage/IDBIndexBackendImpl.cpp
Source/WebCore/storage/IDBIndexBackendImpl.h
Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp
Source/WebCore/storage/IDBObjectStoreBackendImpl.h

index a6bbe0b..6fb1602 100644 (file)
@@ -1,3 +1,54 @@
+2011-02-21  Hans Wennborg  <hans@chromium.org>
+
+        Reviewed by Jeremy Orlow.
+
+        IndexedDB: Rename IDBSQLiteDatabase to IDBBackingStore
+        https://bugs.webkit.org/show_bug.cgi?id=54864
+
+        No new functionality, so no new tests.
+
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * storage/IDBBackingStore.cpp:
+        (WebCore::IDBBackingStore::IDBBackingStore):
+        (WebCore::IDBBackingStore::~IDBBackingStore):
+        * storage/IDBBackingStore.h:
+        (WebCore::IDBBackingStore::create):
+        (WebCore::IDBBackingStore::db):
+        * storage/IDBCursorBackendImpl.cpp:
+        (WebCore::IDBCursorBackendImpl::IDBCursorBackendImpl):
+        (WebCore::IDBCursorBackendImpl::currentRowExists):
+        (WebCore::IDBCursorBackendImpl::database):
+        * storage/IDBCursorBackendImpl.h:
+        (WebCore::IDBCursorBackendImpl::create):
+        * storage/IDBDatabaseBackendImpl.cpp:
+        (WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl):
+        (WebCore::IDBDatabaseBackendImpl::sqliteDatabase):
+        (WebCore::IDBDatabaseBackendImpl::createObjectStore):
+        (WebCore::IDBDatabaseBackendImpl::setVersionInternal):
+        (WebCore::IDBDatabaseBackendImpl::loadObjectStores):
+        * storage/IDBDatabaseBackendImpl.h:
+        (WebCore::IDBDatabaseBackendImpl::create):
+        * storage/IDBFactoryBackendImpl.cpp:
+        (WebCore::IDBFactoryBackendImpl::removeIDBBackingStore):
+        (WebCore::openSQLiteDatabase):
+        (WebCore::IDBFactoryBackendImpl::open):
+        * storage/IDBFactoryBackendImpl.h:
+        * storage/IDBIndexBackendImpl.cpp:
+        (WebCore::IDBIndexBackendImpl::IDBIndexBackendImpl):
+        (WebCore::IDBIndexBackendImpl::openCursorInternal):
+        (WebCore::IDBIndexBackendImpl::sqliteDatabase):
+        * storage/IDBIndexBackendImpl.h:
+        (WebCore::IDBIndexBackendImpl::create):
+        * storage/IDBObjectStoreBackendImpl.cpp:
+        (WebCore::IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl):
+        (WebCore::IDBObjectStoreBackendImpl::createIndex):
+        (WebCore::IDBObjectStoreBackendImpl::openCursorInternal):
+        (WebCore::IDBObjectStoreBackendImpl::loadIndexes):
+        (WebCore::IDBObjectStoreBackendImpl::sqliteDatabase):
+        * storage/IDBObjectStoreBackendImpl.h:
+        (WebCore::IDBObjectStoreBackendImpl::create):
+
 2011-02-23  Dominic Mazzoni  <dmazzoni@google.com>
 
         Reviewed by Kenneth Russell.
index d0b371a..184d42c 100644 (file)
@@ -3097,6 +3097,8 @@ webcore_sources += \
        Source/WebCore/storage/DatabaseTracker.h \
        Source/WebCore/storage/IDBAny.cpp \
        Source/WebCore/storage/IDBAny.h \
+       Source/WebCore/storage/IDBBackingStore.cpp \
+       Source/WebCore/storage/IDBBackingStore.h \
        Source/WebCore/storage/IDBCallbacks.h \
        Source/WebCore/storage/IDBCursorBackendImpl.cpp \
        Source/WebCore/storage/IDBCursorBackendImpl.h \
@@ -3137,8 +3139,6 @@ webcore_sources += \
        Source/WebCore/storage/IDBObjectStore.h \
        Source/WebCore/storage/IDBRequest.cpp \
        Source/WebCore/storage/IDBRequest.h \
-       Source/WebCore/storage/IDBSQLiteDatabase.cpp \
-       Source/WebCore/storage/IDBSQLiteDatabase.h \
        Source/WebCore/storage/IDBTransactionBackendInterface.h \
        Source/WebCore/storage/IDBTransactionCoordinator.h \
        Source/WebCore/storage/IDBTransaction.cpp \
index 4a07b81..dc4d040 100644 (file)
             'storage/DatabaseTrackerClient.h',
             'storage/IDBAny.cpp',
             'storage/IDBAny.h',
+            'storage/IDBBackingStore.cpp',
+            'storage/IDBBackingStore.h',
             'storage/IDBCallbacks.h',
             'storage/IDBCursor.cpp',
             'storage/IDBCursor.h',
             'storage/IDBPendingTransactionMonitor.h',
             'storage/IDBRequest.cpp',
             'storage/IDBRequest.h',
-            'storage/IDBSQLiteDatabase.cpp',
-            'storage/IDBSQLiteDatabase.h',
             'storage/IDBTransaction.cpp',
             'storage/IDBTransaction.h',
             'storage/IDBTransactionBackendImpl.cpp',
similarity index 85%
rename from Source/WebCore/storage/IDBSQLiteDatabase.cpp
rename to Source/WebCore/storage/IDBBackingStore.cpp
index e881917..688feb8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "IDBSQLiteDatabase.h"
+#include "IDBBackingStore.h"
 
 #if ENABLE(INDEXED_DATABASE)
 
 
 namespace WebCore {
 
-IDBSQLiteDatabase::IDBSQLiteDatabase(String identifier, IDBFactoryBackendImpl* factory)
+IDBBackingStore::IDBBackingStore(String identifier, IDBFactoryBackendImpl* factory)
     : m_identifier(identifier)
     , m_factory(factory)
 {
 }
 
-IDBSQLiteDatabase::~IDBSQLiteDatabase()
+IDBBackingStore::~IDBBackingStore()
 {
-    m_factory->removeSQLiteDatabase(m_identifier);
+    m_factory->removeIDBBackingStore(m_identifier);
 }
 
 } // namespace WebCore
similarity index 77%
rename from Source/WebCore/storage/IDBSQLiteDatabase.h
rename to Source/WebCore/storage/IDBBackingStore.h
index 0556506..7abb102 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,8 +23,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef IDBSQLiteDatabase_h
-#define IDBSQLiteDatabase_h
+#ifndef IDBBackingStore_h
+#define IDBBackingStore_h
 
 #if ENABLE(INDEXED_DATABASE)
 
@@ -37,18 +37,15 @@ namespace WebCore {
 
 class IDBFactoryBackendImpl;
 
-class IDBSQLiteDatabase : public RefCounted<IDBSQLiteDatabase> {
+class IDBBackingStore : public RefCounted<IDBBackingStore> {
 public:
-    static PassRefPtr<IDBSQLiteDatabase> create(String identifier, IDBFactoryBackendImpl* factory)
-    {
-        return adoptRef(new IDBSQLiteDatabase(identifier, factory));
-    }
-    ~IDBSQLiteDatabase();
+    static PassRefPtr<IDBBackingStore> create(String identifier, IDBFactoryBackendImpl* factory) { return adoptRef(new IDBBackingStore(identifier, factory)); }
+    ~IDBBackingStore();
 
     SQLiteDatabase& db() { return m_db; }
 
 private:
-    IDBSQLiteDatabase(String identifier, IDBFactoryBackendImpl* factory);
+    IDBBackingStore(String identifier, IDBFactoryBackendImpl* factory);
 
     SQLiteDatabase m_db;
     String m_identifier;
@@ -59,4 +56,4 @@ private:
 
 #endif
 
-#endif // IDBSQLiteDatabase_h
+#endif // IDBBackingStore_h
index 089bb67..4576f6d 100644 (file)
@@ -29,6 +29,7 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "CrossThreadTask.h"
+#include "IDBBackingStore.h"
 #include "IDBCallbacks.h"
 #include "IDBDatabaseBackendImpl.h"
 #include "IDBDatabaseError.h"
@@ -37,7 +38,6 @@
 #include "IDBKeyRange.h"
 #include "IDBObjectStoreBackendImpl.h"
 #include "IDBRequest.h"
-#include "IDBSQLiteDatabase.h"
 #include "IDBTransactionBackendInterface.h"
 #include "SQLiteDatabase.h"
 #include "SQLiteStatement.h"
@@ -45,8 +45,8 @@
 
 namespace WebCore {
 
-IDBCursorBackendImpl::IDBCursorBackendImpl(IDBSQLiteDatabase* database, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassOwnPtr<SQLiteStatement> query, bool isSerializedScriptValueCursor, IDBTransactionBackendInterface* transaction, IDBObjectStoreBackendInterface* objectStore)
-    : m_database(database)
+IDBCursorBackendImpl::IDBCursorBackendImpl(IDBBackingStore* backingStore, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassOwnPtr<SQLiteStatement> query, bool isSerializedScriptValueCursor, IDBTransactionBackendInterface* transaction, IDBObjectStoreBackendInterface* objectStore)
+    : m_backingStore(backingStore)
     , m_keyRange(keyRange)
     , m_direction(direction)
     , m_query(query)
@@ -101,7 +101,7 @@ void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey> prpKey, PassRefPt
 bool IDBCursorBackendImpl::currentRowExists()
 {
     String sql = m_currentIDBKeyValue ? "SELECT id FROM IndexData WHERE id = ?" : "SELECT id FROM ObjectStoreData WHERE id = ?";
-    SQLiteStatement statement(m_database->db(), sql);
+    SQLiteStatement statement(m_backingStore->db(), sql);
 
     bool ok = statement.prepare() == SQLResultOk;
     ASSERT_UNUSED(ok, ok);
@@ -174,7 +174,7 @@ void IDBCursorBackendImpl::loadCurrentRow()
 
 SQLiteDatabase& IDBCursorBackendImpl::database() const
 {
-    return m_database->db();
+    return m_backingStore->db();
 }
 
 } // namespace WebCore
index f459139..db12f17 100644 (file)
@@ -41,7 +41,7 @@ class IDBDatabaseBackendImpl;
 class IDBIndexBackendImpl;
 class IDBKeyRange;
 class IDBObjectStoreBackendInterface;
-class IDBSQLiteDatabase;
+class IDBBackingStore;
 class IDBTransactionBackendInterface;
 class SQLiteDatabase;
 class SQLiteStatement;
@@ -49,9 +49,9 @@ class SerializedScriptValue;
 
 class IDBCursorBackendImpl : public IDBCursorBackendInterface {
 public:
-    static PassRefPtr<IDBCursorBackendImpl> create(IDBSQLiteDatabase* database, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassOwnPtr<SQLiteStatement> query, bool isSerializedScriptValueCursor, IDBTransactionBackendInterface* transaction, IDBObjectStoreBackendInterface* objectStore)
+    static PassRefPtr<IDBCursorBackendImpl> create(IDBBackingStore* backingStore, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassOwnPtr<SQLiteStatement> query, bool isSerializedScriptValueCursor, IDBTransactionBackendInterface* transaction, IDBObjectStoreBackendInterface* objectStore)
     {
-        return adoptRef(new IDBCursorBackendImpl(database, keyRange, direction, query, isSerializedScriptValueCursor, transaction, objectStore));
+        return adoptRef(new IDBCursorBackendImpl(backingStore, keyRange, direction, query, isSerializedScriptValueCursor, transaction, objectStore));
     }
     virtual ~IDBCursorBackendImpl();
 
@@ -63,7 +63,7 @@ public:
     virtual void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&);
 
 private:
-    IDBCursorBackendImpl(IDBSQLiteDatabase*, PassRefPtr<IDBKeyRange>, IDBCursor::Direction, PassOwnPtr<SQLiteStatement> query, bool isSerializedScriptValueCursor, IDBTransactionBackendInterface*, IDBObjectStoreBackendInterface*);
+    IDBCursorBackendImpl(IDBBackingStore*, PassRefPtr<IDBKeyRange>, IDBCursor::Direction, PassOwnPtr<SQLiteStatement> query, bool isSerializedScriptValueCursor, IDBTransactionBackendInterface*, IDBObjectStoreBackendInterface*);
 
     bool currentRowExists();
     void loadCurrentRow();
@@ -73,7 +73,7 @@ private:
 
     static const int64_t InvalidId = -1;
 
-    RefPtr<IDBSQLiteDatabase> m_database;
+    RefPtr<IDBBackingStore> m_backingStore;
 
     RefPtr<IDBKeyRange> m_keyRange;
     IDBCursor::Direction m_direction;
index e2745b5..8a891db 100644 (file)
 
 #include "CrossThreadTask.h"
 #include "DOMStringList.h"
+#include "IDBBackingStore.h"
 #include "IDBDatabaseException.h"
 #include "IDBFactoryBackendImpl.h"
 #include "IDBObjectStoreBackendImpl.h"
-#include "IDBSQLiteDatabase.h"
 #include "IDBTransactionBackendImpl.h"
 #include "IDBTransactionCoordinator.h"
 #include "SQLiteStatement.h"
@@ -105,8 +105,8 @@ static bool setMetaData(SQLiteDatabase& sqliteDatabase, const String& name, cons
     return true;
 }
 
-IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, IDBSQLiteDatabase* sqliteDatabase, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
-    : m_sqliteDatabase(sqliteDatabase)
+IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, IDBBackingStore* backingStore, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
+    : m_backingStore(backingStore)
     , m_id(InvalidId)
     , m_name(name)
     , m_version("")
@@ -117,9 +117,9 @@ IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, IDBSQLiteData
 {
     ASSERT(!m_name.isNull());
 
-    bool success = extractMetaData(m_sqliteDatabase->db(), m_name, m_version, m_id);
+    bool success = extractMetaData(m_backingStore->db(), m_name, m_version, m_id);
     ASSERT_UNUSED(success, success == (m_id != InvalidId));
-    if (!setMetaData(m_sqliteDatabase->db(), m_name, m_version, m_id))
+    if (!setMetaData(m_backingStore->db(), m_name, m_version, m_id))
         ASSERT_NOT_REACHED(); // FIXME: Need better error handling.
     loadObjectStores();
 }
@@ -131,7 +131,7 @@ IDBDatabaseBackendImpl::~IDBDatabaseBackendImpl()
 
 SQLiteDatabase& IDBDatabaseBackendImpl::sqliteDatabase() const
 {
-    return m_sqliteDatabase->db();
+    return m_backingStore->db();
 }
 
 PassRefPtr<DOMStringList> IDBDatabaseBackendImpl::objectStoreNames() const
@@ -151,7 +151,7 @@ PassRefPtr<IDBObjectStoreBackendInterface>  IDBDatabaseBackendImpl::createObject
         return 0;
     }
 
-    RefPtr<IDBObjectStoreBackendImpl> objectStore = IDBObjectStoreBackendImpl::create(m_sqliteDatabase.get(), name, keyPath, autoIncrement);
+    RefPtr<IDBObjectStoreBackendImpl> objectStore = IDBObjectStoreBackendImpl::create(m_backingStore.get(), name, keyPath, autoIncrement);
     ASSERT(objectStore->name() == name);
 
     RefPtr<IDBDatabaseBackendImpl> database = this;
@@ -253,7 +253,7 @@ void IDBDatabaseBackendImpl::setVersionInternal(ScriptExecutionContext*, PassRef
 {
     int64_t databaseId = database->id();
     database->m_version = version;
-    if (!setMetaData(database->m_sqliteDatabase->db(), database->m_name, database->m_version, databaseId)) {
+    if (!setMetaData(database->m_backingStore->db(), database->m_name, database->m_version, databaseId)) {
         // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors.
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage."));
         transaction->abort();
@@ -309,7 +309,7 @@ void IDBDatabaseBackendImpl::loadObjectStores()
         String keyPath = objectStoresQuery.getColumnText(2);
         bool autoIncrement = !!objectStoresQuery.getColumnInt(3);
 
-        m_objectStores.set(name, IDBObjectStoreBackendImpl::create(m_sqliteDatabase.get(), id, name, keyPath, autoIncrement));
+        m_objectStores.set(name, IDBObjectStoreBackendImpl::create(m_backingStore.get(), id, name, keyPath, autoIncrement));
     }
 }
 
index 202b072..45afb8d 100644 (file)
 
 namespace WebCore {
 
+class IDBBackingStore;
 class IDBFactoryBackendImpl;
 class IDBObjectStoreBackendImpl;
-class IDBSQLiteDatabase;
 class IDBTransactionCoordinator;
 class SQLiteDatabase;
 
 class IDBDatabaseBackendImpl : public IDBDatabaseBackendInterface {
 public:
-    static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, IDBSQLiteDatabase* database, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
+    static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, IDBBackingStore* database, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
     {
         return adoptRef(new IDBDatabaseBackendImpl(name, database, coordinator, factory, uniqueIdentifier));
     }
@@ -70,7 +70,7 @@ public:
     IDBTransactionCoordinator* transactionCoordinator() const { return m_transactionCoordinator.get(); }
 
 private:
-    IDBDatabaseBackendImpl(const String& name, IDBSQLiteDatabase* database, IDBTransactionCoordinator*, IDBFactoryBackendImpl*, const String& uniqueIdentifier);
+    IDBDatabaseBackendImpl(const String& name, IDBBackingStore* database, IDBTransactionCoordinator*, IDBFactoryBackendImpl*, const String& uniqueIdentifier);
 
     void loadObjectStores();
 
@@ -83,7 +83,7 @@ private:
     static void addObjectStoreToMap(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>);
     static void resetVersion(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, const String& version);
 
-    RefPtr<IDBSQLiteDatabase> m_sqliteDatabase;
+    RefPtr<IDBBackingStore> m_backingStore;
     int64 m_id;
     String m_name;
     String m_version;
index 372d54c..28fec55 100644 (file)
@@ -31,9 +31,9 @@
 
 #include "DOMStringList.h"
 #include "FileSystem.h"
+#include "IDBBackingStore.h"
 #include "IDBDatabaseBackendImpl.h"
 #include "IDBDatabaseException.h"
-#include "IDBSQLiteDatabase.h"
 #include "IDBTransactionCoordinator.h"
 #include "SQLiteStatement.h"
 #include "SQLiteTransaction.h"
@@ -60,13 +60,13 @@ void IDBFactoryBackendImpl::removeIDBDatabaseBackend(const String& uniqueIdentif
     m_databaseBackendMap.remove(uniqueIdentifier);
 }
 
-void IDBFactoryBackendImpl::removeSQLiteDatabase(const String& uniqueIdentifier)
+void IDBFactoryBackendImpl::removeIDBBackingStore(const String& uniqueIdentifier)
 {
-    ASSERT(m_sqliteDatabaseMap.contains(uniqueIdentifier));
-    m_sqliteDatabaseMap.remove(uniqueIdentifier);
+    ASSERT(m_backingStoreMap.contains(uniqueIdentifier));
+    m_backingStoreMap.remove(uniqueIdentifier);
 }
 
-static PassRefPtr<IDBSQLiteDatabase> openSQLiteDatabase(SecurityOrigin* securityOrigin, const String& pathBase, int64_t maximumSize, const String& fileIdentifier, IDBFactoryBackendImpl* factory)
+static PassRefPtr<IDBBackingStore> openSQLiteDatabase(SecurityOrigin* securityOrigin, const String& pathBase, int64_t maximumSize, const String& fileIdentifier, IDBFactoryBackendImpl* factory)
 {
     String path = ":memory:";
     if (!pathBase.isEmpty()) {
@@ -79,18 +79,18 @@ static PassRefPtr<IDBSQLiteDatabase> openSQLiteDatabase(SecurityOrigin* security
         path = pathByAppendingComponent(pathBase, securityOrigin->databaseIdentifier() + ".indexeddb");
     }
 
-    RefPtr<IDBSQLiteDatabase> sqliteDatabase = IDBSQLiteDatabase::create(fileIdentifier, factory);
-    if (!sqliteDatabase->db().open(path)) {
+    RefPtr<IDBBackingStore> backingStore = IDBBackingStore::create(fileIdentifier, factory);
+    if (!backingStore->db().open(path)) {
         // FIXME: Is there any other thing we could possibly do to recover at this point? If so, do it rather than just erroring out.
         LOG_ERROR("Failed to open database file %s for IndexedDB", path.utf8().data());
         return 0;
     }
 
     // FIXME: Error checking?
-    sqliteDatabase->db().setMaximumSize(maximumSize);
-    sqliteDatabase->db().turnOnIncrementalAutoVacuum();
+    backingStore->db().setMaximumSize(maximumSize);
+    backingStore->db().turnOnIncrementalAutoVacuum();
 
-    return sqliteDatabase.release();
+    return backingStore.release();
 }
 
 static bool runCommands(SQLiteDatabase& sqliteDatabase, const char** commands, size_t numberOfCommands)
@@ -220,22 +220,22 @@ void IDBFactoryBackendImpl::open(const String& name, PassRefPtr<IDBCallbacks> ca
 
     // FIXME: Everything from now on should be done on another thread.
 
-    RefPtr<IDBSQLiteDatabase> sqliteDatabase;
-    SQLiteDatabaseMap::iterator it2 = m_sqliteDatabaseMap.find(fileIdentifier);
-    if (it2 != m_sqliteDatabaseMap.end())
-        sqliteDatabase = it2->second;
+    RefPtr<IDBBackingStore> backingStore;
+    IDBBackingStoreMap::iterator it2 = m_backingStoreMap.find(fileIdentifier);
+    if (it2 != m_backingStoreMap.end())
+        backingStore = it2->second;
     else {
-        sqliteDatabase = openSQLiteDatabase(securityOrigin.get(), dataDir, maximumSize, fileIdentifier, this);
+        backingStore = openSQLiteDatabase(securityOrigin.get(), dataDir, maximumSize, fileIdentifier, this);
 
-        if (!sqliteDatabase || !createTables(sqliteDatabase->db()) || !migrateDatabase(sqliteDatabase->db())) {
+        if (!backingStore || !createTables(backingStore->db()) || !migrateDatabase(backingStore->db())) {
             callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error."));
-            m_sqliteDatabaseMap.set(fileIdentifier, 0);
+            m_backingStoreMap.set(fileIdentifier, 0);
             return;
         }
-        m_sqliteDatabaseMap.set(fileIdentifier, sqliteDatabase.get());
+        m_backingStoreMap.set(fileIdentifier, backingStore.get());
     }
 
-    RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, sqliteDatabase.get(), m_transactionCoordinator.get(), this, uniqueIdentifier);
+    RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, backingStore.get(), m_transactionCoordinator.get(), this, uniqueIdentifier);
     databaseBackend->open();
     callbacks->onSuccess(databaseBackend.get());
     m_databaseBackendMap.set(uniqueIdentifier, databaseBackend.get());
index dcaf848..37e6a9c 100644 (file)
@@ -38,8 +38,8 @@ namespace WebCore {
 
 class DOMStringList;
 
+class IDBBackingStore;
 class IDBDatabaseBackendImpl;
-class IDBSQLiteDatabase;
 class IDBTransactionCoordinator;
 
 class IDBFactoryBackendImpl : public IDBFactoryBackendInterface {
@@ -52,7 +52,7 @@ public:
 
     // Notifications from weak pointers.
     void removeIDBDatabaseBackend(const String& uniqueIdentifier);
-    void removeSQLiteDatabase(const String& uniqueIdentifier);
+    void removeIDBBackingStore(const String& uniqueIdentifier);
 
     virtual void open(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir, int64_t maximumSize);
 
@@ -62,8 +62,8 @@ private:
     typedef HashMap<String, IDBDatabaseBackendImpl*> IDBDatabaseBackendMap;
     IDBDatabaseBackendMap m_databaseBackendMap;
 
-    typedef HashMap<String, IDBSQLiteDatabase*> SQLiteDatabaseMap;
-    SQLiteDatabaseMap m_sqliteDatabaseMap;
+    typedef HashMap<String, IDBBackingStore*> IDBBackingStoreMap;
+    IDBBackingStoreMap m_backingStoreMap;
 
     RefPtr<IDBTransactionCoordinator> m_transactionCoordinator;
 
@@ -76,4 +76,3 @@ private:
 #endif
 
 #endif // IDBFactoryBackendImpl_h
-
index 6eba189..bf3cab4 100644 (file)
@@ -29,6 +29,7 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "CrossThreadTask.h"
+#include "IDBBackingStore.h"
 #include "IDBCallbacks.h"
 #include "IDBCursorBackendImpl.h"
 #include "IDBDatabaseBackendImpl.h"
 #include "IDBKey.h"
 #include "IDBKeyRange.h"
 #include "IDBObjectStoreBackendImpl.h"
-#include "IDBSQLiteDatabase.h"
 #include "SQLiteDatabase.h"
 #include "SQLiteStatement.h"
 
 namespace WebCore {
 
-IDBIndexBackendImpl::IDBIndexBackendImpl(IDBSQLiteDatabase* database, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique)
-    : m_database(database)
+IDBIndexBackendImpl::IDBIndexBackendImpl(IDBBackingStore* backingStore, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique)
+    : m_backingStore(backingStore)
     , m_id(id)
     , m_name(name)
     , m_storeName(storeName)
@@ -52,8 +52,8 @@ IDBIndexBackendImpl::IDBIndexBackendImpl(IDBSQLiteDatabase* database, int64_t id
 {
 }
 
-IDBIndexBackendImpl::IDBIndexBackendImpl(IDBSQLiteDatabase* database, const String& name, const String& storeName, const String& keyPath, bool unique)
-    : m_database(database)
+IDBIndexBackendImpl::IDBIndexBackendImpl(IDBBackingStore* backingStore, const String& name, const String& storeName, const String& keyPath, bool unique)
+    : m_backingStore(backingStore)
     , m_id(InvalidId)
     , m_name(name)
     , m_storeName(storeName)
@@ -108,7 +108,7 @@ void IDBIndexBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr
     RefPtr<IDBObjectStoreBackendInterface> objectStore = transaction->objectStore(index->m_storeName, ec);
     ASSERT(objectStore && !ec);
 
-    RefPtr<IDBCursorBackendInterface> cursor = IDBCursorBackendImpl::create(index->m_database.get(), range, direction, query.release(), objectCursor, transaction.get(), objectStore.get());
+    RefPtr<IDBCursorBackendInterface> cursor = IDBCursorBackendImpl::create(index->m_backingStore.get(), range, direction, query.release(), objectCursor, transaction.get(), objectStore.get());
     callbacks->onSuccess(cursor.release());
 }
 
@@ -202,7 +202,7 @@ bool IDBIndexBackendImpl::addingKeyAllowed(IDBKey* key)
 
 SQLiteDatabase& IDBIndexBackendImpl::sqliteDatabase() const
 {
-    return m_database->db();
+    return m_backingStore->db();
 }
 
 } // namespace WebCore
index b98fb02..98f3623 100644 (file)
 
 namespace WebCore {
 
+class IDBBackingStore;
 class IDBKey;
 class IDBObjectStoreBackendImpl;
-class IDBSQLiteDatabase;
 class SQLiteDatabase;
 class ScriptExecutionContext;
 
 class IDBIndexBackendImpl : public IDBIndexBackendInterface {
 public:
-    static PassRefPtr<IDBIndexBackendImpl> create(IDBSQLiteDatabase* database, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique)
+    static PassRefPtr<IDBIndexBackendImpl> create(IDBBackingStore* backingStore, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique)
     {
-        return adoptRef(new IDBIndexBackendImpl(database, id, name, storeName, keyPath, unique));
+        return adoptRef(new IDBIndexBackendImpl(backingStore, id, name, storeName, keyPath, unique));
     }
-    static PassRefPtr<IDBIndexBackendImpl> create(IDBSQLiteDatabase* database, const String& name, const String& storeName, const String& keyPath, bool unique)
+    static PassRefPtr<IDBIndexBackendImpl> create(IDBBackingStore* backingStore, const String& name, const String& storeName, const String& keyPath, bool unique)
     {
-        return adoptRef(new IDBIndexBackendImpl(database, name, storeName, keyPath, unique));
+        return adoptRef(new IDBIndexBackendImpl(backingStore, name, storeName, keyPath, unique));
     }
     virtual ~IDBIndexBackendImpl();
 
@@ -72,8 +72,8 @@ public:
     virtual void getKey(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
 
 private:
-    IDBIndexBackendImpl(IDBSQLiteDatabase*, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique);
-    IDBIndexBackendImpl(IDBSQLiteDatabase*, const String& name, const String& storeName, const String& keyPath, bool unique);
+    IDBIndexBackendImpl(IDBBackingStore*, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique);
+    IDBIndexBackendImpl(IDBBackingStore*, const String& name, const String& storeName, const String& keyPath, bool unique);
 
     SQLiteDatabase& sqliteDatabase() const;
 
@@ -82,7 +82,7 @@ private:
 
     static const int64_t InvalidId = 0;
 
-    RefPtr<IDBSQLiteDatabase> m_database;
+    RefPtr<IDBBackingStore> m_backingStore;
 
     int64_t m_id;
     String m_name;
index 392be61..a2146a5 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "CrossThreadTask.h"
 #include "DOMStringList.h"
+#include "IDBBackingStore.h"
 #include "IDBBindingUtilities.h"
 #include "IDBCallbacks.h"
 #include "IDBCursorBackendImpl.h"
@@ -40,7 +41,6 @@
 #include "IDBKeyPath.h"
 #include "IDBKeyPathBackendImpl.h"
 #include "IDBKeyRange.h"
-#include "IDBSQLiteDatabase.h"
 #include "IDBTransactionBackendInterface.h"
 #include "ScriptExecutionContext.h"
 #include "SQLiteDatabase.h"
@@ -53,8 +53,8 @@ IDBObjectStoreBackendImpl::~IDBObjectStoreBackendImpl()
 {
 }
 
-IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBSQLiteDatabase* database, int64_t id, const String& name, const String& keyPath, bool autoIncrement)
-    : m_database(database)
+IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBBackingStore* backingStore, int64_t id, const String& name, const String& keyPath, bool autoIncrement)
+    : m_backingStore(backingStore)
     , m_id(id)
     , m_name(name)
     , m_keyPath(keyPath)
@@ -64,8 +64,8 @@ IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBSQLiteDatabase* database
     loadIndexes();
 }
 
-IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBSQLiteDatabase* database, const String& name, const String& keyPath, bool autoIncrement)
-    : m_database(database)
+IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBBackingStore* backingStore, const String& name, const String& keyPath, bool autoIncrement)
+    : m_backingStore(backingStore)
     , m_id(InvalidId)
     , m_name(name)
     , m_keyPath(keyPath)
@@ -448,7 +448,7 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(cons
         return 0;
     }
 
-    RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(m_database.get(), name, m_name, keyPath, unique);
+    RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(m_backingStore.get(), name, m_name, keyPath, unique);
     ASSERT(index->name() == name);
 
     RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
@@ -575,7 +575,7 @@ void IDBObjectStoreBackendImpl::openCursorInternal(ScriptExecutionContext*, Pass
         return;
     }
 
-    RefPtr<IDBCursorBackendInterface> cursor = IDBCursorBackendImpl::create(objectStore->m_database.get(), range, direction, query.release(), true, transaction.get(), objectStore.get());
+    RefPtr<IDBCursorBackendInterface> cursor = IDBCursorBackendImpl::create(objectStore->m_backingStore.get(), range, direction, query.release(), true, transaction.get(), objectStore.get());
     callbacks->onSuccess(cursor.release());
 }
 
@@ -593,13 +593,13 @@ void IDBObjectStoreBackendImpl::loadIndexes()
         String keyPath = indexQuery.getColumnText(2);
         bool unique = !!indexQuery.getColumnInt(3);
 
-        m_indexes.set(name, IDBIndexBackendImpl::create(m_database.get(), id, name, m_name, keyPath, unique));
+        m_indexes.set(name, IDBIndexBackendImpl::create(m_backingStore.get(), id, name, m_name, keyPath, unique));
     }
 }
 
 SQLiteDatabase& IDBObjectStoreBackendImpl::sqliteDatabase() const 
 {
-    return m_database->db();
+    return m_backingStore->db();
 }
 
 void IDBObjectStoreBackendImpl::removeIndexFromMap(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
index b5ed8b6..dc0a9a7 100644 (file)
 
 namespace WebCore {
 
+class IDBBackingStore;
 class IDBDatabaseBackendImpl;
 class IDBIndexBackendImpl;
-class IDBSQLiteDatabase;
 class IDBTransactionBackendInterface;
 class SQLiteDatabase;
 class ScriptExecutionContext;
 
 class IDBObjectStoreBackendImpl : public IDBObjectStoreBackendInterface {
 public:
-    static PassRefPtr<IDBObjectStoreBackendImpl> create(IDBSQLiteDatabase* database, int64_t id, const String& name, const String& keyPath, bool autoIncrement)
+    static PassRefPtr<IDBObjectStoreBackendImpl> create(IDBBackingStore* backingStore, int64_t id, const String& name, const String& keyPath, bool autoIncrement)
     {
-        return adoptRef(new IDBObjectStoreBackendImpl(database, id, name, keyPath, autoIncrement));
+        return adoptRef(new IDBObjectStoreBackendImpl(backingStore, id, name, keyPath, autoIncrement));
     }
-    static PassRefPtr<IDBObjectStoreBackendImpl> create(IDBSQLiteDatabase* database, const String& name, const String& keyPath, bool autoIncrement)
+    static PassRefPtr<IDBObjectStoreBackendImpl> create(IDBBackingStore* backingStore, const String& name, const String& keyPath, bool autoIncrement)
     {
-        return adoptRef(new IDBObjectStoreBackendImpl(database, name, keyPath, autoIncrement));
+        return adoptRef(new IDBObjectStoreBackendImpl(backingStore, name, keyPath, autoIncrement));
     }
     virtual ~IDBObjectStoreBackendImpl();
 
@@ -78,8 +78,8 @@ public:
     virtual void openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
 
 private:
-    IDBObjectStoreBackendImpl(IDBSQLiteDatabase*, int64_t id, const String& name, const String& keyPath, bool autoIncrement);
-    IDBObjectStoreBackendImpl(IDBSQLiteDatabase*, const String& name, const String& keyPath, bool autoIncrement);
+    IDBObjectStoreBackendImpl(IDBBackingStore*, int64_t id, const String& name, const String& keyPath, bool autoIncrement);
+    IDBObjectStoreBackendImpl(IDBBackingStore*, const String& name, const String& keyPath, bool autoIncrement);
 
     void loadIndexes();
     SQLiteDatabase& sqliteDatabase() const;
@@ -99,7 +99,7 @@ private:
     static void removeIndexFromMap(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>);
     static void addIndexToMap(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>);
 
-    RefPtr<IDBSQLiteDatabase> m_database;
+    RefPtr<IDBBackingStore> m_backingStore;
 
     int64_t m_id;
     String m_name;