WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-90923-20120711173717.patch (text/plain), 30.31 KB, created by
Alec Flett
on 2012-07-11 17:37:18 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alec Flett
Created:
2012-07-11 17:37:18 PDT
Size:
30.31 KB
patch
obsolete
>Subversion Revision: 122309 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 11c2f1295516d3bf6f2a229777358ef310a2dca2..609f0e88c8f9969eccbf6b7a431ec673114493e9 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,42 @@ >+2012-07-10 Alec Flett <alecflett@chromium.org> >+ >+ IndexedDB: Introduce putWithIndexKeys and calculate them in the renderer >+ https://bugs.webkit.org/show_bug.cgi?id=90923 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Refactor IndexWriter to depend only on IDBIndexMetadata and on >+ (databaseId, objectStoreId, indexId) so that it can talk directly >+ to the backing store, and also eventually be moved into the renderer. >+ >+ This also introduces IDBObjectStoreBackendInterface::putWithIndexKeys >+ as a replacement for IDBObjectStoreBackendInterface::put, already >+ stubbed out in the chromium port. It will fully replace put() >+ after both chromium and webkit sides have reached alignment. >+ >+ No new tests as this is just a refactor and existing tests cover >+ correctness. >+ >+ * Modules/indexeddb/IDBCursor.cpp: >+ (WebCore::IDBCursor::setValueReady): >+ * Modules/indexeddb/IDBIndexBackendImpl.cpp: >+ * Modules/indexeddb/IDBIndexBackendImpl.h: >+ * Modules/indexeddb/IDBObjectStore.cpp: >+ (WebCore::IDBObjectStore::put): >+ * Modules/indexeddb/IDBObjectStore.h: >+ (IDBObjectStore): >+ * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: >+ (WebCore::IDBObjectStoreBackendImpl::put): >+ (WebCore): >+ (WebCore::IDBObjectStoreBackendImpl::putWithIndexKeys): >+ (WebCore::IDBObjectStoreBackendImpl::putInternal): >+ (WebCore::IDBObjectStoreBackendImpl::populateIndex): >+ * Modules/indexeddb/IDBObjectStoreBackendImpl.h: >+ (IDBObjectStoreBackendImpl): >+ * Modules/indexeddb/IDBObjectStoreBackendInterface.h: >+ * Modules/indexeddb/IDBRequest.cpp: >+ (WebCore::IDBRequest::onSuccess): >+ > 2012-07-11 Kenneth Russell <kbr@google.com> > > compositing/webgl/webgl-nonpremultiplied-blend.html is flaky on Lion >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index cecad08178f66b84b6e7b384c8e7c76383257648..976add5a95689889f4f2c979ab5a154990d0ca3d 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,21 @@ >+2012-07-10 Alec Flett <alecflett@chromium.org> >+ >+ IndexedDB: Introduce putWithIndexKeys and calculate them in the renderer >+ https://bugs.webkit.org/show_bug.cgi?id=90923 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Stub out implementations of putWithIndexKeys(), already implemented >+ on the chromium side. >+ >+ * public/WebIDBObjectStore.h: >+ (WebKit::WebIDBObjectStore::putWithIndexKeys): >+ * src/IDBObjectStoreBackendProxy.cpp: >+ (WebKit::IDBObjectStoreBackendProxy::putWithIndexKeys): >+ (WebKit): >+ * src/IDBObjectStoreBackendProxy.h: >+ (IDBObjectStoreBackendProxy): >+ > 2012-07-10 Hayato Ito <hayato@chromium.org> > > Unreviewed gardening. >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >index 5e9025112ee6bb9cd9880595a290e6293ecb7a29..6e28691af0b7716c90656c86b5c887045c7b57e0 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >@@ -276,6 +276,7 @@ void IDBCursor::setValueReady() > if (objectStore->autoIncrement() && !objectStore->metadata().keyPath.isNull()) { > const IDBKeyPath& keyPath = objectStore->metadata().keyPath; > RefPtr<IDBKey> expectedKey = createIDBKeyFromSerializedValueAndKeyPath(value, keyPath); >+ ASSERT(m_currentPrimaryKey); > ASSERT(expectedKey->isEqual(m_currentPrimaryKey.get())); > } > } >diff --git a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp >index a087e6aaf2f524235f8507a6ef48e5b2ec7d9ee7..afdb7ec3c6d45ed73ff75715d645b2afb470af3b 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp >@@ -219,20 +219,6 @@ void IDBIndexBackendImpl::getKey(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr > ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; > } > >-bool IDBIndexBackendImpl::addingKeyAllowed(const IDBKey* indexKey, const IDBKey* primaryKey) >-{ >- if (!m_unique) >- return true; >- >- RefPtr<IDBKey> foundPrimaryKey; >- bool found = backingStore()->keyExistsInIndex(databaseId(), m_objectStoreBackend->id(), m_id, *indexKey, foundPrimaryKey); >- if (!found) >- return true; >- if (primaryKey && foundPrimaryKey->isEqual(primaryKey)) >- return true; >- return false; >-} >- > } // namespace WebCore > > #endif // ENABLE(INDEXED_DATABASE) >diff --git a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h >index 98385128f28baca545369113fad69210c23501fb..f841a95837244c2fd0828804a6901344d85a525c 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h >+++ b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h >@@ -61,8 +61,6 @@ public: > void setId(int64_t id) { m_id = id; } > bool hasValidId() const { return m_id != InvalidId; }; > >- bool addingKeyAllowed(const IDBKey* indexKey, const IDBKey* primaryKey = 0); >- > // Implements IDBIndexBackendInterface. > virtual IDBIndexMetadata metadata() const; > >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >index 65f222bf8565e6b301faa455da7d8b1f0f327240..ec66375d514f7a9f288290d00598c9b3972e0d33 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >@@ -455,7 +455,6 @@ void IDBObjectStore::transactionFinished() > m_indexMap.clear(); > } > >- > } // namespace WebCore > > #endif // ENABLE(INDEXED_DATABASE) >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.h b/Source/WebCore/Modules/indexeddb/IDBObjectStore.h >index 67b36f995517a9b84d2a1c22524958fcdaa484ce..ef7c063b8f8226417a7bff8f2fe13698243b8537 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.h >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.h >@@ -102,6 +102,9 @@ public: > IDBObjectStoreMetadata metadata() const { return m_metadata; } > void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = metadata; } > >+ typedef Vector<RefPtr<IDBKey> > IndexKeys; >+ typedef HashMap<String, IndexKeys> IndexKeyMap; >+ > private: > IDBObjectStore(const IDBObjectStoreMetadata&, PassRefPtr<IDBObjectStoreBackendInterface>, IDBTransaction*); > >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >index 474cdeb5b5a2c8841a1fcadf98ff62322fdf04dc..e94a2d3a2d3af2f7ed5b1c86788d23accdd46e94 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >@@ -141,9 +141,11 @@ static PassRefPtr<SerializedScriptValue> injectKeyIntoKeyPath(PassRefPtr<IDBKey> > return IDBKeyPathBackendImpl::injectIDBKeyIntoSerializedValue(key, value, keyPath); > } > >+// FIXME: Remove this method when get-side key injection is the norm. > void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) > { > IDB_TRACE("IDBObjectStoreBackendImpl::put"); >+ IDB_TRACE("IDBObjectStoreBackendImpl::putWithIndexKeys"); > > ASSERT(transactionPtr->mode() != IDBTransaction::READ_ONLY); > >@@ -153,8 +155,33 @@ void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, > RefPtr<IDBCallbacks> callbacks = prpCallbacks; > RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; > >+ // null pointers here signifiy that index keys should be generated as a part of this put. >+ OwnPtr<Vector<String> > nullIndexNames; >+ OwnPtr<Vector<IndexKeys> > nullIndexKeys; > if (!transaction->scheduleTask( >- createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction), >+ createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction, nullIndexNames.release(), nullIndexKeys.release()), >+ // FIXME: One of these per put() is overkill, since it's simply a cache invalidation. >+ createCallbackTask(&IDBObjectStoreBackendImpl::revertAutoIncrementKeyCache, objectStore))) >+ ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; >+} >+ >+void IDBObjectStoreBackendImpl::putWithIndexKeys(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, const Vector<String>& indexNames, const Vector<IndexKeys>& indexKeys, ExceptionCode& ec) >+{ >+ IDB_TRACE("IDBObjectStoreBackendImpl::putWithIndexKeys"); >+ >+ ASSERT(transactionPtr->mode() != IDBTransaction::READ_ONLY); >+ >+ RefPtr<IDBObjectStoreBackendImpl> objectStore = this; >+ RefPtr<SerializedScriptValue> value = prpValue; >+ RefPtr<IDBKey> key = prpKey; >+ RefPtr<IDBCallbacks> callbacks = prpCallbacks; >+ RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; >+ >+ OwnPtr<Vector<String> > newIndexNames = adoptPtr(new Vector<String>(indexNames)); >+ OwnPtr<Vector<IndexKeys> > newIndexKeys = adoptPtr(new Vector<IndexKeys>(indexKeys)); >+ >+ if (!transaction->scheduleTask( >+ createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction, newIndexNames.release(), newIndexKeys.release()), > // FIXME: One of these per put() is overkill, since it's simply a cache invalidation. > createCallbackTask(&IDBObjectStoreBackendImpl::revertAutoIncrementKeyCache, objectStore))) > ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; >@@ -168,72 +195,102 @@ void IDBObjectStoreBackendImpl::revertAutoIncrementKeyCache(ScriptExecutionConte > namespace { > class IndexWriter { > public: >- explicit IndexWriter(PassRefPtr<IDBIndexBackendImpl> index) >- : m_index(index) >- { >- } >+ explicit IndexWriter(const IDBIndexMetadata& indexMetadata) >+ : m_indexMetadata(indexMetadata) >+ { } >+ >+ IndexWriter(const IDBIndexMetadata& indexMetadata, >+ const IDBObjectStoreBackendInterface::IndexKeys& indexKeys) >+ : m_indexMetadata(indexMetadata) >+ , m_indexKeys(indexKeys) >+ { } > >- bool loadIndexKeysForValue(SerializedScriptValue* objectValue, const IDBKey* primaryKey = 0, String* errorMessage = 0) >+ bool generateIndexKeysForValue(SerializedScriptValue* objectValue) > { > m_indexKeys.clear(); > >- RefPtr<IDBKey> indexKey = fetchKeyFromKeyPath(objectValue, m_index->keyPath()); >+ RefPtr<IDBKey> indexKey = fetchKeyFromKeyPath(objectValue, m_indexMetadata.keyPath); > > if (!indexKey) > return true; > >- if (!m_index->multiEntry() || indexKey->type() != IDBKey::ArrayType) { >+ if (!m_indexMetadata.multiEntry || indexKey->type() != IDBKey::ArrayType) { > if (!indexKey->isValid()) > return true; > >- if (!m_index->addingKeyAllowed(indexKey.get(), primaryKey)) { >- if (errorMessage) >- *errorMessage = String::format("Unable to add key to index '%s': the key does not satisfy its uniqueness requirements.", >- m_index->name().utf8().data()); >- return false; >- } > m_indexKeys.append(indexKey); > } else { >- ASSERT(m_index->multiEntry()); >+ ASSERT(m_indexMetadata.multiEntry); > ASSERT(indexKey->type() == IDBKey::ArrayType); > indexKey = IDBKey::createMultiEntryArray(indexKey->array()); > > for (size_t i = 0; i < indexKey->array().size(); ++i) { >- if (!m_index->addingKeyAllowed(indexKey->array()[i].get(), primaryKey)) { >- if (errorMessage) >- *errorMessage = String::format("Unable to add key to index '%s': at least one key does not satisfy the uniqueness requirements.", >- m_index->name().utf8().data()); >- return false; >- } > m_indexKeys.append(indexKey->array()[i]); > } > } > return true; > } > >- bool writeIndexKeys(const IDBBackingStore::ObjectStoreRecordIdentifier* recordIdentifier, IDBBackingStore& backingStore, int64_t databaseId, int64_t objectStoreId, String* errorMessage = 0) >+ bool verifyIndexKeys(IDBBackingStore& backingStore, >+ int64_t databaseId, int64_t objectStoreId, int64_t indexId, >+ const IDBKey* primaryKey = 0, String* errorMessage = 0) >+ { >+ for (size_t i = 0; i < m_indexKeys.size(); ++i) { >+ if (!addingKeyAllowed(backingStore, databaseId, objectStoreId, indexId, >+ (m_indexKeys)[i].get(), primaryKey)) { >+ if (errorMessage) >+ *errorMessage = String::format("Unable to add key to index '%s': at least one key does not satisfy the uniqueness requirements.", >+ m_indexMetadata.name.utf8().data()); >+ return false; >+ } >+ } >+ return true; >+ } >+ >+ bool writeIndexKeys(const IDBBackingStore::ObjectStoreRecordIdentifier* recordIdentifier, IDBBackingStore& backingStore, int64_t databaseId, int64_t objectStoreId, int64_t indexId) const > { > for (size_t i = 0; i < m_indexKeys.size(); ++i) { >- if (!backingStore.deleteIndexDataForRecord(databaseId, objectStoreId, m_index->id(), recordIdentifier)) >+ if (!backingStore.deleteIndexDataForRecord(databaseId, objectStoreId, indexId, recordIdentifier)) > return false; >- if (!backingStore.putIndexDataForRecord(databaseId, objectStoreId, m_index->id(), *m_indexKeys[i].get(), recordIdentifier)) >+ if (!backingStore.putIndexDataForRecord(databaseId, objectStoreId, indexId, *(m_indexKeys)[i].get(), recordIdentifier)) > return false; > } > return true; > } > >+ const String& indexName() const { return m_indexMetadata.name; } >+ > private: >- RefPtr<IDBIndexBackendImpl> m_index; >- Vector<RefPtr<IDBKey> > m_indexKeys; >+ >+ bool addingKeyAllowed(IDBBackingStore& backingStore, >+ int64_t databaseId, int64_t objectStoreId, int64_t indexId, >+ const IDBKey* indexKey, const IDBKey* primaryKey) >+ { >+ if (!m_indexMetadata.unique) >+ return true; >+ >+ RefPtr<IDBKey> foundPrimaryKey; >+ bool found = backingStore.keyExistsInIndex(databaseId, objectStoreId, indexId, *indexKey, foundPrimaryKey); >+ if (!found) >+ return true; >+ if (primaryKey && foundPrimaryKey->isEqual(primaryKey)) >+ return true; >+ return false; >+ } >+ const IDBIndexMetadata m_indexMetadata; >+ IDBObjectStoreBackendInterface::IndexKeys m_indexKeys; > }; > } > >-void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction) >+void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction, PassOwnPtr<Vector<String> > popIndexNames, PassOwnPtr<Vector<IndexKeys> > popIndexKeys) > { > IDB_TRACE("IDBObjectStoreBackendImpl::putInternal"); > ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); > RefPtr<SerializedScriptValue> value = prpValue; > RefPtr<IDBKey> key = prpKey; >+ OwnPtr<Vector<String> > indexNames = popIndexNames; >+ OwnPtr<Vector<IndexKeys> > indexKeys = popIndexKeys; >+ ASSERT((!indexNames && !indexKeys) || indexNames->size() == indexKeys->size()); > > if (putMode != CursorUpdate) { > const bool autoIncrement = objectStore->autoIncrement(); >@@ -251,6 +308,7 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "Maximum key generator value reached.")); > return; > } >+ // FIXME: Remove this when get-side key injection is the norm. > if (hasKeyPath) { > RefPtr<SerializedScriptValue> valueAfterInjection = injectKeyIntoKeyPath(autoIncKey, value, objectStore->m_keyPath); > ASSERT(valueAfterInjection); >@@ -280,15 +338,31 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > } > > Vector<OwnPtr<IndexWriter> > indexWriters; >+ HashMap<String, IndexKeys> indexKeyMap; >+ if (indexKeys) { >+ for (size_t i = 0; i < indexNames->size(); i++) >+ indexKeyMap.add(indexNames->at(i), indexKeys->at(i)); >+ } >+ > for (IndexMap::iterator it = objectStore->m_indexes.begin(); it != objectStore->m_indexes.end(); ++it) { > > const RefPtr<IDBIndexBackendImpl>& index = it->second; > if (!index->hasValidId()) > continue; // The index object has been created, but does not exist in the database yet. > >- OwnPtr<IndexWriter> indexWriter(adoptPtr(new IndexWriter(index))); >+ OwnPtr<IndexWriter> indexWriter; >+ // FIXME: Turn this into an ASSERT(indexKeys) when get-side key injection is the norm. >+ if (indexKeys) >+ indexWriter = adoptPtr(new IndexWriter(index->metadata(), indexKeyMap.get(it->first))); >+ else { >+ indexWriter = adoptPtr(new IndexWriter(index->metadata())); >+ indexWriter->generateIndexKeysForValue(value.get()); >+ } > String errorMessage; >- if (!indexWriter->loadIndexKeysForValue(value.get(), key.get(), &errorMessage)) { >+ if (!indexWriter->verifyIndexKeys(*objectStore->backingStore(), >+ objectStore->databaseId(), >+ objectStore->id(), >+ index->id(), key.get(), &errorMessage)) { > objectStore->resetAutoIncrementKeyCache(); > callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, errorMessage)); > return; >@@ -306,9 +380,13 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > } > > for (size_t i = 0; i < indexWriters.size(); ++i) { >- if (!indexWriters[i]->writeIndexKeys(recordIdentifier.get(), >- *objectStore->backingStore(), objectStore->databaseId(), >- objectStore->m_id)) { >+ IndexWriter* indexWriter = indexWriters[i].get(); >+ if (!indexWriter->writeIndexKeys(recordIdentifier.get(), >+ *objectStore->backingStore(), >+ objectStore->databaseId(), >+ objectStore->m_id, >+ objectStore->m_indexes.get(indexWriter->indexName())->id())) { >+ > callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage.")); > transaction->abort(); > return; >@@ -383,33 +461,36 @@ void IDBObjectStoreBackendImpl::clearInternal(ScriptExecutionContext*, PassRefPt > namespace { > class PopulateIndexCallback : public IDBBackingStore::ObjectStoreRecordCallback { > public: >- PopulateIndexCallback(IDBBackingStore& backingStore, int64_t databaseId, int64_t objectStoreId, PassRefPtr<IDBIndexBackendImpl> index) >+ PopulateIndexCallback(IDBBackingStore& backingStore, const IDBIndexMetadata& indexMetadata, int64_t databaseId, int64_t objectStoreId, int64_t indexId) > : m_backingStore(backingStore) > , m_databaseId(databaseId) > , m_objectStoreId(objectStoreId) >- , m_writer(index) >+ , m_indexId(indexId) >+ , m_writer(indexMetadata) > { > } > > virtual bool callback(const IDBBackingStore::ObjectStoreRecordIdentifier* recordIdentifier, const String& value) > { > RefPtr<SerializedScriptValue> objectValue = SerializedScriptValue::createFromWire(value); >- if (!m_writer.loadIndexKeysForValue(objectValue.get())) >+ m_writer.generateIndexKeysForValue(objectValue.get()); >+ if (!m_writer.verifyIndexKeys(m_backingStore, m_databaseId, m_objectStoreId, m_indexId)) > return false; >- return m_writer.writeIndexKeys(recordIdentifier, m_backingStore, m_databaseId, m_objectStoreId); >+ return m_writer.writeIndexKeys(recordIdentifier, m_backingStore, m_databaseId, m_objectStoreId, m_indexId); > } > > private: > IDBBackingStore& m_backingStore; > int64_t m_databaseId; > int64_t m_objectStoreId; >+ int64_t m_indexId; > IndexWriter m_writer; > }; > } > > bool IDBObjectStoreBackendImpl::populateIndex(IDBBackingStore& backingStore, int64_t databaseId, int64_t objectStoreId, PassRefPtr<IDBIndexBackendImpl> index) > { >- PopulateIndexCallback callback(backingStore, databaseId, objectStoreId, index); >+ PopulateIndexCallback callback(backingStore, index->metadata(), databaseId, objectStoreId, index->id()); > if (!backingStore.forEachObjectStoreRecord(databaseId, objectStoreId, callback)) > return false; > return true; >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h >index 1e39ddac3051ba0cda9e8d5b910c146674f4b9e9..1c745b593dfb407dc350e229ecf130b0c53667a6 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h >@@ -67,6 +67,7 @@ public: > > virtual void get(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); > virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); >+ virtual void putWithIndexKeys(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, const Vector<String>&, const Vector<IndexKeys>&, ExceptionCode&); > virtual void deleteFunction(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); > virtual void clear(PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); > >@@ -92,7 +93,7 @@ private: > void resetAutoIncrementKeyCache() { m_autoIncrementNumber = -1; } > > static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); >- static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); >+ static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>, PassOwnPtr<Vector<String> > popIndexNames, PassOwnPtr<Vector<IndexKeys> >); > static void deleteInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); > static void clearInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBCallbacks>); > static void createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>); >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h >index 07f9f7260b2aabada46db3601aa04db07d93777d..37d3ee0f9430dc507b094e340f89c39e4a0d6d34 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h >@@ -55,7 +55,10 @@ public: > AddOnly, > CursorUpdate > }; >+ typedef Vector<RefPtr<IDBKey> > IndexKeys; >+ > virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0; >+ virtual void putWithIndexKeys(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, const Vector<String>&, const Vector<IndexKeys>&, ExceptionCode&) = 0; > virtual void deleteFunction(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0; > > virtual void clear(PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0; >diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >index 62d29234025004c598dcca2d07a69823bac384fe..63a48be935a5fb46d752f71153a6db95019b6d7f 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >@@ -332,6 +332,7 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScript > RefPtr<IDBKey> primaryKey = prpPrimaryKey; > RefPtr<IDBKey> expectedKey = > createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, keyPath); >+ ASSERT(primaryKey); > ASSERT(expectedKey->isEqual(primaryKey.get())); > #endif > onSuccess(serializedScriptValue.release()); >diff --git a/Source/WebKit/chromium/public/WebIDBObjectStore.h b/Source/WebKit/chromium/public/WebIDBObjectStore.h >index ec153a7199dd6116cd666e1e15d2d20c9dce55f6..98c4513e216477b07532ad9c0e4c810e94227b54 100644 >--- a/Source/WebKit/chromium/public/WebIDBObjectStore.h >+++ b/Source/WebKit/chromium/public/WebIDBObjectStore.h >@@ -51,7 +51,10 @@ public: > CursorUpdate > }; > >+ typedef WebVector<WebIDBKey> WebIndexKeys; >+ > virtual void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } >+ virtual void putWithIndexKeys(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, const WebVector<WebString>&, const WebVector<WebIndexKeys>&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } > virtual void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } > virtual void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } > virtual WebIDBIndex* createIndex(const WebString&, const WebIDBKeyPath&, bool, bool, const WebIDBTransaction&, WebExceptionCode&) >diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp >index 42f808c85b46ae6ad9e89380224c15a626e4521d..826407330a027a16db7fb1c3dcd0efdc1f4b3517 100755 >--- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp >+++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp >@@ -75,6 +75,16 @@ void IDBObjectStoreBackendProxy::put(PassRefPtr<SerializedScriptValue> value, Pa > m_webIDBObjectStore->put(value, key, static_cast<WebIDBObjectStore::PutMode>(putMode), new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec); > } > >+void IDBObjectStoreBackendProxy::putWithIndexKeys(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, const Vector<String>& indexNames, const Vector<IndexKeys>& indexKeys, 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); >+ WebVector<WebString> webIndexNames(indexNames); >+ WebVector<IndexKeys> webIndexKeys(indexKeys); >+ m_webIDBObjectStore->putWithIndexKeys(value, key, static_cast<WebIDBObjectStore::PutMode>(putMode), new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), webIndexNames, webIndexKeys, ec); >+} >+ > void IDBObjectStoreBackendProxy::deleteFunction(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) > { > // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, >diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h >index c666c9fc7982cbab73c6b4b787f97c1c9c40401b..c64028cffb60f2d8a244a715c73c0b765aeef44c 100644 >--- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h >+++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h >@@ -45,6 +45,7 @@ public: > > virtual void get(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); > virtual void put(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); >+ virtual void putWithIndexKeys(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, const WTF::Vector<WTF::String>&, const WTF::Vector<IndexKeys>&, WebCore::ExceptionCode&); > virtual void deleteFunction(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); > virtual void clear(PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 90923
:
151562
|
151824
|
152020
|
152626