IndexedDB: remove autogenerated objectStore/index id code
authoralecflett@chromium.org <alecflett@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2012 01:17:59 +0000 (01:17 +0000)
committeralecflett@chromium.org <alecflett@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2012 01:17:59 +0000 (01:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=98085

Reviewed by Tony Chang.

Source/WebCore:

Remove support for backend-generated objectstore and index
ids. The frontend objects now manage that state during
versionchange transactions. The IDBDatabaseBackendInterface and
IDBObjectStoreBackendInterface methods will go away when
https://bugs.webkit.org/show_bug.cgi?id=98682 lands.

No new tests as this is part of a refactoring, existing indexeddb
tests cover correctness.

* Modules/indexeddb/IDBBackingStore.h:
(IDBBackingStore):
* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::createObjectStore):
* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
(WebCore::IDBDatabaseBackendImpl::createObjectStore):
(WebCore::IDBDatabaseBackendImpl::createObjectStoreInternal):
(WebCore::IDBDatabaseBackendImpl::loadObjectStores):
* Modules/indexeddb/IDBDatabaseBackendInterface.h:
(IDBDatabaseBackendInterface):
* Modules/indexeddb/IDBLevelDBBackingStore.cpp:
(WebCore::IDBLevelDBBackingStore::createObjectStore):
(WebCore::setMaxIndexId):
(WebCore::IDBLevelDBBackingStore::createIndex):
* Modules/indexeddb/IDBLevelDBBackingStore.h:
(IDBLevelDBBackingStore):
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::createIndex):
* Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl):
(WebCore::IDBObjectStoreBackendImpl::createIndex):
(WebCore::IDBObjectStoreBackendImpl::createIndexInternal):
* Modules/indexeddb/IDBObjectStoreBackendInterface.h:

Source/WebKit/chromium:

Remove support for unused createObjectStore/createIndex. These
methods will go away entirely when
https://bugs.webkit.org/show_bug.cgi?id=98682 is fixed.

* src/IDBDatabaseBackendProxy.cpp:
(WebKit::IDBDatabaseBackendProxy::createObjectStore):
* src/WebIDBDatabaseImpl.cpp:
* src/WebIDBDatabaseImpl.h:
(WebIDBDatabaseImpl):
* src/WebIDBObjectStoreImpl.cpp:
* src/WebIDBObjectStoreImpl.h:
(WebIDBObjectStoreImpl):

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

22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBBackingStore.h
Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendInterface.h
Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.h
Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebIDBDatabase.h
Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp
Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h
Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
Source/WebKit/chromium/src/WebIDBDatabaseImpl.h
Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h
Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp
Source/WebKit/chromium/tests/IDBFakeBackingStore.h

index fec886992176ac1753a458368a88c63bad1d68b8..130a56c4aed9b41697280a668e41833c36ca7798 100644 (file)
@@ -1,3 +1,43 @@
+2012-10-08  Alec Flett  <alecflett@chromium.org>
+
+        IndexedDB: remove autogenerated objectStore/index id code
+        https://bugs.webkit.org/show_bug.cgi?id=98085
+
+        Reviewed by Tony Chang.
+
+        Remove support for backend-generated objectstore and index
+        ids. The frontend objects now manage that state during
+        versionchange transactions. The IDBDatabaseBackendInterface and
+        IDBObjectStoreBackendInterface methods will go away when
+        https://bugs.webkit.org/show_bug.cgi?id=98682 lands.
+
+        No new tests as this is part of a refactoring, existing indexeddb
+        tests cover correctness.
+
+        * Modules/indexeddb/IDBBackingStore.h:
+        (IDBBackingStore):
+        * Modules/indexeddb/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::createObjectStore):
+        * Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
+        (WebCore::IDBDatabaseBackendImpl::createObjectStore):
+        (WebCore::IDBDatabaseBackendImpl::createObjectStoreInternal):
+        (WebCore::IDBDatabaseBackendImpl::loadObjectStores):
+        * Modules/indexeddb/IDBDatabaseBackendInterface.h:
+        (IDBDatabaseBackendInterface):
+        * Modules/indexeddb/IDBLevelDBBackingStore.cpp:
+        (WebCore::IDBLevelDBBackingStore::createObjectStore):
+        (WebCore::setMaxIndexId):
+        (WebCore::IDBLevelDBBackingStore::createIndex):
+        * Modules/indexeddb/IDBLevelDBBackingStore.h:
+        (IDBLevelDBBackingStore):
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::createIndex):
+        * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
+        (WebCore::IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl):
+        (WebCore::IDBObjectStoreBackendImpl::createIndex):
+        (WebCore::IDBObjectStoreBackendImpl::createIndexInternal):
+        * Modules/indexeddb/IDBObjectStoreBackendInterface.h:
+
 2012-10-08  Jaehun Lim  <ljaehun.lim@samsung.com>
 
         [CAIRO] Adjust the source rect size when IMAGE_DECODER_DOWN_SAMPLING is enabled
