diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-13 07:19:42 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-13 07:19:42 +0000 |
commit | fb033cdc8de5a769a51f387bfbf12806027d1c02 (patch) | |
tree | b2c00c3d9a0b21fb7892c48b0546e0d968219ac2 /chrome | |
parent | 42599f8282ae724f2aec50ff4ac91bebbc0451e6 (diff) | |
download | chromium_src-fb033cdc8de5a769a51f387bfbf12806027d1c02.zip chromium_src-fb033cdc8de5a769a51f387bfbf12806027d1c02.tar.gz chromium_src-fb033cdc8de5a769a51f387bfbf12806027d1c02.tar.bz2 |
Add the plumbing for synchronous exceptions in IndexedDB.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3666002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc | 212 | ||||
-rw-r--r-- | chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h | 53 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 133 | ||||
-rw-r--r-- | chrome/renderer/indexed_db_dispatcher.cc | 115 | ||||
-rw-r--r-- | chrome/renderer/indexed_db_dispatcher.h | 52 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbcursor_impl.cc | 20 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbcursor_impl.h | 9 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbdatabase_impl.cc | 26 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbdatabase_impl.h | 12 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbindex_impl.cc | 25 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbindex_impl.h | 13 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbobjectstore_impl.cc | 43 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbobjectstore_impl.h | 21 |
13 files changed, 457 insertions, 277 deletions
diff --git a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc index 1a78a83..9bc80e6 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -33,6 +33,7 @@ #include "webkit/glue/webkit_glue.h" using WebKit::WebDOMStringList; +using WebKit::WebExceptionCode; using WebKit::WebIDBCallbacks; using WebKit::WebIDBCursor; using WebKit::WebIDBDatabase; @@ -135,7 +136,6 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) { case ViewHostMsg_IDBDatabaseVersion::ID: case ViewHostMsg_IDBDatabaseObjectStores::ID: case ViewHostMsg_IDBDatabaseCreateObjectStore::ID: - case ViewHostMsg_IDBDatabaseObjectStore::ID: case ViewHostMsg_IDBDatabaseRemoveObjectStore::ID: case ViewHostMsg_IDBDatabaseSetVersion::ID: case ViewHostMsg_IDBDatabaseTransaction::ID: @@ -365,12 +365,10 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( OnObjectStores) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseCreateObjectStore, OnCreateObjectStore) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseObjectStore, - OnObjectStore) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseRemoveObjectStore, - OnRemoveObjectStore) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseSetVersion, - OnSetVersion) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseRemoveObjectStore, + OnRemoveObjectStore) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseSetVersion, + OnSetVersion) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseTransaction, OnTransaction) IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseDestroyed, OnDestroyed) @@ -426,7 +424,6 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnObjectStores( void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateObjectStore( const ViewHostMsg_IDBDatabaseCreateObjectStore_Params& params, IPC::Message* reply_msg) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( &map_, params.idb_database_id_, NULL, @@ -437,34 +434,20 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateObjectStore( if (!idb_database || !idb_transaction) return; + WebExceptionCode ec = 0; WebIDBObjectStore* object_store = idb_database->createObjectStore( - params.name_, params.key_path_, params.auto_increment_, *idb_transaction); + params.name_, params.key_path_, params.auto_increment_, + *idb_transaction, ec); ViewHostMsg_IDBDatabaseCreateObjectStore::WriteReplyParams( - reply_msg, parent_->Add(object_store)); - parent_->Send(reply_msg); -} - -void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnObjectStore( - int32 idb_database_id, const string16& name, int32 mode, - IPC::Message* reply_msg) { - WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( - &map_, idb_database_id, reply_msg, - ViewHostMsg_IDBDatabaseObjectStore::ID); - if (!idb_database) - return; - - WebIDBObjectStore* object_store = idb_database->objectStore(name, mode); - int32 object_id = object_store ? parent_->Add(object_store) : 0; - ViewHostMsg_IDBDatabaseObjectStore::WriteReplyParams( - reply_msg, !!object_store, object_id); + reply_msg, ec ? 0 : parent_->Add(object_store), ec); parent_->Send(reply_msg); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnRemoveObjectStore( int32 idb_database_id, const string16& name, - int32 transaction_id) { - + int32 transaction_id, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( &map_, idb_database_id, NULL, @@ -475,11 +458,17 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnRemoveObjectStore( if (!idb_database || !idb_transaction) return; - idb_database->removeObjectStore(name, *idb_transaction); + WebExceptionCode ec = 0; + idb_database->removeObjectStore(name, *idb_transaction, ec); + ViewHostMsg_IDBDatabaseRemoveObjectStore::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion( - int32 idb_database_id, int32 response_id, const string16& version) { + int32 idb_database_id, + int32 response_id, + const string16& version, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( &map_, idb_database_id, NULL, @@ -487,14 +476,21 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion( if (!idb_database) return; + WebExceptionCode ec = 0; idb_database->setVersion( version, - new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id)); + new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id), + ec); + ViewHostMsg_IDBDatabaseSetVersion::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( - int32 idb_database_id, const std::vector<string16>& names, - int32 mode, int32 timeout, IPC::Message* reply_msg) { + int32 idb_database_id, + const std::vector<string16>& names, + int32 mode, + int32 timeout, + IPC::Message* reply_msg) { WebIDBDatabase* database = parent_->GetOrTerminateProcess( &map_, idb_database_id, reply_msg, ViewHostMsg_IDBDatabaseTransaction::ID); @@ -507,10 +503,12 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( object_stores.append(*it); } + WebExceptionCode ec = 0; WebIDBTransaction* transaction = database->transaction( - object_stores, mode, timeout); - int32 id = parent_->Add(transaction); - ViewHostMsg_IDBDatabaseTransaction::WriteReplyParams(reply_msg, id); + object_stores, mode, timeout, ec); + DCHECK(!transaction != !ec); + int32 id = ec ? 0 : parent_->Add(transaction); + ViewHostMsg_IDBDatabaseTransaction::WriteReplyParams(reply_msg, id, ec); parent_->Send(reply_msg); } @@ -543,11 +541,12 @@ bool IndexedDBDispatcherHost::IndexDispatcherHost::OnMessageReceived( IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexStoreName, OnStoreName) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexKeyPath, OnKeyPath) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexUnique, OnUnique) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexOpenObjectCursor, - OnOpenObjectCursor) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexOpenKeyCursor, OnOpenKeyCursor) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexGetObject, OnGetObject) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexGetKey, OnGetKey) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexOpenObjectCursor, + OnOpenObjectCursor) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexOpenKeyCursor, + OnOpenKeyCursor) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexGetObject, OnGetObject) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexGetKey, OnGetKey) IPC_MESSAGE_HANDLER(ViewHostMsg_IDBIndexDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -587,7 +586,8 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnUnique( } void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenObjectCursor( - const ViewHostMsg_IDBIndexOpenCursor_Params& params) { + const ViewHostMsg_IDBIndexOpenCursor_Params& params, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( &map_, params.idb_index_id_, NULL, @@ -600,13 +600,17 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenObjectCursor( scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); + WebExceptionCode ec = 0; idb_index->openObjectCursor( WebIDBKeyRange(params.left_key_, params.right_key_, params.key_flags_), - params.direction_, callbacks.release(), *idb_transaction); + params.direction_, callbacks.release(), *idb_transaction, ec); + ViewHostMsg_IDBIndexOpenObjectCursor::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor( - const ViewHostMsg_IDBIndexOpenCursor_Params& params) { + const ViewHostMsg_IDBIndexOpenCursor_Params& params, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( &map_, params.idb_index_id_, NULL, ViewHostMsg_IDBIndexOpenKeyCursor::ID); @@ -618,16 +622,20 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor( scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); + WebExceptionCode ec = 0; idb_index->openKeyCursor( WebIDBKeyRange(params.left_key_, params.right_key_, params.key_flags_), - params.direction_, callbacks.release(), *idb_transaction); + params.direction_, callbacks.release(), *idb_transaction, ec); + ViewHostMsg_IDBIndexOpenKeyCursor::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( int idb_index_id, int32 response_id, const IndexedDBKey& key, - int32 transaction_id) { + int32 transaction_id, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( &map_, idb_index_id, NULL, ViewHostMsg_IDBIndexGetObject::ID); @@ -639,14 +647,18 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); - idb_index->getObject(key, callbacks.release(), *idb_transaction); + WebExceptionCode ec = 0; + idb_index->getObject(key, callbacks.release(), *idb_transaction, ec); + ViewHostMsg_IDBIndexGetObject::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey( int idb_index_id, int32 response_id, const IndexedDBKey& key, - int32 transaction_id) { + int32 transaction_id, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( &map_, idb_index_id, NULL, ViewHostMsg_IDBIndexGetKey::ID); @@ -658,7 +670,10 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey( scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<WebIDBKey>(parent_, response_id)); - idb_index->getKey(key, callbacks.release(), *idb_transaction); + WebExceptionCode ec = 0; + idb_index->getKey(key, callbacks.release(), *idb_transaction, ec); + ViewHostMsg_IDBIndexGetKey::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnDestroyed( @@ -690,14 +705,16 @@ bool IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnMessageReceived( OnKeyPath) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreIndexNames, OnIndexNames) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBObjectStoreGet, OnGet); - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBObjectStorePut, OnPut); - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBObjectStoreRemove, OnRemove); + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreGet, OnGet); + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStorePut, OnPut); + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreRemove, OnRemove); IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreCreateIndex, OnCreateIndex); IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreIndex, OnIndex); - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBObjectStoreRemoveIndex, OnRemoveIndex); - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBObjectStoreOpenCursor, OnOpenCursor) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreRemoveIndex, + OnRemoveIndex); + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreOpenCursor, + OnOpenCursor) IPC_MESSAGE_HANDLER(ViewHostMsg_IDBObjectStoreDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -746,7 +763,8 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet( int idb_object_store_id, int32 response_id, const IndexedDBKey& key, - int32 transaction_id) { + int32 transaction_id, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( &map_, idb_object_store_id, NULL, ViewHostMsg_IDBObjectStoreGet::ID); @@ -758,11 +776,15 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet( scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); - idb_object_store->get(key, callbacks.release(), *idb_transaction); + WebExceptionCode ec = 0; + idb_object_store->get(key, callbacks.release(), *idb_transaction, ec); + ViewHostMsg_IDBObjectStoreGet::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut( - const ViewHostMsg_IDBObjectStorePut_Params& params) { + const ViewHostMsg_IDBObjectStorePut_Params& params, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( &map_, params.idb_object_store_id_, NULL, @@ -775,15 +797,19 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut( scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id_)); + WebExceptionCode ec = 0; idb_object_store->put(params.serialized_value_, params.key_, params.add_only_, - callbacks.release(), *idb_transaction); + callbacks.release(), *idb_transaction, ec); + ViewHostMsg_IDBObjectStorePut::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnRemove( int idb_object_store_id, int32 response_id, const IndexedDBKey& key, - int32 transaction_id) { + int32 transaction_id, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( &map_, idb_object_store_id, NULL, ViewHostMsg_IDBObjectStoreRemove::ID); @@ -795,7 +821,10 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnRemove( scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<void>(parent_, response_id)); - idb_object_store->remove(key, callbacks.release(), *idb_transaction); + WebExceptionCode ec = 0; + idb_object_store->remove(key, callbacks.release(), *idb_transaction, ec); + ViewHostMsg_IDBObjectStoreRemove::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCreateIndex( @@ -811,31 +840,36 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCreateIndex( if (!idb_object_store || !idb_transaction) return; + WebExceptionCode ec = 0; WebIDBIndex* index = idb_object_store->createIndex( - params.name_, params.key_path_, params.unique_, *idb_transaction); + params.name_, params.key_path_, params.unique_, *idb_transaction, ec); ViewHostMsg_IDBObjectStoreCreateIndex::WriteReplyParams( - reply_msg, parent_->Add(index)); + reply_msg, ec ? 0 : parent_->Add(index), ec); parent_->Send(reply_msg); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndex( - int32 idb_object_store_id, const string16& name, IPC::Message* reply_msg) { + int32 idb_object_store_id, + const string16& name, + IPC::Message* reply_msg) { WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( &map_, idb_object_store_id, reply_msg, ViewHostMsg_IDBObjectStoreIndex::ID); if (!idb_object_store) return; - WebIDBIndex* index = idb_object_store->index(name); + WebExceptionCode ec = 0; + WebIDBIndex* index = idb_object_store->index(name, ec); int32 object_id = parent_->Add(index); - ViewHostMsg_IDBObjectStoreIndex::WriteReplyParams(reply_msg, object_id); + ViewHostMsg_IDBObjectStoreIndex::WriteReplyParams(reply_msg, object_id, ec); parent_->Send(reply_msg); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnRemoveIndex( int32 idb_object_store_id, const string16& name, - int32 transaction_id) { + int32 transaction_id, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( &map_, idb_object_store_id, NULL, @@ -846,11 +880,15 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnRemoveIndex( if (!idb_object_store || !idb_transaction) return; - idb_object_store->removeIndex(name, *idb_transaction); + WebExceptionCode ec = 0; + idb_object_store->removeIndex(name, *idb_transaction, ec); + ViewHostMsg_IDBObjectStoreRemoveIndex::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnOpenCursor( - const ViewHostMsg_IDBObjectStoreOpenCursor_Params& params) { + const ViewHostMsg_IDBObjectStoreOpenCursor_Params& params, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( &parent_->object_store_dispatcher_host_->map_, @@ -864,9 +902,12 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnOpenCursor( scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); + WebExceptionCode ec = 0; idb_object_store->openCursor( WebIDBKeyRange(params.left_key_, params.right_key_, params.flags_), - params.direction_, callbacks.release(), *idb_transaction); + params.direction_, callbacks.release(), *idb_transaction, ec); + ViewHostMsg_IDBObjectStoreOpenCursor::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed( @@ -897,9 +938,9 @@ bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived( OnDirection) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorKey, OnKey) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorValue, OnValue) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBCursorUpdate, OnUpdate) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBCursorContinue, OnContinue) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBCursorRemove, OnRemove) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorUpdate, OnUpdate) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorContinue, OnContinue) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorRemove, OnRemove) IPC_MESSAGE_HANDLER(ViewHostMsg_IDBCursorDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -960,38 +1001,53 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnValue( void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate( int32 cursor_id, int32 response_id, - const SerializedScriptValue& value) { + const SerializedScriptValue& value, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( &map_, cursor_id, NULL, ViewHostMsg_IDBCursorUpdate::ID); if (!idb_cursor) return; + + WebExceptionCode ec = 0; idb_cursor->update( - value, new IndexedDBCallbacks<void>(parent_, response_id)); + value, new IndexedDBCallbacks<void>(parent_, response_id), ec); + ViewHostMsg_IDBCursorUpdate::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue( int32 cursor_id, int32 response_id, - const IndexedDBKey& key) { + const IndexedDBKey& key, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( &map_, cursor_id, NULL, ViewHostMsg_IDBCursorContinue::ID); if (!idb_cursor) return; + + WebExceptionCode ec = 0; idb_cursor->continueFunction( - key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id)); + key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id), ec); + ViewHostMsg_IDBCursorContinue::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnRemove( int32 cursor_id, - int32 response_id) { + int32 response_id, + IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( &map_, cursor_id, NULL, ViewHostMsg_IDBCursorUpdate::ID); if (!idb_cursor) return; - idb_cursor->remove(new IndexedDBCallbacks<void>(parent_, response_id)); + + WebExceptionCode ec = 0; + idb_cursor->remove(new IndexedDBCallbacks<void>(parent_, response_id), ec); + ViewHostMsg_IDBCursorUpdate::WriteReplyParams(reply_msg, ec); + parent_->Send(reply_msg); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( diff --git a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h index 0112cce..3a18f11 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h @@ -105,17 +105,18 @@ class IndexedDBDispatcherHost void OnCreateObjectStore( const ViewHostMsg_IDBDatabaseCreateObjectStore_Params& params, IPC::Message* reply_msg); - void OnObjectStore(int32 idb_database_id, const string16& name, int32 mode, - IPC::Message* reply_msg); void OnRemoveObjectStore(int32 idb_database_id, const string16& name, - int32 transaction_id); + int32 transaction_id, + IPC::Message* reply_msg); void OnSetVersion(int32 idb_database_id, int32 response_id, - const string16& version); + const string16& version, + IPC::Message* reply_msg); void OnTransaction(int32 idb_database_id, const std::vector<string16>& names, - int32 mode, int32 timeout, IPC::Message* reply_msg); + int32 mode, int32 timeout, + IPC::Message* reply_msg); void OnDestroyed(int32 idb_database_id); IndexedDBDispatcherHost* parent_; @@ -135,16 +136,20 @@ class IndexedDBDispatcherHost void OnKeyPath(int32 idb_index_id, IPC::Message* reply_msg); void OnUnique(int32 idb_index_id, IPC::Message* reply_msg); void OnOpenObjectCursor( - const ViewHostMsg_IDBIndexOpenCursor_Params& params); - void OnOpenKeyCursor(const ViewHostMsg_IDBIndexOpenCursor_Params& params); + const ViewHostMsg_IDBIndexOpenCursor_Params& params, + IPC::Message* reply_msg); + void OnOpenKeyCursor(const ViewHostMsg_IDBIndexOpenCursor_Params& params, + IPC::Message* reply_msg); void OnGetObject(int idb_index_id, int32 response_id, const IndexedDBKey& key, - int32 transaction_id); + int32 transaction_id, + IPC::Message* reply_msg); void OnGetKey(int idb_index_id, int32 response_id, const IndexedDBKey& key, - int32 transaction_id); + int32 transaction_id, + IPC::Message* reply_msg); void OnDestroyed(int32 idb_index_id); IndexedDBDispatcherHost* parent_; @@ -165,22 +170,28 @@ class IndexedDBDispatcherHost void OnGet(int idb_object_store_id, int32 response_id, const IndexedDBKey& key, - int32 transaction_id); - void OnPut(const ViewHostMsg_IDBObjectStorePut_Params& params); + int32 transaction_id, + IPC::Message* reply_msg); + void OnPut(const ViewHostMsg_IDBObjectStorePut_Params& params, + IPC::Message* reply_msg); void OnRemove(int idb_object_store_id, int32 response_id, const IndexedDBKey& key, - int32 transaction_id); + int32 transaction_id, + IPC::Message* reply_msg); void OnCreateIndex( const ViewHostMsg_IDBObjectStoreCreateIndex_Params& params, IPC::Message* reply_msg); - void OnIndex(int32 idb_object_store_id, const string16& name, + void OnIndex(int32 idb_object_store_id, + const string16& name, IPC::Message* reply_msg); void OnRemoveIndex(int32 idb_object_store_id, const string16& name, - int32 transaction_id); + int32 transaction_id, + IPC::Message* reply_msg); void OnOpenCursor( - const ViewHostMsg_IDBObjectStoreOpenCursor_Params& params); + const ViewHostMsg_IDBObjectStoreOpenCursor_Params& params, + IPC::Message* reply_msg); void OnDestroyed(int32 idb_object_store_id); IndexedDBDispatcherHost* parent_; @@ -200,12 +211,15 @@ class IndexedDBDispatcherHost void OnValue(int32 idb_object_store_id, IPC::Message* reply_msg); void OnUpdate(int32 idb_object_store_id, int32 response_id, - const SerializedScriptValue& value); + const SerializedScriptValue& value, + IPC::Message* reply_msg); void OnContinue(int32 idb_object_store_id, int32 response_id, - const IndexedDBKey& key); + const IndexedDBKey& key, + IPC::Message* reply_msg); void OnRemove(int32 idb_object_store_id, - int32 response_id); + int32 response_id, + IPC::Message* reply_msg); void OnDestroyed(int32 idb_cursor_id); IndexedDBDispatcherHost* parent_; @@ -223,7 +237,8 @@ class IndexedDBDispatcherHost // TODO: add the rest of the transaction methods. void OnAbort(int32 transaction_id); void OnMode(int32 transaction_id, IPC::Message* reply_msg); - void OnObjectStore(int32 transaction_id, const string16& name, + void OnObjectStore(int32 transaction_id, + const string16& name, IPC::Message* reply_msg); void OnDidCompleteTaskEvents(int transaction_id); void OnDestroyed(int32 idb_transaction_id); diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 6acdda3..73cc18a 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -25,6 +25,7 @@ #include "chrome/common/window_container_type.h" #include "ipc/ipc_message_macros.h" #include "media/audio/audio_buffers_state.h" +#include "third_party/WebKit/WebKit/chromium/public/WebExceptionCode.h" #if defined(OS_POSIX) #include "base/file_descriptor_posix.h" @@ -2377,21 +2378,24 @@ IPC_BEGIN_MESSAGES(ViewHost) IndexedDBKey /* key */) // WebIDBCursor::update() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBCursorUpdate, + IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBCursorUpdate, int32, /* idb_cursor_id */ int32, /* response_id */ - SerializedScriptValue /* value */) + SerializedScriptValue, /* value */ + WebKit::WebExceptionCode /* ec */) // WebIDBCursor::continue() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBCursorContinue, + IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBCursorContinue, int32, /* idb_cursor_id */ int32, /* response_id */ - IndexedDBKey /* key */) + IndexedDBKey, /* key */ + WebKit::WebExceptionCode /* ec */) // WebIDBCursor::remove() message. - IPC_MESSAGE_CONTROL2(ViewHostMsg_IDBCursorRemove, + IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_IDBCursorRemove, int32, /* idb_cursor_id */ - int32 /* response_id */) + int32, /* response_id */ + WebKit::WebExceptionCode /* ec */) // WebIDBFactory::open() message. IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBFactoryOpen, @@ -2418,41 +2422,37 @@ IPC_BEGIN_MESSAGES(ViewHost) std::vector<string16> /* objectStores */) // WebIDBDatabase::createObjectStore() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBDatabaseCreateObjectStore, + IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_IDBDatabaseCreateObjectStore, ViewHostMsg_IDBDatabaseCreateObjectStore_Params, - int32 /* object_store_id */) + int32, /* object_store_id */ + WebKit::WebExceptionCode /* ec */) - // WebIDBDatabase::objectStore() message. - IPC_SYNC_MESSAGE_CONTROL3_2(ViewHostMsg_IDBDatabaseObjectStore, + // WebIDBDatabase::removeObjectStore() message. + IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBDatabaseRemoveObjectStore, int32, /* idb_database_id */ string16, /* name */ - int32, /* mode */ - bool, /* success */ - int32 /* idb_object_store_id */) - - // WebIDBDatabase::removeObjectStore() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBDatabaseRemoveObjectStore, - int32, /* idb_database_id */ - string16, /* name */ - int32 /* transaction_id */) + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) // WebIDBDatabase::setVersion() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBDatabaseSetVersion, - int32, /* idb_database_id */ - int32, /* response_id */ - string16 /* version */) + IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBDatabaseSetVersion, + int32, /* idb_database_id */ + int32, /* response_id */ + string16, /* version */ + WebKit::WebExceptionCode /* ec */) // WebIDBDatabase::transaction() message. // TODO: make this message async. Have the renderer create a // temporary ID and keep a map in the browser process of real // IDs to temporary IDs. We can then update the transaction // to its real ID asynchronously. - IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_IDBDatabaseTransaction, + IPC_SYNC_MESSAGE_CONTROL4_2(ViewHostMsg_IDBDatabaseTransaction, int32, /* idb_database_id */ std::vector<string16>, /* object_stores */ int32, /* mode */ int32, /* timeout */ - int32 /* idb_transaction_id */) + int32, /* idb_transaction_id */ + WebKit::WebExceptionCode /* ec */) // WebIDBDatabase::~WebIDBDatabase() message. IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBDatabaseDestroyed, @@ -2479,26 +2479,30 @@ IPC_BEGIN_MESSAGES(ViewHost) bool /* unique */) // WebIDBIndex::openObjectCursor() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBIndexOpenObjectCursor, - ViewHostMsg_IDBIndexOpenCursor_Params) + IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexOpenObjectCursor, + ViewHostMsg_IDBIndexOpenCursor_Params, + WebKit::WebExceptionCode /* ec */) // WebIDBIndex::openKeyCursor() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBIndexOpenKeyCursor, - ViewHostMsg_IDBIndexOpenCursor_Params) + IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexOpenKeyCursor, + ViewHostMsg_IDBIndexOpenCursor_Params, + WebKit::WebExceptionCode /* ec */) // WebIDBIndex::getObject() message. - IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBIndexGetObject, - int32, /* idb_index_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - int32 /* transaction_id */) + IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_IDBIndexGetObject, + int32, /* idb_index_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) // WebIDBIndex::getKey() message. - IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBIndexGetKey, - int32, /* idb_index_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - int32 /* transaction_id */) + IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_IDBIndexGetKey, + int32, /* idb_index_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) // WebIDBIndex::~WebIDBIndex() message. IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBIndexDestroyed, @@ -2520,43 +2524,50 @@ IPC_BEGIN_MESSAGES(ViewHost) std::vector<string16> /* index_names */) // WebIDBObjectStore::get() message. - IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBObjectStoreGet, - int32, /* idb_object_store_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - int32 /* transaction_id */) + IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_IDBObjectStoreGet, + int32, /* idb_object_store_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) // WebIDBObjectStore::put() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBObjectStorePut, - ViewHostMsg_IDBObjectStorePut_Params) + IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStorePut, + ViewHostMsg_IDBObjectStorePut_Params, + WebKit::WebExceptionCode /* ec */) // WebIDBObjectStore::remove() message. - IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBObjectStoreRemove, - int32, /* idb_object_store_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - int32 /* transaction_id */) + IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_IDBObjectStoreRemove, + int32, /* idb_object_store_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) // WebIDBObjectStore::createIndex() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStoreCreateIndex, + IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_IDBObjectStoreCreateIndex, ViewHostMsg_IDBObjectStoreCreateIndex_Params, - int32 /* index_id */) + int32, /* index_id */ + WebKit::WebExceptionCode /* ec */) // WebIDBObjectStore::index() message. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_IDBObjectStoreIndex, + IPC_SYNC_MESSAGE_CONTROL2_2(ViewHostMsg_IDBObjectStoreIndex, int32, /* idb_object_store_id */ string16, /* name */ - int32 /* idb_index_id */) + int32, /* idb_index_id */ + WebKit::WebExceptionCode /* ec */) // WebIDBObjectStore::removeIndex() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBObjectStoreRemoveIndex, - int32, /* idb_object_store_id */ - string16, /* name */ - int32 /* transaction_id */) + IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBObjectStoreRemoveIndex, + int32, /* idb_object_store_id */ + string16, /* name */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) // WebIDBObjectStore::openCursor() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBObjectStoreOpenCursor, - ViewHostMsg_IDBObjectStoreOpenCursor_Params) + IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStoreOpenCursor, + ViewHostMsg_IDBObjectStoreOpenCursor_Params, + WebKit::WebExceptionCode /* ec */) // WebIDBObjectStore::~WebIDBObjectStore() message. IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBObjectStoreDestroyed, diff --git a/chrome/renderer/indexed_db_dispatcher.cc b/chrome/renderer/indexed_db_dispatcher.cc index 69ce63f..a390cbb 100644 --- a/chrome/renderer/indexed_db_dispatcher.cc +++ b/chrome/renderer/indexed_db_dispatcher.cc @@ -22,6 +22,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" +using WebKit::WebExceptionCode; using WebKit::WebFrame; using WebKit::WebIDBCallbacks; using WebKit::WebIDBKeyRange; @@ -71,33 +72,42 @@ bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { void IndexedDBDispatcher::RequestIDBCursorUpdate( const SerializedScriptValue& value, WebIDBCallbacks* callbacks_ptr, - int32 idb_cursor_id) { + int32 idb_cursor_id, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBCursorUpdate( - idb_cursor_id, pending_callbacks_.Add(callbacks.release()), value)); + new ViewHostMsg_IDBCursorUpdate(idb_cursor_id, response_id, value, ec)); + if (*ec) + pending_callbacks_.Remove(response_id); } void IndexedDBDispatcher::RequestIDBCursorContinue( const IndexedDBKey& key, WebIDBCallbacks* callbacks_ptr, - int32 idb_cursor_id) { + int32 idb_cursor_id, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBCursorContinue( - idb_cursor_id, pending_callbacks_.Add(callbacks.release()), key)); + new ViewHostMsg_IDBCursorContinue(idb_cursor_id, response_id, key, ec)); + if (*ec) + pending_callbacks_.Remove(response_id); } void IndexedDBDispatcher::RequestIDBCursorRemove( WebIDBCallbacks* callbacks_ptr, - int32 idb_cursor_id) { + int32 idb_cursor_id, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBCursorRemove( - idb_cursor_id, pending_callbacks_.Add(callbacks.release()))); + new ViewHostMsg_IDBCursorRemove(idb_cursor_id, response_id, ec)); + if (*ec) + pending_callbacks_.Remove(response_id); } void IndexedDBDispatcher::RequestIDBFactoryOpen( @@ -128,13 +138,16 @@ void IndexedDBDispatcher::RequestIDBFactoryOpen( void IndexedDBDispatcher::RequestIDBDatabaseSetVersion( const string16& version, WebIDBCallbacks* callbacks_ptr, - int32 idb_database_id) { + int32 idb_database_id, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBDatabaseSetVersion( - idb_database_id, pending_callbacks_.Add(callbacks.release()), - version)); + new ViewHostMsg_IDBDatabaseSetVersion(idb_database_id, response_id, + version, ec)); + if (*ec) + pending_callbacks_.Remove(response_id); } void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( @@ -142,7 +155,8 @@ void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( unsigned short direction, WebIDBCallbacks* callbacks_ptr, int32 idb_index_id, - const WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); ViewHostMsg_IDBIndexOpenCursor_Params params; params.response_id_ = pending_callbacks_.Add(callbacks.release()); @@ -153,15 +167,18 @@ void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( params.idb_index_id_ = idb_index_id; params.transaction_id_ = TransactionId(transaction); RenderThread::current()->Send( - new ViewHostMsg_IDBIndexOpenObjectCursor(params)); + new ViewHostMsg_IDBIndexOpenObjectCursor(params, ec)); + if (*ec) + pending_callbacks_.Remove(params.response_id_); } -void IndexedDBDispatcher::RequestIDBIndexOpenCursor( +void IndexedDBDispatcher::RequestIDBIndexOpenKeyCursor( const WebIDBKeyRange& idb_key_range, unsigned short direction, WebIDBCallbacks* callbacks_ptr, int32 idb_index_id, - const WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); ViewHostMsg_IDBIndexOpenCursor_Params params; params.response_id_ = pending_callbacks_.Add(callbacks.release()); @@ -174,46 +191,58 @@ void IndexedDBDispatcher::RequestIDBIndexOpenCursor( params.idb_index_id_ = idb_index_id; params.transaction_id_ = TransactionId(transaction); RenderThread::current()->Send( - new ViewHostMsg_IDBIndexOpenKeyCursor(params)); + new ViewHostMsg_IDBIndexOpenKeyCursor(params, ec)); + if (*ec) + pending_callbacks_.Remove(params.response_id_); } void IndexedDBDispatcher::RequestIDBIndexGetObject( const IndexedDBKey& key, WebIDBCallbacks* callbacks_ptr, int32 idb_index_id, - const WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); - + int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( new ViewHostMsg_IDBIndexGetObject( - idb_index_id, pending_callbacks_.Add(callbacks.release()), key, - TransactionId(transaction))); + idb_index_id, response_id, key, + TransactionId(transaction), ec)); + if (*ec) + pending_callbacks_.Remove(response_id); } -void IndexedDBDispatcher::RequestIDBIndexGet( +void IndexedDBDispatcher::RequestIDBIndexGetKey( const IndexedDBKey& key, WebIDBCallbacks* callbacks_ptr, int32 idb_index_id, - const WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); - + int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( new ViewHostMsg_IDBIndexGetKey( - idb_index_id, pending_callbacks_.Add(callbacks.release()), key, - TransactionId(transaction))); + idb_index_id, response_id, key, + TransactionId(transaction), ec)); + if (*ec) + pending_callbacks_.Remove(response_id); } void IndexedDBDispatcher::RequestIDBObjectStoreGet( const IndexedDBKey& key, WebIDBCallbacks* callbacks_ptr, int32 idb_object_store_id, - const WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( new ViewHostMsg_IDBObjectStoreGet( - idb_object_store_id, pending_callbacks_.Add(callbacks.release()), - key, TransactionId(transaction))); + idb_object_store_id, response_id, + key, TransactionId(transaction), ec)); + if (*ec) + pending_callbacks_.Remove(response_id); } void IndexedDBDispatcher::RequestIDBObjectStorePut( @@ -222,7 +251,8 @@ void IndexedDBDispatcher::RequestIDBObjectStorePut( bool add_only, WebIDBCallbacks* callbacks_ptr, int32 idb_object_store_id, - const WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); ViewHostMsg_IDBObjectStorePut_Params params; params.idb_object_store_id_ = idb_object_store_id; @@ -231,20 +261,26 @@ void IndexedDBDispatcher::RequestIDBObjectStorePut( params.key_ = key; params.add_only_ = add_only; params.transaction_id_ = TransactionId(transaction); - RenderThread::current()->Send(new ViewHostMsg_IDBObjectStorePut(params)); + RenderThread::current()->Send(new ViewHostMsg_IDBObjectStorePut(params, ec)); + if (*ec) + pending_callbacks_.Remove(params.response_id_); } void IndexedDBDispatcher::RequestIDBObjectStoreRemove( const IndexedDBKey& key, WebIDBCallbacks* callbacks_ptr, int32 idb_object_store_id, - const WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( new ViewHostMsg_IDBObjectStoreRemove( - idb_object_store_id, pending_callbacks_.Add(callbacks.release()), - key, TransactionId(transaction))); + idb_object_store_id, response_id, + key, TransactionId(transaction), ec)); + if (*ec) + pending_callbacks_.Remove(response_id); } void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( @@ -252,7 +288,8 @@ void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( unsigned short direction, WebIDBCallbacks* callbacks_ptr, int32 idb_object_store_id, - const WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); ViewHostMsg_IDBObjectStoreOpenCursor_Params params; params.response_id_ = pending_callbacks_.Add(callbacks.release()); @@ -263,7 +300,9 @@ void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( params.idb_object_store_id_ = idb_object_store_id; params.transaction_id_ = TransactionId(transaction); RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreOpenCursor(params)); + new ViewHostMsg_IDBObjectStoreOpenCursor(params, ec)); + if (*ec) + pending_callbacks_.Remove(params.response_id_); } void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks( @@ -330,7 +369,7 @@ void IndexedDBDispatcher::OnSuccessSerializedScriptValue( void IndexedDBDispatcher::OnSuccessOpenCursor(int32 repsonse_id, int32 object_id) { WebIDBCallbacks* callbacks = - pending_callbacks_.Lookup(repsonse_id); + pending_callbacks_.Lookup(repsonse_id); callbacks->onSuccess(new RendererWebIDBCursorImpl(object_id)); pending_callbacks_.Remove(repsonse_id); } diff --git a/chrome/renderer/indexed_db_dispatcher.h b/chrome/renderer/indexed_db_dispatcher.h index a776d92..b803163 100644 --- a/chrome/renderer/indexed_db_dispatcher.h +++ b/chrome/renderer/indexed_db_dispatcher.h @@ -9,6 +9,7 @@ #include "base/id_map.h" #include "base/nullable_string16.h" #include "ipc/ipc_message.h" +#include "third_party/WebKit/WebKit/chromium/public/WebExceptionCode.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBCallbacks.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabase.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBTransactionCallbacks.h" @@ -43,69 +44,82 @@ class IndexedDBDispatcher { void RequestIDBCursorUpdate( const SerializedScriptValue& value, WebKit::WebIDBCallbacks* callbacks_ptr, - int32 idb_cursor_id); + int32 idb_cursor_id, + WebKit::WebExceptionCode* ec); void RequestIDBCursorContinue( const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks_ptr, - int32 idb_cursor_id); + int32 idb_cursor_id, + WebKit::WebExceptionCode* ec); void RequestIDBCursorRemove( WebKit::WebIDBCallbacks* callbacks_ptr, - int32 idb_cursor_id); + int32 idb_cursor_id, + WebKit::WebExceptionCode* ec); void RequestIDBDatabaseSetVersion( const string16& version, WebKit::WebIDBCallbacks* callbacks, - int32 idb_database_id); + int32 idb_database_id, + WebKit::WebExceptionCode* ec); void RequestIDBIndexOpenObjectCursor( const WebKit::WebIDBKeyRange& idb_key_range, unsigned short direction, WebKit::WebIDBCallbacks* callbacks, int32 idb_index_id, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); - void RequestIDBIndexOpenCursor(const WebKit::WebIDBKeyRange& idb_key_range, - unsigned short direction, - WebKit::WebIDBCallbacks* callbacks, - int32 idb_index_id, - const WebKit::WebIDBTransaction& transaction); + void RequestIDBIndexOpenKeyCursor( + const WebKit::WebIDBKeyRange& idb_key_range, + unsigned short direction, + WebKit::WebIDBCallbacks* callbacks, + int32 idb_index_id, + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); void RequestIDBIndexGetObject(const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks, int32 idb_index_id, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); - void RequestIDBIndexGet(const IndexedDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - int32 idb_index_id, - const WebKit::WebIDBTransaction& transaction); + void RequestIDBIndexGetKey(const IndexedDBKey& key, + WebKit::WebIDBCallbacks* callbacks, + int32 idb_index_id, + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); void RequestIDBObjectStoreGet(const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks, int32 idb_object_store_id, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); void RequestIDBObjectStorePut(const SerializedScriptValue& value, const IndexedDBKey& key, bool add_only, WebKit::WebIDBCallbacks* callbacks, int32 idb_object_store_id, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); void RequestIDBObjectStoreRemove( const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks, int32 idb_object_store_id, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); void RequestIDBObjectStoreOpenCursor( const WebKit::WebIDBKeyRange& idb_key_range, unsigned short direction, WebKit::WebIDBCallbacks* callbacks, int32 idb_object_store_id, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); void RegisterWebIDBTransactionCallbacks( WebKit::WebIDBTransactionCallbacks* callbacks, diff --git a/chrome/renderer/renderer_webidbcursor_impl.cc b/chrome/renderer/renderer_webidbcursor_impl.cc index 12f6df8..b23da07 100644 --- a/chrome/renderer/renderer_webidbcursor_impl.cc +++ b/chrome/renderer/renderer_webidbcursor_impl.cc @@ -10,6 +10,7 @@ #include "chrome/renderer/indexed_db_dispatcher.h" #include "chrome/renderer/render_thread.h" +using WebKit::WebExceptionCode; using WebKit::WebIDBCallbacks; using WebKit::WebIDBKey; using WebKit::WebSerializedScriptValue; @@ -52,23 +53,26 @@ void RendererWebIDBCursorImpl::value( } void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, - WebIDBCallbacks* callbacks) { + WebIDBCallbacks* callbacks, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - dispatcher->RequestIDBCursorUpdate( - SerializedScriptValue(value), callbacks, idb_cursor_id_); + dispatcher->RequestIDBCursorUpdate(SerializedScriptValue(value), callbacks, + idb_cursor_id_, &ec); } void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, - WebIDBCallbacks* callbacks) { + WebIDBCallbacks* callbacks, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - dispatcher->RequestIDBCursorContinue( - IndexedDBKey(key), callbacks, idb_cursor_id_); + dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks, + idb_cursor_id_, &ec); } -void RendererWebIDBCursorImpl::remove(WebIDBCallbacks* callbacks) { +void RendererWebIDBCursorImpl::remove(WebIDBCallbacks* callbacks, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - dispatcher->RequestIDBCursorRemove(callbacks, idb_cursor_id_); + dispatcher->RequestIDBCursorRemove(callbacks, idb_cursor_id_, &ec); } diff --git a/chrome/renderer/renderer_webidbcursor_impl.h b/chrome/renderer/renderer_webidbcursor_impl.h index e252518..4dcdcd9 100644 --- a/chrome/renderer/renderer_webidbcursor_impl.h +++ b/chrome/renderer/renderer_webidbcursor_impl.h @@ -23,10 +23,13 @@ class RendererWebIDBCursorImpl : public WebKit::WebIDBCursor { virtual void value(WebKit::WebSerializedScriptValue&, WebKit::WebIDBKey&) const; virtual void update(const WebKit::WebSerializedScriptValue& value, - WebKit::WebIDBCallbacks* callback); + WebKit::WebIDBCallbacks* callback, + WebKit::WebExceptionCode& ec); virtual void continueFunction(const WebKit::WebIDBKey& key, - WebKit::WebIDBCallbacks* callback); - virtual void remove(WebKit::WebIDBCallbacks* callback); + WebKit::WebIDBCallbacks* callback, + WebKit::WebExceptionCode& ec); + virtual void remove(WebKit::WebIDBCallbacks* callback, + WebKit::WebExceptionCode& ec); private: int32 idb_cursor_id_; diff --git a/chrome/renderer/renderer_webidbdatabase_impl.cc b/chrome/renderer/renderer_webidbdatabase_impl.cc index 56d7f02..874342f 100644 --- a/chrome/renderer/renderer_webidbdatabase_impl.cc +++ b/chrome/renderer/renderer_webidbdatabase_impl.cc @@ -13,6 +13,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebString.h" using WebKit::WebDOMStringList; +using WebKit::WebExceptionCode; using WebKit::WebFrame; using WebKit::WebIDBCallbacks; using WebKit::WebIDBTransaction; @@ -67,7 +68,8 @@ WebKit::WebIDBObjectStore* RendererWebIDBDatabaseImpl::createObjectStore( const WebKit::WebString& name, const WebKit::WebString& key_path, bool auto_increment, - const WebKit::WebIDBTransaction& transaction) { + const WebKit::WebIDBTransaction& transaction, + WebExceptionCode& ec) { ViewHostMsg_IDBDatabaseCreateObjectStore_Params params; params.name_ = name; params.key_path_ = key_path; @@ -77,7 +79,7 @@ WebKit::WebIDBObjectStore* RendererWebIDBDatabaseImpl::createObjectStore( int object_store; RenderThread::current()->Send( - new ViewHostMsg_IDBDatabaseCreateObjectStore(params, &object_store)); + new ViewHostMsg_IDBDatabaseCreateObjectStore(params, &object_store, &ec)); if (!object_store) return NULL; return new RendererWebIDBObjectStoreImpl(object_store); @@ -85,24 +87,29 @@ WebKit::WebIDBObjectStore* RendererWebIDBDatabaseImpl::createObjectStore( void RendererWebIDBDatabaseImpl::removeObjectStore( const WebString& name, - const WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode& ec) { RenderThread::current()->Send( new ViewHostMsg_IDBDatabaseRemoveObjectStore( idb_database_id_, name, - IndexedDBDispatcher::TransactionId(transaction))); + IndexedDBDispatcher::TransactionId(transaction), &ec)); } void RendererWebIDBDatabaseImpl::setVersion( - const WebString& version, WebIDBCallbacks* callbacks) { + const WebString& version, + WebIDBCallbacks* callbacks, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); dispatcher->RequestIDBDatabaseSetVersion( - version, callbacks, idb_database_id_); + version, callbacks, idb_database_id_, &ec); } WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction( - const WebDOMStringList& names, unsigned short mode, - unsigned long timeout) { + const WebDOMStringList& names, + unsigned short mode, + unsigned long timeout, + WebExceptionCode& ec) { std::vector<string16> object_stores(names.length()); for (unsigned int i = 0; i < names.length(); ++i) { object_stores.push_back(names.item(i)); @@ -111,6 +118,7 @@ WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction( int transaction_id; RenderThread::current()->Send( new ViewHostMsg_IDBDatabaseTransaction( - idb_database_id_, object_stores, mode, timeout, &transaction_id)); + idb_database_id_, object_stores, mode, + timeout, &transaction_id, &ec)); return new RendererWebIDBTransactionImpl(transaction_id); } diff --git a/chrome/renderer/renderer_webidbdatabase_impl.h b/chrome/renderer/renderer_webidbdatabase_impl.h index 8c12436..5d45ac7 100644 --- a/chrome/renderer/renderer_webidbdatabase_impl.h +++ b/chrome/renderer/renderer_webidbdatabase_impl.h @@ -31,15 +31,19 @@ class RendererWebIDBDatabaseImpl : public WebKit::WebIDBDatabase { const WebKit::WebString& name, const WebKit::WebString& key_path, bool auto_increment, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); virtual void removeObjectStore( const WebKit::WebString& name, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); virtual void setVersion( - const WebKit::WebString& version, WebKit::WebIDBCallbacks* callbacks); + const WebKit::WebString& version, WebKit::WebIDBCallbacks* callbacks, + WebKit::WebExceptionCode& ec); virtual WebKit::WebIDBTransaction* transaction( const WebKit::WebDOMStringList& names, - unsigned short mode, unsigned long timeout); + unsigned short mode, unsigned long timeout, + WebKit::WebExceptionCode& ec); private: int32 idb_database_id_; diff --git a/chrome/renderer/renderer_webidbindex_impl.cc b/chrome/renderer/renderer_webidbindex_impl.cc index 14c9e4c..230011b 100644 --- a/chrome/renderer/renderer_webidbindex_impl.cc +++ b/chrome/renderer/renderer_webidbindex_impl.cc @@ -10,6 +10,7 @@ #include "chrome/renderer/indexed_db_dispatcher.h" #include "chrome/renderer/renderer_webidbtransaction_impl.h" +using WebKit::WebExceptionCode; using WebKit::WebDOMStringList; using WebKit::WebString; using WebKit::WebVector; @@ -57,40 +58,44 @@ void RendererWebIDBIndexImpl::openObjectCursor( const WebKit::WebIDBKeyRange& range, unsigned short direction, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + const WebKit::WebIDBTransaction& transaction, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); dispatcher->RequestIDBIndexOpenObjectCursor( - range, direction, callbacks, idb_index_id_, transaction); + range, direction, callbacks, idb_index_id_, transaction, &ec); } void RendererWebIDBIndexImpl::openKeyCursor( const WebKit::WebIDBKeyRange& range, unsigned short direction, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + const WebKit::WebIDBTransaction& transaction, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - dispatcher->RequestIDBIndexOpenCursor( - range, direction, callbacks, idb_index_id_, transaction); + dispatcher->RequestIDBIndexOpenKeyCursor( + range, direction, callbacks, idb_index_id_, transaction, &ec); } void RendererWebIDBIndexImpl::getObject( const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + const WebKit::WebIDBTransaction& transaction, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); dispatcher->RequestIDBIndexGetObject( - IndexedDBKey(key), callbacks, idb_index_id_, transaction); + IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec); } void RendererWebIDBIndexImpl::getKey( const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + const WebKit::WebIDBTransaction& transaction, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - dispatcher->RequestIDBIndexGet( - IndexedDBKey(key), callbacks, idb_index_id_, transaction); + dispatcher->RequestIDBIndexGetKey( + IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec); } diff --git a/chrome/renderer/renderer_webidbindex_impl.h b/chrome/renderer/renderer_webidbindex_impl.h index 8283109..0566730 100644 --- a/chrome/renderer/renderer_webidbindex_impl.h +++ b/chrome/renderer/renderer_webidbindex_impl.h @@ -20,20 +20,25 @@ class RendererWebIDBIndexImpl : public WebKit::WebIDBIndex { virtual WebKit::WebString storeName() const; virtual WebKit::WebString keyPath() const; virtual bool unique() const; + virtual void openObjectCursor(const WebKit::WebIDBKeyRange& range, unsigned short direction, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); virtual void openKeyCursor(const WebKit::WebIDBKeyRange& range, unsigned short direction, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); virtual void getObject(const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); virtual void getKey(const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); private: int32 idb_index_id_; diff --git a/chrome/renderer/renderer_webidbobjectstore_impl.cc b/chrome/renderer/renderer_webidbobjectstore_impl.cc index 8d0aa6d..10ec94a7 100644 --- a/chrome/renderer/renderer_webidbobjectstore_impl.cc +++ b/chrome/renderer/renderer_webidbobjectstore_impl.cc @@ -20,6 +20,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebString.h" using WebKit::WebDOMStringList; +using WebKit::WebExceptionCode; using WebKit::WebFrame; using WebKit::WebIDBCallbacks; using WebKit::WebIDBKeyRange; @@ -68,11 +69,12 @@ WebDOMStringList RendererWebIDBObjectStoreImpl::indexNames() const { void RendererWebIDBObjectStoreImpl::get( const WebIDBKey& key, WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); dispatcher->RequestIDBObjectStoreGet( - IndexedDBKey(key), callbacks, idb_object_store_id_, transaction); + IndexedDBKey(key), callbacks, idb_object_store_id_, transaction, &ec); } void RendererWebIDBObjectStoreImpl::put( @@ -80,29 +82,32 @@ void RendererWebIDBObjectStoreImpl::put( const WebIDBKey& key, bool add_only, WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); dispatcher->RequestIDBObjectStorePut( SerializedScriptValue(value), IndexedDBKey(key), add_only, callbacks, - idb_object_store_id_, transaction); + idb_object_store_id_, transaction, &ec); } void RendererWebIDBObjectStoreImpl::remove( const WebIDBKey& key, WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); dispatcher->RequestIDBObjectStoreRemove( - IndexedDBKey(key), callbacks, idb_object_store_id_, transaction); + IndexedDBKey(key), callbacks, idb_object_store_id_, transaction, &ec); } -WebKit::WebIDBIndex* RendererWebIDBObjectStoreImpl::createIndex( - const WebKit::WebString& name, - const WebKit::WebString& key_path, +WebIDBIndex* RendererWebIDBObjectStoreImpl::createIndex( + const WebString& name, + const WebString& key_path, bool unique, - const WebKit::WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode& ec) { ViewHostMsg_IDBObjectStoreCreateIndex_Params params; params.name_ = name; params.key_path_ = key_path; @@ -112,17 +117,19 @@ WebKit::WebIDBIndex* RendererWebIDBObjectStoreImpl::createIndex( int32 index_id; RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreCreateIndex(params, &index_id)); + new ViewHostMsg_IDBObjectStoreCreateIndex(params, &index_id, &ec)); if (!index_id) return NULL; return new RendererWebIDBIndexImpl(index_id); } -WebIDBIndex* RendererWebIDBObjectStoreImpl::index(const WebString& name) { +WebIDBIndex* RendererWebIDBObjectStoreImpl::index( + const WebString& name, + WebExceptionCode& ec) { int32 idb_index_id; RenderThread::current()->Send( new ViewHostMsg_IDBObjectStoreIndex(idb_object_store_id_, name, - &idb_index_id)); + &idb_index_id, &ec)); if (!idb_index_id) return NULL; return new RendererWebIDBIndexImpl(idb_index_id); @@ -130,20 +137,22 @@ WebIDBIndex* RendererWebIDBObjectStoreImpl::index(const WebString& name) { void RendererWebIDBObjectStoreImpl::removeIndex( const WebString& name, - const WebKit::WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode& ec) { RenderThread::current()->Send( new ViewHostMsg_IDBObjectStoreRemoveIndex( idb_object_store_id_, name, - IndexedDBDispatcher::TransactionId(transaction))); + IndexedDBDispatcher::TransactionId(transaction), &ec)); } void RendererWebIDBObjectStoreImpl::openCursor( const WebIDBKeyRange& idb_key_range, unsigned short direction, WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + const WebIDBTransaction& transaction, + WebExceptionCode& ec) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); dispatcher->RequestIDBObjectStoreOpenCursor( idb_key_range, direction, callbacks, idb_object_store_id_, - transaction); + transaction, &ec); } diff --git a/chrome/renderer/renderer_webidbobjectstore_impl.h b/chrome/renderer/renderer_webidbobjectstore_impl.h index 210a03c..7beefac 100644 --- a/chrome/renderer/renderer_webidbobjectstore_impl.h +++ b/chrome/renderer/renderer_webidbobjectstore_impl.h @@ -31,30 +31,37 @@ class RendererWebIDBObjectStoreImpl : public WebKit::WebIDBObjectStore { void get(const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); void put(const WebKit::WebSerializedScriptValue& value, const WebKit::WebIDBKey& key, bool add_only, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); void remove(const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); WebKit::WebIDBIndex* createIndex( const WebKit::WebString& name, const WebKit::WebString& key_path, bool unique, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); // Transfers ownership of the WebIDBIndex to the caller. - WebKit::WebIDBIndex* index(const WebKit::WebString& name); + WebKit::WebIDBIndex* index(const WebKit::WebString& name, + WebKit::WebExceptionCode& ec); void removeIndex(const WebKit::WebString& name, - const WebKit::WebIDBTransaction&); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); void openCursor(const WebKit::WebIDBKeyRange& idb_key_range, unsigned short direction, WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); private: int32 idb_object_store_id_; }; |