diff options
author | Ben Murdoch <benm@google.com> | 2010-10-22 13:02:20 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-10-26 15:21:41 +0100 |
commit | a94275402997c11dd2e778633dacf4b7e630a35d (patch) | |
tree | e66f56c67e3b01f22c9c23cd932271ee9ac558ed /WebCore/storage/IDBObjectStore.cpp | |
parent | 09e26c78506587b3f5d930d7bc72a23287ffbec0 (diff) | |
download | external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.zip external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.gz external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.bz2 |
Merge WebKit at r70209: Initial merge by Git
Change-Id: Id23a68efa36e9d1126bcce0b137872db00892c8e
Diffstat (limited to 'WebCore/storage/IDBObjectStore.cpp')
-rw-r--r-- | WebCore/storage/IDBObjectStore.cpp | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/WebCore/storage/IDBObjectStore.cpp b/WebCore/storage/IDBObjectStore.cpp index 4c5cf34..c30243e 100644 --- a/WebCore/storage/IDBObjectStore.cpp +++ b/WebCore/storage/IDBObjectStore.cpp @@ -43,6 +43,8 @@ IDBObjectStore::IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface> idbObj : m_objectStore(idbObjectStore) , m_transaction(transaction) { + ASSERT(m_objectStore); + ASSERT(m_transaction); // We pass a reference to this object before it can be adopted. relaxAdoptionRequirement(); } @@ -62,61 +64,71 @@ PassRefPtr<DOMStringList> IDBObjectStore::indexNames() const return m_objectStore->indexNames(); } -PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key) +PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec) { RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); - m_objectStore->get(key, request, m_transaction.get()); + m_objectStore->get(key, request, m_transaction.get(), ec); + if (ec) + return 0; return request.release(); } -PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key) +PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, ExceptionCode& ec) { - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this)); - m_objectStore->put(value, key, true, request); + RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); + m_objectStore->put(value, key, true, request, m_transaction.get(), ec); + if (ec) + return 0; return request; } -PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key) +PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, ExceptionCode& ec) { - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this)); - m_objectStore->put(value, key, false, request); + RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); + m_objectStore->put(value, key, false, request, m_transaction.get(), ec); + if (ec) + return 0; return request; } -PassRefPtr<IDBRequest> IDBObjectStore::remove(ScriptExecutionContext* context, PassRefPtr<IDBKey> key) +PassRefPtr<IDBRequest> IDBObjectStore::remove(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec) { - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this)); - m_objectStore->remove(key, request); + RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); + m_objectStore->remove(key, request, m_transaction.get(), ec); + if (ec) + return 0; return request; } -PassRefPtr<IDBRequest> IDBObjectStore::createIndex(ScriptExecutionContext* context, const String& name, const String& keyPath, bool unique) +PassRefPtr<IDBIndex> IDBObjectStore::createIndex(const String& name, const String& keyPath, bool unique, ExceptionCode& ec) { - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this)); - m_objectStore->createIndex(name, keyPath, unique, request); - return request; + RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, m_transaction.get(), ec); + ASSERT(!index != !ec); // If we didn't get an index, we should have gotten an exception code. And vice versa. + if (!index) + return 0; + return IDBIndex::create(index.release(), m_transaction.get()); } -PassRefPtr<IDBIndex> IDBObjectStore::index(const String& name) +PassRefPtr<IDBIndex> IDBObjectStore::index(const String& name, ExceptionCode& ec) { - // FIXME: If this is null, we should raise a NOT_FOUND_ERR. - RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name); + RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name, ec); + ASSERT(!index != !ec); // If we didn't get an index, we should have gotten an exception code. And vice versa. if (!index) return 0; - return IDBIndex::create(index.release()); + return IDBIndex::create(index.release(), m_transaction.get()); } -PassRefPtr<IDBRequest> IDBObjectStore::removeIndex(ScriptExecutionContext* context, const String& name) +void IDBObjectStore::removeIndex(const String& name, ExceptionCode& ec) { - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this)); - m_objectStore->removeIndex(name, request); - return request; + m_objectStore->removeIndex(name, m_transaction.get(), ec); } -PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> range, unsigned short direction) +PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> range, unsigned short direction, ExceptionCode& ec) { - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this)); - m_objectStore->openCursor(range, direction, request); + RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); + m_objectStore->openCursor(range, direction, request, m_transaction.get(), ec); + if (ec) + return 0; return request.release(); } |