index 0a74e74902765767e4db4314ef0787ae28760fb8..cc197c217fe65eda92ce0425454bb436adc79371 100644 (file)
@@ -46,10 +46,6 @@ class IDBBackingStore : public RefCounted<IDBBackingStore> {
 public:
     class Transaction;
 
-    // FIXME: Remove these when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    static const int64_t AutogenerateIndexId = -1;
-    static const int64_t AutogenerateObjectStoreId = -1;
-
     virtual ~IDBBackingStore() {};
 
     virtual void getDatabaseNames(Vector<String>& foundNames) = 0;
@@ -60,7 +56,7 @@ public:
     virtual bool deleteDatabase(const String& name) = 0;
 
     virtual void getObjectStores(int64_t databaseId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<IDBKeyPath>& foundKeyPaths, Vector<bool>& foundAutoIncrementFlags, Vector<int64_t>& foundMaxIndexIds) = 0;
-    virtual bool createObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId, const String& name, const IDBKeyPath&, bool autoIncrement, int64_t& assignedObjectStoreId) = 0;
+    virtual bool createObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId, const String& name, const IDBKeyPath&, bool autoIncrement) = 0;
     virtual void deleteObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId) = 0;
 
     class ObjectStoreRecordIdentifier : public RefCounted<ObjectStoreRecordIdentifier> {
@@ -86,7 +82,7 @@ public:
     virtual bool forEachObjectStoreRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, ObjectStoreRecordCallback&) = 0;
 
     virtual void getIndexes(int64_t databaseId, int64_t objectStoreId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<IDBKeyPath>& foundKeyPaths, Vector<bool>& foundUniqueFlags, Vector<bool>& foundMultiEntryFlags) = 0;
-    virtual bool createIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry, int64_t& assignedIndexId) = 0;
+    virtual bool createIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry) = 0;
     virtual void deleteIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId) = 0;
     virtual bool putIndexDataForRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const ObjectStoreRecordIdentifier*) = 0;
     virtual bool deleteIndexDataForRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const ObjectStoreRecordIdentifier*) = 0;
index 0eb802f841a4a2eb82b00aef2010f511c7642602..16e1c0d7cd231773ee1721e37245e768fe4fa173 100644 (file)
@@ -161,13 +161,13 @@ PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, co
         return 0;
     }
 
-    RefPtr<IDBObjectStoreBackendInterface> objectStoreBackend = m_backend->createObjectStore(name, keyPath, autoIncrement, m_versionChangeTransaction->backend(), ec);
+    int64_t objectStoreId = m_metadata.maxObjectStoreId + 1;
+    RefPtr<IDBObjectStoreBackendInterface> objectStoreBackend = m_backend->createObjectStore(objectStoreId, name, keyPath, autoIncrement, m_versionChangeTransaction->backend(), ec);
     if (!objectStoreBackend) {
         ASSERT(ec);
         return 0;
     }
 
-    int64_t objectStoreId = IDBDatabaseBackendInterface::AutogenerateObjectStoreId;
     IDBObjectStoreMetadata metadata(name, objectStoreId, keyPath, autoIncrement, IDBObjectStoreBackendInterface::MinimumIndexId);
     RefPtr<IDBObjectStore> objectStore = IDBObjectStore::create(metadata, objectStoreBackend.release(), m_versionChangeTransaction.get());
     m_metadata.objectStores.set(name, metadata);
