Diff
Modified: trunk/Source/WebCore/ChangeLog (122778 => 122779)
--- trunk/Source/WebCore/ChangeLog 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebCore/ChangeLog 2012-07-16 23:58:48 UTC (rev 122779)
@@ -1,3 +1,40 @@
+2012-07-16 Alec Flett <[email protected]>
+
+ IndexedDB: Introduce putWithIndexKeys and calculate them in the renderer
+ https://bugs.webkit.org/show_bug.cgi?id=90923
+
+ Reviewed by Darin Fisher.
+
+ 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.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-16 Adrienne Walker <[email protected]>
[chromium] Unify compositor quad transforms into content space
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (122778 => 122779)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp 2012-07-16 23:58:48 UTC (rev 122779)
@@ -276,6 +276,7 @@
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()));
}
}
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp (122778 => 122779)
--- trunk/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp 2012-07-16 23:58:48 UTC (rev 122779)
@@ -219,20 +219,6 @@
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)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h (122778 => 122779)
--- trunk/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h 2012-07-16 23:58:48 UTC (rev 122779)
@@ -61,8 +61,6 @@
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;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (122778 => 122779)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h 2012-07-16 23:58:48 UTC (rev 122779)
@@ -102,6 +102,9 @@
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*);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp (122778 => 122779)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp 2012-07-16 23:58:48 UTC (rev 122779)
@@ -141,9 +141,11 @@
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,13 +155,38 @@
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr;
+ // Null pointers here signify 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;
+}
+
void IDBObjectStoreBackendImpl::revertAutoIncrementKeyCache(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
{
objectStore->resetAutoIncrementKeyCache();
@@ -168,72 +195,102 @@
namespace {
class IndexWriter {
public:
- explicit IndexWriter(PassRefPtr<IDBIndexBackendImpl> index)
- : m_index(index)
- {
- }
+ explicit IndexWriter(const IDBIndexMetadata& indexMetadata)
+ : m_indexMetadata(indexMetadata)
+ { }
- bool loadIndexKeysForValue(SerializedScriptValue* objectValue, const IDBKey* primaryKey = 0, String* errorMessage = 0)
+ IndexWriter(const IDBIndexMetadata& indexMetadata,
+ const IDBObjectStoreBackendInterface::IndexKeys& indexKeys)
+ : m_indexMetadata(indexMetadata)
+ , m_indexKeys(indexKeys)
+ { }
+
+ 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 (!backingStore.deleteIndexDataForRecord(databaseId, objectStoreId, m_index->id(), recordIdentifier))
+ 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;
- if (!backingStore.putIndexDataForRecord(databaseId, objectStoreId, m_index->id(), *m_indexKeys[i].get(), recordIdentifier))
+ }
+ }
+ 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, indexId, recordIdentifier))
return false;
+ 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 @@
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 @@
}
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 @@
}
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 @@
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;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h (122778 => 122779)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h 2012-07-16 23:58:48 UTC (rev 122779)
@@ -67,6 +67,7 @@
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 @@
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>);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h (122778 => 122779)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h 2012-07-16 23:58:48 UTC (rev 122779)
@@ -55,7 +55,10 @@
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;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (122778 => 122779)
--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2012-07-16 23:58:48 UTC (rev 122779)
@@ -332,6 +332,7 @@
RefPtr<IDBKey> primaryKey = prpPrimaryKey;
RefPtr<IDBKey> expectedKey =
createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, keyPath);
+ ASSERT(primaryKey);
ASSERT(expectedKey->isEqual(primaryKey.get()));
#endif
onSuccess(serializedScriptValue.release());
Modified: trunk/Source/WebKit/chromium/ChangeLog (122778 => 122779)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-07-16 23:58:48 UTC (rev 122779)
@@ -1,3 +1,21 @@
+2012-07-16 Alec Flett <[email protected]>
+
+ IndexedDB: Introduce putWithIndexKeys and calculate them in the renderer
+ https://bugs.webkit.org/show_bug.cgi?id=90923
+
+ Reviewed by Darin Fisher.
+
+ 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-16 Adrienne Walker <[email protected]>
[chromium] Unify compositor quad transforms into content space
Modified: trunk/Source/WebKit/chromium/public/WebIDBObjectStore.h (122778 => 122779)
--- trunk/Source/WebKit/chromium/public/WebIDBObjectStore.h 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebKit/chromium/public/WebIDBObjectStore.h 2012-07-16 23:58:48 UTC (rev 122779)
@@ -51,7 +51,10 @@
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>& indexNames, 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&)
Modified: trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp (122778 => 122779)
--- trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp 2012-07-16 23:58:48 UTC (rev 122779)
@@ -75,6 +75,16 @@
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,
Modified: trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h (122778 => 122779)
--- trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h 2012-07-16 23:47:13 UTC (rev 122778)
+++ trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h 2012-07-16 23:58:48 UTC (rev 122779)
@@ -45,6 +45,7 @@
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&);