index 805f86d842c8dfdec8dbd95ce4e3f28b7b5a12bc..2b9427c5ace774f5bf738bdf2024d3d2d71d8161 100644 (file)
@@ -174,16 +174,10 @@ IDBDatabaseMetadata IDBDatabaseBackendImpl::metadata() const
     return metadata;
 }
 
-PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
-{
-    return createObjectStore(AutogenerateObjectStoreId, name, keyPath, autoIncrement, transactionPtr, ec);
-}
-
 PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectStore(int64_t id, const String& name, const IDBKeyPath& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
 {
     ASSERT(!m_objectStores.contains(name));
 
-    COMPILE_ASSERT(AutogenerateObjectStoreId == IDBBackingStore::AutogenerateObjectStoreId, AutogenerateObjectStoreIdMatches);
     RefPtr<IDBObjectStoreBackendImpl> objectStore = IDBObjectStoreBackendImpl::create(this, id, name, keyPath, autoIncrement, IDBObjectStoreBackendInterface::MinimumIndexId);
     ASSERT(objectStore->name() == name);
 
@@ -191,7 +185,7 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectS
     ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE);
 
     // FIXME: Fix edge cases around transaction aborts that prevent this from just being ASSERT(id == m_maxObjectStoreId + 1)
-    ASSERT(id == AutogenerateObjectStoreId || id > m_maxObjectStoreId);
+    ASSERT(id > m_maxObjectStoreId);
     m_maxObjectStoreId = id;
 
     RefPtr<IDBDatabaseBackendImpl> database = this;
@@ -208,16 +202,11 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectS
 
 void IDBDatabaseBackendImpl::createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendImpl> transaction)
 {
-    int64_t objectStoreId;
-
-    if (!database->m_backingStore->createObjectStore(transaction->backingStoreTransaction(), database->id(), objectStore->id(), objectStore->name(), objectStore->keyPath(), objectStore->autoIncrement(), objectStoreId)) {
+    if (!database->m_backingStore->createObjectStore(transaction->backingStoreTransaction(), database->id(), objectStore->id(), objectStore->name(), objectStore->keyPath(), objectStore->autoIncrement())) {
         transaction->abort();
         return;
     }
 
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    ASSERT(objectStore->id() == AutogenerateObjectStoreId || objectStore->id() == objectStoreId);
-    objectStore->setId(objectStoreId);
     transaction->didCompleteTaskEvents();
 }
 
index 1994b5f9b54188977317ffb49015e6f422b31a82..97b855dae40c006a21da76cb97b3830cf9741366 100644 (file)
@@ -61,7 +61,6 @@ public:
 
     // IDBDatabaseBackendInterface
     virtual IDBDatabaseMetadata metadata() const;
-    virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(int64_t id, const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual void deleteObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, ExceptionCode&);
index a32a96bca058b0e82f9075c5341d5dc39870261a..4cd0845b436b27487b1dc157a18817d1fbe17c49 100644 (file)
@@ -54,12 +54,7 @@ public:
 
     virtual IDBDatabaseMetadata metadata() const = 0;
 
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    static const int64_t AutogenerateObjectStoreId = -1;
-
     virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(int64_t, const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
     virtual void deleteObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
     virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, ExceptionCode&) = 0;
     virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, ExceptionCode&) = 0;
index 8c305bca3778ad8977d1b76eec7bdb1eb419b7da..62209e60b88cdcf6595ea1530d9fba4351de9e24 100644 (file)
@@ -537,14 +537,10 @@ static bool setMaxObjectStoreId(LevelDBTransaction* transaction, int64_t databas
     return putInt(transaction, maxObjectStoreIdKey, objectStoreId);
 }
 
-bool IDBLevelDBBackingStore::createObjectStore(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const String& name, const IDBKeyPath& keyPath, bool autoIncrement, int64_t& assignedObjectStoreId)
+bool IDBLevelDBBackingStore::createObjectStore(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const String& name, const IDBKeyPath& keyPath, bool autoIncrement)
 {
     IDB_TRACE("IDBLevelDBBackingStore::createObjectStore");
     LevelDBTransaction* levelDBTransaction = Transaction::levelDBTransactionFrom(transaction);
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    if (objectStoreId == AutogenerateObjectStoreId)
-        objectStoreId = getMaxObjectStoreId(levelDBTransaction, databaseId) + 1;
-
     if (!setMaxObjectStoreId(levelDBTransaction, databaseId, objectStoreId))
         return false;
 
@@ -612,9 +608,6 @@ bool IDBLevelDBBackingStore::createObjectStore(IDBBackingStore::Transaction* tra
         return false;
     }
 
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    assignedObjectStoreId = objectStoreId;
-
     return true;
 }
 
@@ -942,17 +935,6 @@ void IDBLevelDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreI
     }
 }
 
-static int64_t getMaxIndexId(LevelDBTransaction* transaction, int64_t databaseId, int64_t objectStoreId)
-{
-    int64_t maxIndexId = -1;
-    const Vector<char> maxIndexIdKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::MaxIndexId);
-    if (!getInt(transaction, maxIndexIdKey, maxIndexId))
-        maxIndexId = MinimumIndexId;
-
-    ASSERT(maxIndexId >= 0);
-    return maxIndexId;
-}
-
 static bool setMaxIndexId(LevelDBTransaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t indexId)
 {
     int64_t maxIndexId = -1;
@@ -960,10 +942,6 @@ static bool setMaxIndexId(LevelDBTransaction* transaction, int64_t databaseId, i
     if (!getInt(transaction, maxIndexIdKey, maxIndexId))
         maxIndexId = MinimumIndexId;
 
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    if (indexId == IDBBackingStore::AutogenerateIndexId)
-        indexId = maxIndexId + 1;
-
     if (indexId <= maxIndexId) {
         LOG_ERROR("Possible corruption: new index id is too small.");
         return false;
@@ -972,14 +950,10 @@ static bool setMaxIndexId(LevelDBTransaction* transaction, int64_t databaseId, i
     return putInt(transaction, maxIndexIdKey, indexId);
 }
 
-bool IDBLevelDBBackingStore::createIndex(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath& keyPath, bool isUnique, bool isMultiEntry, int64_t& assignedIndexId)
+bool IDBLevelDBBackingStore::createIndex(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath& keyPath, bool isUnique, bool isMultiEntry)
 {
     IDB_TRACE("IDBLevelDBBackingStore::createIndex");
     LevelDBTransaction* levelDBTransaction = Transaction::levelDBTransactionFrom(transaction);
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    if (indexId == AutogenerateIndexId)
-        indexId = getMaxIndexId(levelDBTransaction, databaseId, objectStoreId) + 1;
-
     if (!setMaxIndexId(levelDBTransaction, databaseId, objectStoreId, indexId))
         return false;
 
@@ -1012,9 +986,6 @@ bool IDBLevelDBBackingStore::createIndex(IDBBackingStore::Transaction* transacti
         return false;
     }
 
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    assignedIndexId = indexId;
-
     return true;
 }
 
index eea23d294f0e9406751877233a02efd3764f112a..caa57f514b5998d4e8b42881ad12a1479f3eb88d 100644 (file)
@@ -52,7 +52,7 @@ public:
     virtual bool deleteDatabase(const String& name);
 
     virtual void getObjectStores(int64_t databaseId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<IDBKeyPath>& foundKeyPaths, Vector<bool>& foundAutoIncrementFlags, Vector<int64_t>& foundMaxIndexIds);
-    virtual bool createObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const String& name, const IDBKeyPath&, bool autoIncrement, int64_t& assignedObjectStoreId);
+    virtual bool createObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const String& name, const IDBKeyPath&, bool autoIncrement);
     virtual void deleteObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId);
     virtual PassRefPtr<ObjectStoreRecordIdentifier> createInvalidRecordIdentifier();
     virtual String getObjectStoreRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&);
@@ -66,7 +66,7 @@ public:
     virtual bool forEachObjectStoreRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, ObjectStoreRecordCallback&);
 
     virtual void getIndexes(int64_t databaseId, int64_t objectStoreId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<IDBKeyPath>& foundKeyPaths, Vector<bool>& foundUniqueFlags, Vector<bool>& foundMultiEntryFlags);
-    virtual bool createIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry, int64_t& assignedIndexId);
+    virtual bool createIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry);
     virtual void deleteIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId);
     virtual bool putIndexDataForRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const ObjectStoreRecordIdentifier*);
     virtual bool deleteIndexDataForRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const ObjectStoreRecordIdentifier*);
index 4bbbb9501552e0dfc90aed152da7eed6f8144bea..64b4dd7762416eca326439a0eda6577ac11f0e0a 100644 (file)
@@ -401,8 +401,8 @@ PassRefPtr<IDBIndex> IDBObjectStore::createIndex(ScriptExecutionContext* context
         return 0;
     }
 
-    int64_t indexId = IDBObjectStoreBackendInterface::AutogenerateIndexId;
-    RefPtr<IDBIndexBackendInterface> indexBackend = m_backend->createIndex(name, keyPath, unique, multiEntry, m_transaction->backend(), ec);
+    int64_t indexId = m_metadata.maxIndexId + 1;
+    RefPtr<IDBIndexBackendInterface> indexBackend = m_backend->createIndex(indexId, name, keyPath, unique, multiEntry, m_transaction->backend(), ec);
     ASSERT(!indexBackend != !ec); // If we didn't get an index, we should have gotten an exception code. And vice versa.
     if (ec)
         return 0;
index 5360df1e5030caf7f15e259ceeb8585a023181b7..0f08c303ae833109430ebb2594994ab3b12ced30 100644 (file)
@@ -59,8 +59,7 @@ IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(const IDBDatabaseBackendImp
     , m_autoIncrement(autoIncrement)
     , m_maxIndexId(maxIndexId)
 {
-    if (m_id != AutogenerateIndexId)
-        loadIndexes();
+    loadIndexes();
 }
 
 IDBObjectStoreMetadata IDBObjectStoreBackendImpl::metadata() const
@@ -427,22 +426,16 @@ void IDBObjectStoreBackendImpl::clearInternal(ScriptExecutionContext*, PassRefPt
     callbacks->onSuccess(SerializedScriptValue::undefinedValue());
 }
 
-PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
-{
-    return createIndex(AutogenerateIndexId, name, keyPath, unique, multiEntry, transactionPtr, ec);
-}
-
 PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(int64_t id, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
 {
     ASSERT_WITH_MESSAGE(!m_indexes.contains(name), "Indexes already contain %s", name.utf8().data());
 
-    COMPILE_ASSERT(AutogenerateIndexId == IDBBackingStore::AutogenerateIndexId, AutogenerateIndexIdMatches);
     RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(m_database, this, id, name, keyPath, unique, multiEntry);
     ASSERT(index->name() == name);
 
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
     ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE);
-    ASSERT(id == AutogenerateIndexId || id > m_maxIndexId);
+    ASSERT(id > m_maxIndexId);
     m_maxIndexId = id;
 
     RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
@@ -459,16 +452,11 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(int6
 
 void IDBObjectStoreBackendImpl::createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendImpl> transaction)
 {
-    int64_t id;
-    if (!objectStore->backingStore()->createIndex(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), index->id(), index->name(), index->keyPath(), index->unique(), index->multiEntry(), id)) {
+    if (!objectStore->backingStore()->createIndex(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), index->id(), index->name(), index->keyPath(), index->unique(), index->multiEntry())) {
         transaction->abort();
         return;
     }
 
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    ASSERT(index->id() == AutogenerateIndexId || index->id() == id);
-    index->setId(id);
-
     transaction->didCompleteTaskEvents();
 }
 
index b5dacab9fc4696c39f8a6cbde0a4e25c054c77c5..08ee01ea398a1e2a4de9fb53c5b69d28275a9a02 100644 (file)
@@ -69,8 +69,6 @@ public:
     virtual void deleteFunction(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual void clear(PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
 
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    virtual PassRefPtr<IDBIndexBackendInterface> createIndex(const String& name, const IDBKeyPath&, bool unique, bool multiEntry, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual PassRefPtr<IDBIndexBackendInterface> createIndex(int64_t, const String& name, const IDBKeyPath&, bool unique, bool multiEntry, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual void setIndexKeys(PassRefPtr<IDBKey> prpPrimaryKey, const Vector<String>&, const Vector<IndexKeys>& , IDBTransactionBackendInterface*);
     virtual void setIndexesReady(const Vector<String>&, IDBTransactionBackendInterface*);
index 2eb5a86085d74806498fbf5598fc9dabaf84f4c2..4353db9ff1cd2b0935de25c6d2d5e9e0ab06be22 100644 (file)
@@ -58,8 +58,6 @@ public:
     };
 
     static const int64_t MinimumIndexId = 30;
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    static const int64_t AutogenerateIndexId = -1;
 
     typedef Vector<RefPtr<IDBKey> > IndexKeys;
 
@@ -69,8 +67,6 @@ public:
     virtual void clear(PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
 
     virtual PassRefPtr<IDBIndexBackendInterface> createIndex(int64_t, const String& name, const IDBKeyPath&, bool unique, bool multiEntry, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
-    // FIXME: Remove this when switch to front-end ID management is complete: https://bugs.webkit.org/show_bug.cgi?id=98085
-    virtual PassRefPtr<IDBIndexBackendInterface> createIndex(const String& name, const IDBKeyPath&, bool unique, bool multiEntry, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
     virtual void setIndexKeys(PassRefPtr<IDBKey> prpPrimaryKey, const Vector<String>&, const Vector<IndexKeys>&, IDBTransactionBackendInterface*) = 0;
     virtual void setIndexesReady(const Vector<String>&, IDBTransactionBackendInterface*) = 0;
     virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name, ExceptionCode&) = 0;
index 772e5a4c1199d7ef795438f0d938159396134d4f..4e0d8f744b11eb26b117fbe4007bbb5d0bcdafb3 100644 (file)
@@ -1,3 +1,23 @@
+2012-10-08  Alec Flett  <alecflett@chromium.org>
+
+        IndexedDB: remove autogenerated objectStore/index id code
+        https://bugs.webkit.org/show_bug.cgi?id=98085
+
+        Reviewed by Tony Chang.
+
+        Remove support for unused createObjectStore/createIndex. These
+        methods will go away entirely when
+        https://bugs.webkit.org/show_bug.cgi?id=98682 is fixed.
+
+        * src/IDBDatabaseBackendProxy.cpp:
+        (WebKit::IDBDatabaseBackendProxy::createObjectStore):
+        * src/WebIDBDatabaseImpl.cpp:
+        * src/WebIDBDatabaseImpl.h:
+        (WebIDBDatabaseImpl):
+        * src/WebIDBObjectStoreImpl.cpp:
+        * src/WebIDBObjectStoreImpl.h:
+        (WebIDBObjectStoreImpl):
+
 2012-10-08  Sami Kyostila  <skyostil@chromium.org>
 
         Some non-scrollable elements are added to non-fast-scrollable region
index 16cfbd85db4613b4df3ffd8cfaaaf14690fce4b5..a4932ee28240062d157fcd02a59a7b2f370e172b 100644 (file)
@@ -50,11 +50,6 @@ public:
         WEBKIT_ASSERT_NOT_REACHED();
         return WebIDBMetadata();
     }
-    virtual WebIDBObjectStore* createObjectStore(const WebString&, const WebIDBKeyPath&, bool, const WebIDBTransaction&, WebExceptionCode&)
-    {
-        WEBKIT_ASSERT_NOT_REACHED();
-        return 0;
-    }
     virtual WebIDBObjectStore* createObjectStore(long long, const WebString&, const WebIDBKeyPath&, bool, const WebIDBTransaction&, WebExceptionCode&)
     {
         WEBKIT_ASSERT_NOT_REACHED();
index 8b1fbc405caa19090ec0300482857464c0f4c420..29b8c4bf41dcaafa619eb6a0d1a151114c291e53 100644 (file)
@@ -77,17 +77,6 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendProxy::createObject
     return IDBObjectStoreBackendProxy::create(objectStore.release());
 }
 
-PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendProxy::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
-{
-    // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
-    // all implementations of IDB interfaces are proxy objects.
-    IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
-    OwnPtr<WebIDBObjectStore> objectStore = adoptPtr(m_webIDBDatabase->createObjectStore(name, keyPath, autoIncrement, *transactionProxy->getWebIDBTransaction(), ec));
-    if (!objectStore)
-        return 0;
-    return IDBObjectStoreBackendProxy::create(objectStore.release());
-}
-
 void IDBDatabaseBackendProxy::deleteObjectStore(const String& name, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
 {
     // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
index ea693ada17e3a51ecb19a09da346b7dc1fca1056..fc831e8dec49a79e61ca7cbcef5b467d1c4bd5fd 100644 (file)
@@ -44,7 +44,6 @@ public:
 
     virtual WebCore::IDBDatabaseMetadata metadata() const;
 
-    virtual PassRefPtr<WebCore::IDBObjectStoreBackendInterface> createObjectStore(const String& name, const WebCore::IDBKeyPath&, bool autoIncrement, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
     virtual PassRefPtr<WebCore::IDBObjectStoreBackendInterface> createObjectStore(int64_t, const String& name, const WebCore::IDBKeyPath&, bool autoIncrement, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
     virtual void deleteObjectStore(const String& name, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
     virtual void setVersion(const String& version, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::IDBDatabaseCallbacks>, WebCore::ExceptionCode&);
index aefeb0faf6c1b3d4c612f75626be91d2295bff52..e71029deb3484715b130d3a1b8fcd3f608cb06cb 100644 (file)
@@ -70,16 +70,6 @@ WebIDBObjectStore* WebIDBDatabaseImpl::createObjectStore(long long id, const Web
     return new WebIDBObjectStoreImpl(objectStore);
 }
 
-WebIDBObjectStore* WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebIDBKeyPath& keyPath, bool autoIncrement, const WebIDBTransaction& transaction, WebExceptionCode& ec)
-{
-    RefPtr<IDBObjectStoreBackendInterface> objectStore = m_databaseBackend->createObjectStore(name, keyPath, autoIncrement, transaction.getIDBTransactionBackendInterface(), ec);
-    if (!objectStore) {
-        ASSERT(ec);
-        return 0;
-    }
-    return new WebIDBObjectStoreImpl(objectStore);
-}
-
 void WebIDBDatabaseImpl::deleteObjectStore(const WebString& name, const WebIDBTransaction& transaction, WebExceptionCode& ec)
 {
     m_databaseBackend->deleteObjectStore(name, transaction.getIDBTransactionBackendInterface(), ec);
index 849969cb4ba28f058a5152f9388923faaf1caa74..769bdf5d05f0b3bb1e8b65f4e09fc3275ebca860 100644 (file)
@@ -52,7 +52,6 @@ public:
 
     virtual WebIDBMetadata metadata() const;
 
-    virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebIDBKeyPath&, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&);
     virtual WebIDBObjectStore* createObjectStore(long long, const WebString& name, const WebIDBKeyPath&, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&);
     virtual void deleteObjectStore(const WebString& name, const WebIDBTransaction&, WebExceptionCode&);
     virtual void setVersion(const WebString& version, WebIDBCallbacks*, WebExceptionCode&);
index 198a287886a268de8244bb47936f87af0e10b66e..d814093f0f5b341eb2d99d97c91828ac50520d45 100755 (executable)
@@ -109,14 +109,6 @@ void WebIDBObjectStoreImpl::clear(WebIDBCallbacks* callbacks, const WebIDBTransa
     m_objectStore->clear(IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec);
 }
 
-WebIDBIndex* WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebIDBKeyPath& keyPath, bool unique, bool multiEntry, const WebIDBTransaction& transaction, WebExceptionCode& ec)
-{
-    RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, multiEntry, transaction.getIDBTransactionBackendInterface(), ec);
-    if (!index)
-        return 0;
-    return new WebIDBIndexImpl(index);
-}
-
 WebIDBIndex* WebIDBObjectStoreImpl::createIndex(long long id, const WebString& name, const WebIDBKeyPath& keyPath, bool unique, bool multiEntry, const WebIDBTransaction& transaction, WebExceptionCode& ec)
 {
     RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(id, name, keyPath, unique, multiEntry, transaction.getIDBTransactionBackendInterface(), ec);
index 902641a0194f7873914164b026f40db9a4560848..7e9ed2573cb94b897bcf5875a52322761b14308d 100644 (file)
@@ -52,7 +52,6 @@ public:
     void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
     void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
 
-    WebIDBIndex* createIndex(const WebString& name, const WebIDBKeyPath&, bool unique, bool multiEntry, const WebIDBTransaction&, WebExceptionCode&);
     WebIDBIndex* createIndex(long long, const WebString& name, const WebIDBKeyPath&, bool unique, bool multiEntry, const WebIDBTransaction&, WebExceptionCode&);
     WebIDBIndex* index(const WebString& name, WebExceptionCode&);
     void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&);
index 216c893846775cf5bd2f45c8a3ec0e6685e0e79b..2cf2a1f887d776302b97bc5f8c78ebc5043fb783 100644 (file)
@@ -57,7 +57,7 @@ TEST(IDBDatabaseBackendTest, BackingStoreRetention)
     EXPECT_GT(backingStore->refCount(), 1);
 
     const bool autoIncrement = false;
-    RefPtr<IDBObjectStoreBackendImpl> store = IDBObjectStoreBackendImpl::create(db.get(), IDBDatabaseBackendInterface::AutogenerateObjectStoreId, "store", IDBKeyPath("keyPath"), autoIncrement, 0);
+    RefPtr<IDBObjectStoreBackendImpl> store = IDBObjectStoreBackendImpl::create(db.get(), 1, "store", IDBKeyPath("keyPath"), autoIncrement, 0);
     EXPECT_GT(backingStore->refCount(), 1);
 
     const bool unique = false;
@@ -148,7 +148,6 @@ public:
     }
 
     virtual IDBDatabaseMetadata metadata() const { return IDBDatabaseMetadata(); }
-    virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&) { return 0; }
     virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(int64_t, const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&) { return 0; }
     virtual void deleteObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&) { }
     virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, ExceptionCode&) { }
index 75e06585ed93f729c835d4a5bfce69d0e5c106f1..c59dce67517e1f63e1d3b336457eb654f32a41d6 100644 (file)
@@ -40,7 +40,7 @@ public:
     virtual bool deleteDatabase(const String& name) OVERRIDE { return false; }
 
     virtual void getObjectStores(int64_t databaseId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<IDBKeyPath>& foundKeyPaths, Vector<bool>& foundAutoIncrementFlags, Vector<int64_t>& foundMaxIndexIds) OVERRIDE { }
-    virtual bool createObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId, const String& name, const IDBKeyPath&, bool autoIncrement, int64_t& assignedObjectStoreId) OVERRIDE { return false; }
+    virtual bool createObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId, const String& name, const IDBKeyPath&, bool autoIncrement) OVERRIDE { return false; };
     virtual void deleteObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId) OVERRIDE { }
 
     virtual PassRefPtr<ObjectStoreRecordIdentifier> createInvalidRecordIdentifier() OVERRIDE { return PassRefPtr<ObjectStoreRecordIdentifier>(); }
@@ -56,7 +56,7 @@ public:
     virtual bool forEachObjectStoreRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, ObjectStoreRecordCallback&) OVERRIDE { return false; }
 
     virtual void getIndexes(int64_t databaseId, int64_t objectStoreId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<IDBKeyPath>& foundKeyPaths, Vector<bool>& foundUniqueFlags, Vector<bool>& foundMultiEntryFlags) OVERRIDE { }
-    virtual bool createIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry, int64_t& assignedIndexId) OVERRIDE { return false; };
+    virtual bool createIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry) OVERRIDE { return false; };
     virtual void deleteIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId) OVERRIDE { }
     virtual bool putIndexDataForRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const ObjectStoreRecordIdentifier*) OVERRIDE { return false; }
     virtual bool deleteIndexDataForRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const ObjectStoreRecordIdentifier*) OVERRIDE { return false; }