diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-13 21:11:00 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-13 21:11:00 +0000 |
commit | 2ba871b0a7f13009b6420828af3869d5832efc2d (patch) | |
tree | fc50a741bbdc85640a2df707c0155e7779e6e29e | |
parent | 56879f932544d7752b9a9b5f8e0f3be24d3dcda3 (diff) | |
download | chromium_src-2ba871b0a7f13009b6420828af3869d5832efc2d.zip chromium_src-2ba871b0a7f13009b6420828af3869d5832efc2d.tar.gz chromium_src-2ba871b0a7f13009b6420828af3869d5832efc2d.tar.bz2 |
Make IndexedDBDispatcherHost be a message filter and move its messages into a separate file.
Review URL: http://codereview.chromium.org/5680007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69050 0039d316-1c4b-4281-b951-d872f2087c98
22 files changed, 1307 insertions, 1515 deletions
diff --git a/chrome/browser/in_process_webkit/indexed_db_callbacks.cc b/chrome/browser/in_process_webkit/indexed_db_callbacks.cc index faaa933..41ac4ed 100644 --- a/chrome/browser/in_process_webkit/indexed_db_callbacks.cc +++ b/chrome/browser/in_process_webkit/indexed_db_callbacks.cc @@ -23,21 +23,21 @@ IndexedDBTransactionCallbacks::IndexedDBTransactionCallbacks( IndexedDBTransactionCallbacks::~IndexedDBTransactionCallbacks() {} void IndexedDBCallbacksBase::onError(const WebKit::WebIDBDatabaseError& error) { - dispatcher_host_->Send(new ViewMsg_IDBCallbacksError( + dispatcher_host_->Send(new IndexedDBMsg_CallbacksError( response_id_, error.code(), error.message())); } void IndexedDBTransactionCallbacks::onAbort() { dispatcher_host_->Send( - new ViewMsg_IDBTransactionCallbacksAbort(transaction_id_)); + new IndexedDBMsg_TransactionCallbacksAbort(transaction_id_)); } void IndexedDBTransactionCallbacks::onComplete() { dispatcher_host_->Send( - new ViewMsg_IDBTransactionCallbacksComplete(transaction_id_)); + new IndexedDBMsg_TransactionCallbacksComplete(transaction_id_)); } void IndexedDBTransactionCallbacks::onTimeout() { dispatcher_host_->Send( - new ViewMsg_IDBTransactionCallbacksTimeout(transaction_id_)); + new IndexedDBMsg_TransactionCallbacksTimeout(transaction_id_)); } diff --git a/chrome/browser/in_process_webkit/indexed_db_callbacks.h b/chrome/browser/in_process_webkit/indexed_db_callbacks.h index 653e211..55bc77e 100644 --- a/chrome/browser/in_process_webkit/indexed_db_callbacks.h +++ b/chrome/browser/in_process_webkit/indexed_db_callbacks.h @@ -9,9 +9,7 @@ #include "base/basictypes.h" #include "base/ref_counted.h" #include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" -#include "chrome/common/indexed_db_key.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/serialized_script_value.h" +#include "chrome/common/indexed_db_messages.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBCallbacks.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBCursor.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" @@ -22,16 +20,16 @@ // which (overloaded) onSuccess method we expect to be called. template <class Type> struct WebIDBToMsgHelper { }; template <> struct WebIDBToMsgHelper<WebKit::WebIDBDatabase> { - typedef ViewMsg_IDBCallbacksSuccessIDBDatabase MsgType; + typedef IndexedDBMsg_CallbacksSuccessIDBDatabase MsgType; }; template <> struct WebIDBToMsgHelper<WebKit::WebIDBIndex> { - typedef ViewMsg_IDBCallbacksSuccessIDBIndex MsgType; + typedef IndexedDBMsg_CallbacksSuccessIDBIndex MsgType; }; template <> struct WebIDBToMsgHelper<WebKit::WebIDBObjectStore> { - typedef ViewMsg_IDBCallbacksSuccessIDBObjectStore MsgType; + typedef IndexedDBMsg_CallbacksSuccessIDBObjectStore MsgType; }; template <> struct WebIDBToMsgHelper<WebKit::WebIDBTransaction> { - typedef ViewMsg_IDBCallbacksSuccessIDBTransaction MsgType; + typedef IndexedDBMsg_CallbacksSuccessIDBTransaction MsgType; }; // The code the following two classes share. @@ -90,11 +88,12 @@ class IndexedDBCallbacks<WebKit::WebIDBCursor> virtual void onSuccess(WebKit::WebIDBCursor* idb_object) { int32 object_id = dispatcher_host()->Add(idb_object); dispatcher_host()->Send( - new ViewMsg_IDBCallbacksSuccessIDBCursor(response_id(), object_id)); + new IndexedDBMsg_CallbacksSuccessIDBCursor(response_id(), object_id)); } virtual void onSuccess() { - dispatcher_host()->Send(new ViewMsg_IDBCallbacksSuccessNull(response_id())); + dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessNull( + response_id())); } private: @@ -114,7 +113,7 @@ class IndexedDBCallbacks<WebKit::WebIDBKey> virtual void onSuccess(const WebKit::WebIDBKey& value) { dispatcher_host()->Send( - new ViewMsg_IDBCallbacksSuccessIndexedDBKey( + new IndexedDBMsg_CallbacksSuccessIndexedDBKey( response_id(), IndexedDBKey(value))); } @@ -135,7 +134,7 @@ class IndexedDBCallbacks<WebKit::WebSerializedScriptValue> virtual void onSuccess(const WebKit::WebSerializedScriptValue& value) { dispatcher_host()->Send( - new ViewMsg_IDBCallbacksSuccessSerializedScriptValue( + new IndexedDBMsg_CallbacksSuccessSerializedScriptValue( response_id(), SerializedScriptValue(value))); } @@ -153,7 +152,7 @@ class IndexedDBCallbacks<void> : public IndexedDBCallbacksBase { virtual void onSuccess() { dispatcher_host()->Send( - new ViewMsg_IDBCallbacksSuccessNull(response_id())); + new IndexedDBMsg_CallbacksSuccessNull(response_id())); } private: 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 81de300..667e536 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -14,10 +14,7 @@ #include "chrome/browser/renderer_host/render_view_host_notification_task.h" #include "chrome/browser/renderer_host/resource_message_filter.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/indexed_db_key.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" -#include "chrome/common/serialized_script_value.h" +#include "chrome/common/indexed_db_messages.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/WebKit/chromium/public/WebDOMStringList.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBCursor.h" @@ -61,10 +58,9 @@ void DeleteOnWebKitThread(T* obj) { } -IndexedDBDispatcherHost::IndexedDBDispatcherHost( - IPC::Message::Sender* sender, Profile* profile) - : sender_(sender), - webkit_context_(profile->GetWebKitContext()), +IndexedDBDispatcherHost::IndexedDBDispatcherHost(int process_id, + Profile* profile) + : webkit_context_(profile->GetWebKitContext()), host_content_settings_map_(profile->GetHostContentSettingsMap()), ALLOW_THIS_IN_INITIALIZER_LIST(database_dispatcher_host_( new DatabaseDispatcherHost(this))), @@ -76,154 +72,59 @@ IndexedDBDispatcherHost::IndexedDBDispatcherHost( new CursorDispatcherHost(this))), ALLOW_THIS_IN_INITIALIZER_LIST(transaction_dispatcher_host_( new TransactionDispatcherHost(this))), - process_handle_(0) { - DCHECK(sender_); + process_id_(process_id) { DCHECK(webkit_context_.get()); } IndexedDBDispatcherHost::~IndexedDBDispatcherHost() { } -void IndexedDBDispatcherHost::Init(int process_id, - base::ProcessHandle process_handle) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(sender_); // Ensure Shutdown() has not been called. - DCHECK(!process_handle_); // Make sure Init() has not yet been called. - DCHECK(process_handle); - process_id_ = process_id; - process_handle_ = process_handle; -} - -void IndexedDBDispatcherHost::Shutdown() { - if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { - sender_ = NULL; - - bool success = BrowserThread::PostTask( +void IndexedDBDispatcherHost::OnChannelClosing() { + BrowserThread::DeleteSoon( + BrowserThread::WEBKIT, FROM_HERE, database_dispatcher_host_.release()); + BrowserThread::DeleteSoon( + BrowserThread::WEBKIT, FROM_HERE, index_dispatcher_host_.release()); + BrowserThread::DeleteSoon( BrowserThread::WEBKIT, FROM_HERE, - NewRunnableMethod(this, &IndexedDBDispatcherHost::Shutdown)); - if (success) - return; - } - - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT) || - CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)); - DCHECK(!sender_); - - database_dispatcher_host_.reset(); - index_dispatcher_host_.reset(); - object_store_dispatcher_host_.reset(); - cursor_dispatcher_host_.reset(); - transaction_dispatcher_host_.reset(); -} - -bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(process_handle_); - - switch (message.type()) { - case ViewHostMsg_IDBCursorDirection::ID: - case ViewHostMsg_IDBCursorKey::ID: - case ViewHostMsg_IDBCursorValue::ID: - case ViewHostMsg_IDBCursorUpdate::ID: - case ViewHostMsg_IDBCursorContinue::ID: - case ViewHostMsg_IDBCursorDelete::ID: - case ViewHostMsg_IDBCursorDestroyed::ID: - case ViewHostMsg_IDBFactoryOpen::ID: - case ViewHostMsg_IDBDatabaseName::ID: - case ViewHostMsg_IDBDatabaseVersion::ID: - case ViewHostMsg_IDBDatabaseObjectStoreNames::ID: - case ViewHostMsg_IDBDatabaseCreateObjectStore::ID: - case ViewHostMsg_IDBDatabaseDeleteObjectStore::ID: - case ViewHostMsg_IDBDatabaseSetVersion::ID: - case ViewHostMsg_IDBDatabaseTransaction::ID: - case ViewHostMsg_IDBDatabaseDestroyed::ID: - case ViewHostMsg_IDBIndexName::ID: - case ViewHostMsg_IDBIndexStoreName::ID: - case ViewHostMsg_IDBIndexKeyPath::ID: - case ViewHostMsg_IDBIndexUnique::ID: - case ViewHostMsg_IDBIndexDestroyed::ID: - case ViewHostMsg_IDBIndexOpenObjectCursor::ID: - case ViewHostMsg_IDBIndexOpenKeyCursor::ID: - case ViewHostMsg_IDBIndexGetObject::ID: - case ViewHostMsg_IDBIndexGetKey::ID: - case ViewHostMsg_IDBObjectStoreName::ID: - case ViewHostMsg_IDBObjectStoreKeyPath::ID: - case ViewHostMsg_IDBObjectStoreIndexNames::ID: - case ViewHostMsg_IDBObjectStoreGet::ID: - case ViewHostMsg_IDBObjectStorePut::ID: - case ViewHostMsg_IDBObjectStoreDelete::ID: - case ViewHostMsg_IDBObjectStoreCreateIndex::ID: - case ViewHostMsg_IDBObjectStoreIndex::ID: - case ViewHostMsg_IDBObjectStoreDeleteIndex::ID: - case ViewHostMsg_IDBObjectStoreOpenCursor::ID: - case ViewHostMsg_IDBObjectStoreDestroyed::ID: - case ViewHostMsg_IDBTransactionAbort::ID: - case ViewHostMsg_IDBTransactionMode::ID: - case ViewHostMsg_IDBTransactionDestroyed::ID: - case ViewHostMsg_IDBTransactionDidCompleteTaskEvents::ID: - case ViewHostMsg_IDBTransactionObjectStore::ID: - break; - default: - return false; - } - - bool success = BrowserThread::PostTask( - BrowserThread::WEBKIT, FROM_HERE, NewRunnableMethod( - this, &IndexedDBDispatcherHost::OnMessageReceivedWebKit, message)); - DCHECK(success); - return true; -} - -void IndexedDBDispatcherHost::Send(IPC::Message* message) { - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - // TODO(jorlow): Even if we successfully post, I believe it's possible for - // the task to never run (if the IO thread is already shutting - // down). We may want to handle this case, though - // realistically it probably doesn't matter. - if (!BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, NewRunnableMethod( - this, &IndexedDBDispatcherHost::Send, message))) { - // The IO thread is dead. - delete message; - } - return; - } + object_store_dispatcher_host_.release()); + BrowserThread::DeleteSoon( + BrowserThread::WEBKIT, FROM_HERE, cursor_dispatcher_host_.release()); + BrowserThread::DeleteSoon( + BrowserThread::WEBKIT, FROM_HERE, + transaction_dispatcher_host_.release()); +} - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (!sender_) - delete message; - else - sender_->Send(message); +void IndexedDBDispatcherHost::OverrideThreadForMessage( + const IPC::Message& message, + BrowserThread::ID* thread) { + if (IPC_MESSAGE_CLASS(message) == IndexedDBMsgStart) + *thread = BrowserThread::WEBKIT; } -void IndexedDBDispatcherHost::OnMessageReceivedWebKit( - const IPC::Message& message) { +bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message, + bool* message_was_ok) { + if (IPC_MESSAGE_CLASS(message) != IndexedDBMsgStart) + return false; + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); - DCHECK(process_handle_); - bool msg_is_ok = true; bool handled = - database_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) || - index_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) || - object_store_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) || - cursor_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) || - transaction_dispatcher_host_->OnMessageReceived(message, &msg_is_ok); + database_dispatcher_host_->OnMessageReceived(message, message_was_ok) || + index_dispatcher_host_->OnMessageReceived(message, message_was_ok) || + object_store_dispatcher_host_->OnMessageReceived( + message, message_was_ok) || + cursor_dispatcher_host_->OnMessageReceived(message, message_was_ok) || + transaction_dispatcher_host_->OnMessageReceived(message, message_was_ok); if (!handled) { handled = true; - DCHECK(msg_is_ok); - IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost, message, msg_is_ok) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBFactoryOpen, - OnIDBFactoryOpen) + IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost, message, *message_was_ok) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryOpen, OnIDBFactoryOpen) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() } - DCHECK(handled); - if (!msg_is_ok) { - BrowserRenderProcessHost::BadMessageTerminateProcess(message.type(), - process_handle_); - } + return handled; } int32 IndexedDBDispatcherHost::Add(WebIDBCursor* idb_cursor) { @@ -253,7 +154,7 @@ int32 IndexedDBDispatcherHost::Add(WebIDBTransaction* idb_transaction) { } void IndexedDBDispatcherHost::OnIDBFactoryOpen( - const ViewHostMsg_IDBFactoryOpen_Params& params) { + const IndexedDBHostMsg_FactoryOpen_Params& params) { FilePath base_path = webkit_context_->data_path(); FilePath indexed_db_path; if (!base_path.empty()) { @@ -263,16 +164,16 @@ void IndexedDBDispatcherHost::OnIDBFactoryOpen( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); GURL host(string16(WebSecurityOrigin::createFromDatabaseIdentifier( - params.origin_).toString())); + params.origin).toString())); ContentSetting content_setting = host_content_settings_map_->GetContentSetting( host, CONTENT_SETTINGS_TYPE_COOKIES, ""); CallRenderViewHostContentSettingsDelegate( - process_id_, params.routing_id_, + process_id_, params.routing_id, &RenderViewHostDelegate::ContentSettings::OnIndexedDBAccessed, - host, params.name_, content_setting == CONTENT_SETTING_BLOCK); + host, params.name, content_setting == CONTENT_SETTING_BLOCK); if (content_setting == CONTENT_SETTING_BLOCK) { // TODO(jorlow): Change this to the proper error code once we figure out @@ -280,12 +181,12 @@ void IndexedDBDispatcherHost::OnIDBFactoryOpen( int error_code = 0; // Defined by the IndexedDB spec. static string16 error_message = ASCIIToUTF16( "The user denied permission to open the database."); - Send(new ViewMsg_IDBCallbacksError(params.response_id_, error_code, - error_message)); + Send(new IndexedDBMsg_CallbacksError(params.response_id, error_code, + error_message)); return; } - DCHECK(kDefaultQuota == params.maximum_size_); + DCHECK(kDefaultQuota == params.maximum_size); uint64 quota = kDefaultQuota; if (CommandLine::ForCurrentProcess()->HasSwitch( @@ -294,9 +195,9 @@ void IndexedDBDispatcherHost::OnIDBFactoryOpen( } Context()->GetIDBFactory()->open( - params.name_, - new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id_), - WebSecurityOrigin::createFromDatabaseIdentifier(params.origin_), NULL, + params.name, + new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id), + WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL, webkit_glue::FilePathToWebString(indexed_db_path), quota); } @@ -307,14 +208,11 @@ void IndexedDBDispatcherHost::OnIDBFactoryOpen( template <typename ObjectType> ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id, - IPC::Message* reply_msg, uint32 message_type) { + uint32 message_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); ObjectType* return_object = map->Lookup(return_object_id); - if (!return_object) { - BrowserRenderProcessHost::BadMessageTerminateProcess(message_type, - process_handle_); - delete reply_msg; - } + if (!return_object) + BadMessageReceived(message_type); return return_object; } @@ -322,22 +220,20 @@ template <typename ReplyType, typename MessageType, typename MapObjectType, typename Method> void IndexedDBDispatcherHost::SyncGetter( IDMap<MapObjectType, IDMapOwnPointer>* map, int32 object_id, - IPC::Message* reply_msg, Method method) { - MapObjectType* object = GetOrTerminateProcess(map, object_id, reply_msg, + ReplyType* reply, Method method) { + MapObjectType* object = GetOrTerminateProcess(map, object_id, MessageType::ID); if (!object) return; - ReplyType reply = (object->*method)(); - MessageType::WriteReplyParams(reply_msg, reply); - Send(reply_msg); + *reply = (object->*method)(); } template <typename ObjectType> void IndexedDBDispatcherHost::DestroyObject( IDMap<ObjectType, IDMapOwnPointer>* map, int32 object_id, uint32 message_type) { - GetOrTerminateProcess(map, object_id, NULL, message_type); + GetOrTerminateProcess(map, object_id, message_type); map->Remove(object_id); } @@ -360,19 +256,17 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, message, *msg_is_ok) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseName, OnName) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseVersion, OnVersion) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseObjectStoreNames, - OnObjectStoreNames) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseCreateObjectStore, - OnCreateObjectStore) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseDeleteObjectStore, - OnDeleteObjectStore) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseSetVersion, - OnSetVersion) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseTransaction, - OnTransaction) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseDestroyed, OnDestroyed) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseName, OnName) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseVersion, OnVersion) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseObjectStoreNames, + OnObjectStoreNames) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, + OnCreateObjectStore) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, + OnDeleteObjectStore) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetVersion, OnSetVersion) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransaction, OnTransaction) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -380,104 +274,85 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( IPC::Message* message) { - // The macro magic in OnMessageReceived requires this to link, but it should - // never actually be called. - NOTREACHED(); parent_->Send(message); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnName( - int32 object_id, IPC::Message* reply_msg) { - parent_->SyncGetter<string16, ViewHostMsg_IDBDatabaseName>( - &map_, object_id, reply_msg, &WebIDBDatabase::name); + int32 object_id, string16* name) { + parent_->SyncGetter<string16, IndexedDBHostMsg_DatabaseName>( + &map_, object_id, name, &WebIDBDatabase::name); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnVersion( - int32 object_id, IPC::Message* reply_msg) { - parent_->SyncGetter<string16, ViewHostMsg_IDBDatabaseVersion>( - &map_, object_id, reply_msg, &WebIDBDatabase::version); + int32 object_id, string16* version) { + parent_->SyncGetter<string16, IndexedDBHostMsg_DatabaseVersion>( + &map_, object_id, version, &WebIDBDatabase::version); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnObjectStoreNames( - int32 idb_database_id, IPC::Message* reply_msg) { + int32 idb_database_id, std::vector<string16>* object_stores) { WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( - &map_, idb_database_id, reply_msg, - ViewHostMsg_IDBDatabaseObjectStoreNames::ID); + &map_, idb_database_id, IndexedDBHostMsg_DatabaseObjectStoreNames::ID); if (!idb_database) return; WebDOMStringList web_object_stores = idb_database->objectStoreNames(); - std::vector<string16> object_stores; - object_stores.reserve(web_object_stores.length()); + object_stores->reserve(web_object_stores.length()); for (unsigned i = 0; i < web_object_stores.length(); ++i) - object_stores.push_back(web_object_stores.item(i)); - ViewHostMsg_IDBDatabaseObjectStoreNames::WriteReplyParams(reply_msg, - object_stores); - parent_->Send(reply_msg); + object_stores->push_back(web_object_stores.item(i)); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateObjectStore( - const ViewHostMsg_IDBDatabaseCreateObjectStore_Params& params, - IPC::Message* reply_msg) { + const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params, + int32* object_store_id, WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( - &map_, params.idb_database_id_, NULL, - ViewHostMsg_IDBDatabaseCreateObjectStore::ID); + &map_, params.idb_database_id, + IndexedDBHostMsg_DatabaseCreateObjectStore::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, params.transaction_id_, - NULL, ViewHostMsg_IDBDatabaseCreateObjectStore::ID); + &parent_->transaction_dispatcher_host_->map_, params.transaction_id, + IndexedDBHostMsg_DatabaseCreateObjectStore::ID); 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, ec); - ViewHostMsg_IDBDatabaseCreateObjectStore::WriteReplyParams( - reply_msg, ec ? 0 : parent_->Add(object_store), ec); - parent_->Send(reply_msg); + params.name, params.key_path, params.auto_increment, + *idb_transaction, *ec); + *object_store_id = *ec ? 0 : parent_->Add(object_store); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore( int32 idb_database_id, const string16& name, int32 transaction_id, - IPC::Message* reply_msg) { + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( - &map_, idb_database_id, NULL, - ViewHostMsg_IDBDatabaseDeleteObjectStore::ID); + &map_, idb_database_id, IndexedDBHostMsg_DatabaseDeleteObjectStore::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL, - ViewHostMsg_IDBDatabaseDeleteObjectStore::ID); + &parent_->transaction_dispatcher_host_->map_, transaction_id, + IndexedDBHostMsg_DatabaseDeleteObjectStore::ID); if (!idb_database || !idb_transaction) return; - WebExceptionCode ec = 0; - idb_database->deleteObjectStore(name, *idb_transaction, ec); - ViewHostMsg_IDBDatabaseDeleteObjectStore::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + idb_database->deleteObjectStore(name, *idb_transaction, *ec); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion( int32 idb_database_id, int32 response_id, const string16& version, - IPC::Message* reply_msg) { + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( - &map_, idb_database_id, NULL, - ViewHostMsg_IDBDatabaseSetVersion::ID); + &map_, idb_database_id, IndexedDBHostMsg_DatabaseSetVersion::ID); if (!idb_database) return; - WebExceptionCode ec = 0; idb_database->setVersion( version, new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id), - ec); - ViewHostMsg_IDBDatabaseSetVersion::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + *ec); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( @@ -485,10 +360,10 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( const std::vector<string16>& names, int32 mode, int32 timeout, - IPC::Message* reply_msg) { + int32* idb_transaction_id, + WebKit::WebExceptionCode* ec) { WebIDBDatabase* database = parent_->GetOrTerminateProcess( - &map_, idb_database_id, reply_msg, - ViewHostMsg_IDBDatabaseTransaction::ID); + &map_, idb_database_id, IndexedDBHostMsg_DatabaseTransaction::ID); if (!database) return; @@ -498,19 +373,16 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( object_stores.append(*it); } - WebExceptionCode ec = 0; WebIDBTransaction* transaction = database->transaction( - 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); + object_stores, mode, timeout, *ec); + DCHECK(!transaction != !*ec); + *idb_transaction_id = *ec ? 0 : parent_->Add(transaction); } void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed( int32 object_id) { parent_->DestroyObject(&map_, object_id, - ViewHostMsg_IDBDatabaseDestroyed::ID); + IndexedDBHostMsg_DatabaseDestroyed::ID); } @@ -532,17 +404,16 @@ bool IndexedDBDispatcherHost::IndexDispatcherHost::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::IndexDispatcherHost, message, *msg_is_ok) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBIndexName, OnName) - 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_DELAY_REPLY(ViewHostMsg_IDBIndexOpenObjectCursor, + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexName, OnName) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexStoreName, OnStoreName) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexKeyPath, OnKeyPath) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexUnique, OnUnique) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexOpenObjectCursor, 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_HANDLER(IndexedDBHostMsg_IndexOpenKeyCursor, OnOpenKeyCursor) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexGetObject, OnGetObject) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexGetKey, OnGetKey) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -550,81 +421,71 @@ bool IndexedDBDispatcherHost::IndexDispatcherHost::OnMessageReceived( void IndexedDBDispatcherHost::IndexDispatcherHost::Send( IPC::Message* message) { - // The macro magic in OnMessageReceived requires this to link, but it should - // never actually be called. - NOTREACHED(); parent_->Send(message); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnName( - int32 object_id, IPC::Message* reply_msg) { - parent_->SyncGetter<string16, ViewHostMsg_IDBIndexName>( - &map_, object_id, reply_msg, &WebIDBIndex::name); + int32 object_id, string16* name) { + parent_->SyncGetter<string16, IndexedDBHostMsg_IndexName>( + &map_, object_id, name, &WebIDBIndex::name); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnStoreName( - int32 object_id, IPC::Message* reply_msg) { - parent_->SyncGetter<string16, ViewHostMsg_IDBIndexStoreName>( - &map_, object_id, reply_msg, &WebIDBIndex::storeName); + int32 object_id, string16* store_name) { + parent_->SyncGetter<string16, IndexedDBHostMsg_IndexStoreName>( + &map_, object_id, store_name, &WebIDBIndex::storeName); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnKeyPath( - int32 object_id, IPC::Message* reply_msg) { - parent_->SyncGetter<NullableString16, ViewHostMsg_IDBIndexKeyPath>( - &map_, object_id, reply_msg, &WebIDBIndex::keyPath); + int32 object_id, NullableString16* key_path) { + parent_->SyncGetter<NullableString16, IndexedDBHostMsg_IndexKeyPath>( + &map_, object_id, key_path, &WebIDBIndex::keyPath); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnUnique( - int32 object_id, IPC::Message* reply_msg) { - parent_->SyncGetter<bool, ViewHostMsg_IDBIndexUnique>( - &map_, object_id, reply_msg, &WebIDBIndex::unique); + int32 object_id, bool* unique) { + parent_->SyncGetter<bool, IndexedDBHostMsg_IndexUnique>( + &map_, object_id, unique, &WebIDBIndex::unique); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenObjectCursor( - const ViewHostMsg_IDBIndexOpenCursor_Params& params, - IPC::Message* reply_msg) { + const IndexedDBHostMsg_IndexOpenCursor_Params& params, + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( - &map_, params.idb_index_id_, NULL, - ViewHostMsg_IDBIndexOpenObjectCursor::ID); + &map_, params.idb_index_id, IndexedDBHostMsg_IndexOpenObjectCursor::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( &parent_->transaction_dispatcher_host_->map_, - params.transaction_id_, NULL, ViewHostMsg_IDBIndexOpenObjectCursor::ID); + params.transaction_id, IndexedDBHostMsg_IndexOpenObjectCursor::ID); if (!idb_transaction || !idb_index) return; scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); - WebExceptionCode ec = 0; + new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id)); idb_index->openObjectCursor( - WebIDBKeyRange(params.lower_key_, params.upper_key_, params.lower_open_, - params.upper_open_), - params.direction_, callbacks.release(), *idb_transaction, ec); - ViewHostMsg_IDBIndexOpenObjectCursor::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, + params.upper_open), + params.direction, callbacks.release(), *idb_transaction, *ec); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor( - const ViewHostMsg_IDBIndexOpenCursor_Params& params, - IPC::Message* reply_msg) { + const IndexedDBHostMsg_IndexOpenCursor_Params& params, + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( - &map_, params.idb_index_id_, NULL, ViewHostMsg_IDBIndexOpenKeyCursor::ID); + &map_, params.idb_index_id, IndexedDBHostMsg_IndexOpenKeyCursor::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, params.transaction_id_, - NULL, ViewHostMsg_IDBIndexOpenKeyCursor::ID); + &parent_->transaction_dispatcher_host_->map_, params.transaction_id, + IndexedDBHostMsg_IndexOpenKeyCursor::ID); if (!idb_transaction || !idb_index) return; scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); - WebExceptionCode ec = 0; + new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id)); idb_index->openKeyCursor( - WebIDBKeyRange(params.lower_key_, params.upper_key_, params.lower_open_, - params.upper_open_), - params.direction_, callbacks.release(), *idb_transaction, ec); - ViewHostMsg_IDBIndexOpenKeyCursor::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, + params.upper_open), + params.direction, callbacks.release(), *idb_transaction, *ec); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( @@ -632,22 +493,19 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( int32 response_id, const IndexedDBKey& key, int32 transaction_id, - IPC::Message* reply_msg) { + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( - &map_, idb_index_id, NULL, ViewHostMsg_IDBIndexGetObject::ID); + &map_, idb_index_id, IndexedDBHostMsg_IndexGetObject::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL, - ViewHostMsg_IDBIndexGetObject::ID); + &parent_->transaction_dispatcher_host_->map_, transaction_id, + IndexedDBHostMsg_IndexGetObject::ID); if (!idb_transaction || !idb_index) return; scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); - WebExceptionCode ec = 0; - idb_index->getObject(key, callbacks.release(), *idb_transaction, ec); - ViewHostMsg_IDBIndexGetObject::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + idb_index->getObject(key, callbacks.release(), *idb_transaction, *ec); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey( @@ -655,27 +513,24 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey( int32 response_id, const IndexedDBKey& key, int32 transaction_id, - IPC::Message* reply_msg) { + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( - &map_, idb_index_id, NULL, ViewHostMsg_IDBIndexGetKey::ID); + &map_, idb_index_id, IndexedDBHostMsg_IndexGetKey::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL, - ViewHostMsg_IDBIndexGetKey::ID); + &parent_->transaction_dispatcher_host_->map_, transaction_id, + IndexedDBHostMsg_IndexGetKey::ID); if (!idb_transaction || !idb_index) return; scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<WebIDBKey>(parent_, response_id)); - WebExceptionCode ec = 0; - idb_index->getKey(key, callbacks.release(), *idb_transaction, ec); - ViewHostMsg_IDBIndexGetKey::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + idb_index->getKey(key, callbacks.release(), *idb_transaction, *ec); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnDestroyed( int32 object_id) { - parent_->DestroyObject(&map_, object_id, ViewHostMsg_IDBIndexDestroyed::ID); + parent_->DestroyObject(&map_, object_id, IndexedDBHostMsg_IndexDestroyed::ID); } ////////////////////////////////////////////////////////////////////// @@ -697,22 +552,17 @@ bool IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::ObjectStoreDispatcherHost, message, *msg_is_ok) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreName, OnName) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreKeyPath, - OnKeyPath) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreIndexNames, - OnIndexNames) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreGet, OnGet); - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStorePut, OnPut); - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreDelete, OnDelete); - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreCreateIndex, - OnCreateIndex); - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreIndex, OnIndex); - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreDeleteIndex, - OnDeleteIndex); - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBObjectStoreOpenCursor, - OnOpenCursor) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBObjectStoreDestroyed, OnDestroyed) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreName, OnName) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreKeyPath, OnKeyPath) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndexNames, OnIndexNames) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreGet, OnGet) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStorePut, OnPut) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDelete, OnDelete) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCreateIndex, OnCreateIndex) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndex, OnIndex) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndex, OnDeleteIndex) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreOpenCursor, OnOpenCursor) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -720,40 +570,32 @@ bool IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnMessageReceived( void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::Send( IPC::Message* message) { - // The macro magic in OnMessageReceived requires this to link, but it should - // never actually be called. - NOTREACHED(); parent_->Send(message); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnName( - int32 object_id, IPC::Message* reply_msg) { - parent_->SyncGetter<string16, ViewHostMsg_IDBObjectStoreName>( - &map_, object_id, reply_msg, &WebIDBObjectStore::name); + int32 object_id, string16* name) { + parent_->SyncGetter<string16, IndexedDBHostMsg_ObjectStoreName>( + &map_, object_id, name, &WebIDBObjectStore::name); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnKeyPath( - int32 object_id, IPC::Message* reply_msg) { - parent_->SyncGetter<NullableString16, ViewHostMsg_IDBObjectStoreKeyPath>( - &map_, object_id, reply_msg, &WebIDBObjectStore::keyPath); + int32 object_id, NullableString16* keyPath) { + parent_->SyncGetter<NullableString16, IndexedDBHostMsg_ObjectStoreKeyPath>( + &map_, object_id, keyPath, &WebIDBObjectStore::keyPath); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames( - int32 idb_object_store_id, IPC::Message* reply_msg) { + int32 idb_object_store_id, std::vector<string16>* index_names) { WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( - &map_, idb_object_store_id, reply_msg, - ViewHostMsg_IDBObjectStoreIndexNames::ID); + &map_, idb_object_store_id, IndexedDBHostMsg_ObjectStoreIndexNames::ID); if (!idb_object_store) return; WebDOMStringList web_index_names = idb_object_store->indexNames(); - std::vector<string16> index_names; - index_names.reserve(web_index_names.length()); + index_names->reserve(web_index_names.length()); for (unsigned i = 0; i < web_index_names.length(); ++i) - index_names.push_back(web_index_names.item(i)); - ViewHostMsg_IDBObjectStoreIndexNames::WriteReplyParams(reply_msg, - index_names); - parent_->Send(reply_msg); + index_names->push_back(web_index_names.item(i)); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet( @@ -761,44 +603,37 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet( int32 response_id, const IndexedDBKey& key, int32 transaction_id, - IPC::Message* reply_msg) { + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( - &map_, idb_object_store_id, NULL, ViewHostMsg_IDBObjectStoreGet::ID); + &map_, idb_object_store_id, IndexedDBHostMsg_ObjectStoreGet::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL, - ViewHostMsg_IDBObjectStoreGet::ID); + &parent_->transaction_dispatcher_host_->map_, transaction_id, + IndexedDBHostMsg_ObjectStoreGet::ID); if (!idb_transaction || !idb_object_store) return; scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); - WebExceptionCode ec = 0; - idb_object_store->get(key, callbacks.release(), *idb_transaction, ec); - ViewHostMsg_IDBObjectStoreGet::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + idb_object_store->get(key, callbacks.release(), *idb_transaction, *ec); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut( - const ViewHostMsg_IDBObjectStorePut_Params& params, - IPC::Message* reply_msg) { + const IndexedDBHostMsg_ObjectStorePut_Params& params, + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( - &map_, params.idb_object_store_id_, NULL, - ViewHostMsg_IDBObjectStorePut::ID); + &map_, params.idb_object_store_id, IndexedDBHostMsg_ObjectStorePut::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, params.transaction_id_, - NULL, ViewHostMsg_IDBObjectStorePut::ID); + &parent_->transaction_dispatcher_host_->map_, params.transaction_id, + IndexedDBHostMsg_ObjectStorePut::ID); if (!idb_transaction || !idb_object_store) return; 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, ec); - ViewHostMsg_IDBObjectStorePut::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id)); + idb_object_store->put(params.serialized_value, params.key, params.add_only, + callbacks.release(), *idb_transaction, *ec); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete( @@ -806,112 +641,96 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete( int32 response_id, const IndexedDBKey& key, int32 transaction_id, - IPC::Message* reply_msg) { + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( - &map_, idb_object_store_id, NULL, ViewHostMsg_IDBObjectStoreDelete::ID); + &map_, idb_object_store_id, IndexedDBHostMsg_ObjectStoreDelete::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL, - ViewHostMsg_IDBObjectStoreDelete::ID); + &parent_->transaction_dispatcher_host_->map_, transaction_id, + IndexedDBHostMsg_ObjectStoreDelete::ID); if (!idb_transaction || !idb_object_store) return; scoped_ptr<WebIDBCallbacks> callbacks( new IndexedDBCallbacks<void>(parent_, response_id)); - WebExceptionCode ec = 0; - idb_object_store->deleteFunction(key, callbacks.release(), *idb_transaction, ec); - ViewHostMsg_IDBObjectStoreDelete::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + idb_object_store->deleteFunction( + key, callbacks.release(), *idb_transaction, *ec); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCreateIndex( - const ViewHostMsg_IDBObjectStoreCreateIndex_Params& params, - IPC::Message* reply_msg) { + const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params, + int32* index_id, WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( - &map_, params.idb_object_store_id_, NULL, - ViewHostMsg_IDBObjectStoreCreateIndex::ID); + &map_, params.idb_object_store_id, + IndexedDBHostMsg_ObjectStoreCreateIndex::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, params.transaction_id_, - NULL, ViewHostMsg_IDBObjectStoreCreateIndex::ID); + &parent_->transaction_dispatcher_host_->map_, params.transaction_id, + IndexedDBHostMsg_ObjectStoreCreateIndex::ID); 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, ec); - ViewHostMsg_IDBObjectStoreCreateIndex::WriteReplyParams( - reply_msg, ec ? 0 : parent_->Add(index), ec); - parent_->Send(reply_msg); + params.name, params.key_path, params.unique, *idb_transaction, *ec); + *index_id = *ec ? 0 : parent_->Add(index); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndex( int32 idb_object_store_id, const string16& name, - IPC::Message* reply_msg) { + int32* idb_index_id, + WebKit::WebExceptionCode* ec) { WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( - &map_, idb_object_store_id, reply_msg, - ViewHostMsg_IDBObjectStoreIndex::ID); + &map_, idb_object_store_id, IndexedDBHostMsg_ObjectStoreIndex::ID); if (!idb_object_store) return; - WebExceptionCode ec = 0; - WebIDBIndex* index = idb_object_store->index(name, ec); - int32 object_id = parent_->Add(index); - ViewHostMsg_IDBObjectStoreIndex::WriteReplyParams(reply_msg, object_id, ec); - parent_->Send(reply_msg); + WebIDBIndex* index = idb_object_store->index(name, *ec); + *idb_index_id = parent_->Add(index); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDeleteIndex( int32 idb_object_store_id, const string16& name, int32 transaction_id, - IPC::Message* reply_msg) { + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( - &map_, idb_object_store_id, NULL, - ViewHostMsg_IDBObjectStoreDeleteIndex::ID); + &map_, idb_object_store_id, IndexedDBHostMsg_ObjectStoreDeleteIndex::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL, - ViewHostMsg_IDBObjectStoreDeleteIndex::ID); + &parent_->transaction_dispatcher_host_->map_, transaction_id, + IndexedDBHostMsg_ObjectStoreDeleteIndex::ID); if (!idb_object_store || !idb_transaction) return; - WebExceptionCode ec = 0; - idb_object_store->deleteIndex(name, *idb_transaction, ec); - ViewHostMsg_IDBObjectStoreDeleteIndex::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + idb_object_store->deleteIndex(name, *idb_transaction, *ec); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnOpenCursor( - const ViewHostMsg_IDBObjectStoreOpenCursor_Params& params, - IPC::Message* reply_msg) { + const IndexedDBHostMsg_ObjectStoreOpenCursor_Params& params, + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( &parent_->object_store_dispatcher_host_->map_, - params.idb_object_store_id_, NULL, - ViewHostMsg_IDBObjectStoreOpenCursor::ID); + params.idb_object_store_id, IndexedDBHostMsg_ObjectStoreOpenCursor::ID); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, params.transaction_id_, - NULL, ViewHostMsg_IDBObjectStoreOpenCursor::ID); + &parent_->transaction_dispatcher_host_->map_, params.transaction_id, + IndexedDBHostMsg_ObjectStoreOpenCursor::ID); if (!idb_transaction || !idb_object_store) return; scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); - WebExceptionCode ec = 0; + new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id)); idb_object_store->openCursor( - WebIDBKeyRange(params.lower_key_, params.upper_key_, params.lower_open_, - params.upper_open_), - params.direction_, callbacks.release(), *idb_transaction, ec); - ViewHostMsg_IDBObjectStoreOpenCursor::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, + params.upper_open), + params.direction, callbacks.release(), *idb_transaction, *ec); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed( int32 object_id) { parent_->DestroyObject( - &map_, object_id, ViewHostMsg_IDBObjectStoreDestroyed::ID); + &map_, object_id, IndexedDBHostMsg_ObjectStoreDestroyed::ID); } ////////////////////////////////////////////////////////////////////// @@ -932,14 +751,13 @@ bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::CursorDispatcherHost, message, *msg_is_ok) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorDirection, - OnDirection) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorKey, OnKey) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorValue, OnValue) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorUpdate, OnUpdate) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorContinue, OnContinue) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorDelete, OnDelete) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBCursorDestroyed, OnDestroyed) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDirection, OnDirection) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorKey, OnKey) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorValue, OnValue) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorUpdate, OnUpdate) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorContinue, OnContinue) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDelete, OnDelete) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_CursorDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -948,111 +766,94 @@ bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived( void IndexedDBDispatcherHost::CursorDispatcherHost::Send( IPC::Message* message) { - // The macro magic in OnMessageReceived requires this to link, but it should - // never actually be called. - NOTREACHED(); parent_->Send(message); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnDirection( - int32 object_id, IPC::Message* reply_msg) { + int32 object_id, int32* direction) { WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( - &map_, object_id, reply_msg, - ViewHostMsg_IDBCursorDirection::ID); + &map_, object_id, IndexedDBHostMsg_CursorDirection::ID); if (!idb_cursor) return; - int direction = idb_cursor->direction(); - ViewHostMsg_IDBCursorDirection::WriteReplyParams(reply_msg, direction); - parent_->Send(reply_msg); + *direction = idb_cursor->direction(); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnKey( - int32 object_id, IPC::Message* reply_msg) { + int32 object_id, IndexedDBKey* key) { WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( - &map_, object_id, reply_msg, - ViewHostMsg_IDBCursorKey::ID); + &map_, object_id, IndexedDBHostMsg_CursorKey::ID); if (!idb_cursor) return; - IndexedDBKey key(idb_cursor->key()); - ViewHostMsg_IDBCursorKey::WriteReplyParams(reply_msg, key); - parent_->Send(reply_msg); + *key = IndexedDBKey(idb_cursor->key()); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnValue( - int32 object_id, IPC::Message* reply_msg) { + int32 object_id, + SerializedScriptValue* script_value, + IndexedDBKey* key) { WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( - &map_, object_id, reply_msg, - ViewHostMsg_IDBCursorValue::ID); + &map_, object_id, IndexedDBHostMsg_CursorValue::ID); if (!idb_cursor) return; - WebSerializedScriptValue scriptValue; - WebIDBKey key; - idb_cursor->value(scriptValue, key); - ViewHostMsg_IDBCursorValue::WriteReplyParams( - reply_msg, SerializedScriptValue(scriptValue), IndexedDBKey(key)); - parent_->Send(reply_msg); + WebSerializedScriptValue temp_script_value; + WebIDBKey temp_key; + idb_cursor->value(temp_script_value, temp_key); + + *script_value = SerializedScriptValue(temp_script_value); + *key = IndexedDBKey(temp_key); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate( int32 cursor_id, int32 response_id, const SerializedScriptValue& value, - IPC::Message* reply_msg) { + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( - &map_, cursor_id, NULL, ViewHostMsg_IDBCursorUpdate::ID); + &map_, cursor_id, IndexedDBHostMsg_CursorUpdate::ID); if (!idb_cursor) return; - WebExceptionCode ec = 0; idb_cursor->update( - value, new IndexedDBCallbacks<void>(parent_, response_id), ec); - ViewHostMsg_IDBCursorUpdate::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + value, new IndexedDBCallbacks<void>(parent_, response_id), *ec); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue( int32 cursor_id, int32 response_id, const IndexedDBKey& key, - IPC::Message* reply_msg) { + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( - &map_, cursor_id, NULL, ViewHostMsg_IDBCursorContinue::ID); + &map_, cursor_id, IndexedDBHostMsg_CursorContinue::ID); if (!idb_cursor) return; - WebExceptionCode ec = 0; idb_cursor->continueFunction( - key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id), ec); - ViewHostMsg_IDBCursorContinue::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id), *ec); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( int32 cursor_id, int32 response_id, - IPC::Message* reply_msg) { + WebKit::WebExceptionCode* ec) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( - &map_, cursor_id, NULL, ViewHostMsg_IDBCursorUpdate::ID); + &map_, cursor_id, IndexedDBHostMsg_CursorUpdate::ID); if (!idb_cursor) return; - WebExceptionCode ec = 0; // TODO(jorlow): This should be delete. - idb_cursor->remove(new IndexedDBCallbacks<void>(parent_, response_id), ec); - ViewHostMsg_IDBCursorUpdate::WriteReplyParams(reply_msg, ec); - parent_->Send(reply_msg); + idb_cursor->remove(new IndexedDBCallbacks<void>(parent_, response_id), *ec); } void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( int32 object_id) { parent_->DestroyObject( - &map_, object_id, ViewHostMsg_IDBCursorDestroyed::ID); + &map_, object_id, IndexedDBHostMsg_CursorDestroyed::ID); } ////////////////////////////////////////////////////////////////////// @@ -1079,13 +880,12 @@ bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::TransactionDispatcherHost, message, *msg_is_ok) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionAbort, OnAbort) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBTransactionMode, OnMode) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBTransactionObjectStore, - OnObjectStore) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionDidCompleteTaskEvents, + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionAbort, OnAbort) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionMode, OnMode) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionObjectStore, OnObjectStore) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionDidCompleteTaskEvents, OnDidCompleteTaskEvents) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionDestroyed, OnDestroyed) + IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -1093,16 +893,13 @@ bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived( void IndexedDBDispatcherHost::TransactionDispatcherHost::Send( IPC::Message* message) { - // The macro magic in OnMessageReceived requires this to link, but it should - // never actually be called. - NOTREACHED(); parent_->Send(message); } void IndexedDBDispatcherHost::TransactionDispatcherHost::OnAbort( int32 transaction_id) { WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &map_, transaction_id, 0, ViewHostMsg_IDBTransactionAbort::ID); + &map_, transaction_id, IndexedDBHostMsg_TransactionAbort::ID); if (!idb_transaction) return; @@ -1111,39 +908,32 @@ void IndexedDBDispatcherHost::TransactionDispatcherHost::OnAbort( void IndexedDBDispatcherHost::TransactionDispatcherHost::OnMode( int32 transaction_id, - IPC::Message* reply_msg) { + int* mode) { WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &map_, transaction_id, 0, ViewHostMsg_IDBTransactionMode::ID); + &map_, transaction_id, IndexedDBHostMsg_TransactionMode::ID); if (!idb_transaction) return; - int mode = idb_transaction->mode(); - ViewHostMsg_IDBTransactionMode::WriteReplyParams(reply_msg, mode); - parent_->Send(reply_msg); + *mode = idb_transaction->mode(); } void IndexedDBDispatcherHost::TransactionDispatcherHost::OnObjectStore( - int32 transaction_id, const string16& name, IPC::Message* reply_msg) { + int32 transaction_id, const string16& name, int32* object_store_id, + WebKit::WebExceptionCode* ec) { WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &map_, transaction_id, reply_msg, - ViewHostMsg_IDBTransactionObjectStore::ID); + &map_, transaction_id, IndexedDBHostMsg_TransactionObjectStore::ID); if (!idb_transaction) return; - WebExceptionCode ec = 0; - WebIDBObjectStore* object_store = idb_transaction->objectStore(name, ec); - int32 object_id = object_store ? parent_->Add(object_store) : 0; - ViewHostMsg_IDBTransactionObjectStore::WriteReplyParams( - reply_msg, object_id, ec); - parent_->Send(reply_msg); + WebIDBObjectStore* object_store = idb_transaction->objectStore(name, *ec); } void IndexedDBDispatcherHost:: TransactionDispatcherHost::OnDidCompleteTaskEvents(int transaction_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &map_, transaction_id, 0, - ViewHostMsg_IDBTransactionDidCompleteTaskEvents::ID); + &map_, transaction_id, + IndexedDBHostMsg_TransactionDidCompleteTaskEvents::ID); if (!idb_transaction) return; @@ -1153,5 +943,5 @@ void IndexedDBDispatcherHost:: void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( int32 object_id) { parent_->DestroyObject( - &map_, object_id, ViewHostMsg_IDBTransactionDestroyed::ID); + &map_, object_id, IndexedDBHostMsg_TransactionDestroyed::ID); } 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 9b1a8ab..db68ed7 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h @@ -8,21 +8,21 @@ #include "base/basictypes.h" #include "base/id_map.h" -#include "base/process.h" -#include "base/ref_counted.h" +#include "chrome/browser/browser_message_filter.h" #include "chrome/browser/in_process_webkit/webkit_context.h" -#include "ipc/ipc_message.h" +#include "third_party/WebKit/WebKit/chromium/public/WebExceptionCode.h" class HostContentSettingsMap; class IndexedDBKey; +class NullableString16; class Profile; class SerializedScriptValue; -struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params; -struct ViewHostMsg_IDBFactoryOpen_Params; -struct ViewHostMsg_IDBIndexOpenCursor_Params; -struct ViewHostMsg_IDBObjectStoreCreateIndex_Params; -struct ViewHostMsg_IDBObjectStoreOpenCursor_Params; -struct ViewHostMsg_IDBObjectStorePut_Params; +struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; +struct IndexedDBHostMsg_FactoryOpen_Params; +struct IndexedDBHostMsg_IndexOpenCursor_Params; +struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params; +struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params; +struct IndexedDBHostMsg_ObjectStorePut_Params; namespace WebKit { class WebIDBCursor; @@ -33,25 +33,17 @@ class WebIDBTransaction; } // Handles all IndexedDB related messages from a particular renderer process. -class IndexedDBDispatcherHost - : public base::RefCountedThreadSafe<IndexedDBDispatcherHost> { +class IndexedDBDispatcherHost : public BrowserMessageFilter { public: // Only call the constructor from the UI thread. - IndexedDBDispatcherHost(IPC::Message::Sender* sender, Profile* profile); + IndexedDBDispatcherHost(int process_id, Profile* profile); - // Only call from ResourceMessageFilter on the IO thread. - void Init(int process_id, base::ProcessHandle process_handle); - - // Only call from ResourceMessageFilter on the IO thread. Calls self on the - // WebKit thread in some cases. - void Shutdown(); - - // Only call from ResourceMessageFilter on the IO thread. - bool OnMessageReceived(const IPC::Message& message); - - // Send a message to the renderer process associated with our sender_ via the - // IO thread. May be called from any thread. - void Send(IPC::Message* message); + // BrowserMessageFilter implementation. + virtual void OnChannelClosing(); + virtual void OverrideThreadForMessage(const IPC::Message& message, + BrowserThread::ID* thread); + virtual bool OnMessageReceived(const IPC::Message& message, + bool* message_was_ok); // A shortcut for accessing our context. IndexedDBContext* Context() { @@ -67,24 +59,22 @@ class IndexedDBDispatcherHost int32 Add(WebKit::WebIDBTransaction* idb_transaction); private: - friend class base::RefCountedThreadSafe<IndexedDBDispatcherHost>; ~IndexedDBDispatcherHost(); // Message processing. Most of the work is delegated to the dispatcher hosts // below. - void OnMessageReceivedWebKit(const IPC::Message& message); - void OnIDBFactoryOpen(const ViewHostMsg_IDBFactoryOpen_Params& p); + void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); // Helper templates. template <class ReturnType> ReturnType* GetOrTerminateProcess( IDMap<ReturnType, IDMapOwnPointer>* map, int32 return_object_id, - IPC::Message* reply_msg, uint32 message_type); + uint32 message_type); template <typename ReplyType, typename MessageType, typename WebObjectType, typename Method> void SyncGetter(IDMap<WebObjectType, IDMapOwnPointer>* map, int32 object_id, - IPC::Message* reply_msg, Method method); + ReplyType* reply, Method method); template <typename ObjectType> void DestroyObject(IDMap<ObjectType, IDMapOwnPointer>* map, int32 object_id, @@ -98,24 +88,26 @@ class IndexedDBDispatcherHost bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); void Send(IPC::Message* message); - void OnName(int32 idb_database_id, IPC::Message* reply_msg); - void OnVersion(int32 idb_database_id, IPC::Message* reply_msg); - void OnObjectStoreNames(int32 idb_database_id, IPC::Message* reply_msg); + void OnName(int32 idb_database_id, string16* name); + void OnVersion(int32 idb_database_id, string16* version); + void OnObjectStoreNames(int32 idb_database_id, + std::vector<string16>* object_stores); void OnCreateObjectStore( - const ViewHostMsg_IDBDatabaseCreateObjectStore_Params& params, - IPC::Message* reply_msg); + const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params, + int32* object_store_id, WebKit::WebExceptionCode* ec); void OnDeleteObjectStore(int32 idb_database_id, const string16& name, int32 transaction_id, - IPC::Message* reply_msg); + WebKit::WebExceptionCode* ec); void OnSetVersion(int32 idb_database_id, int32 response_id, const string16& version, - IPC::Message* reply_msg); + WebKit::WebExceptionCode* ec); void OnTransaction(int32 idb_database_id, const std::vector<string16>& names, int32 mode, int32 timeout, - IPC::Message* reply_msg); + int32* idb_transaction_id, + WebKit::WebExceptionCode* ec); void OnDestroyed(int32 idb_database_id); IndexedDBDispatcherHost* parent_; @@ -130,25 +122,25 @@ class IndexedDBDispatcherHost bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); void Send(IPC::Message* message); - void OnName(int32 idb_index_id, IPC::Message* reply_msg); - void OnStoreName(int32 idb_index_id, IPC::Message* reply_msg); - void OnKeyPath(int32 idb_index_id, IPC::Message* reply_msg); - void OnUnique(int32 idb_index_id, IPC::Message* reply_msg); + void OnName(int32 idb_index_id, string16* name); + void OnStoreName(int32 idb_index_id, string16* store_name); + void OnKeyPath(int32 idb_index_id, NullableString16* key_path); + void OnUnique(int32 idb_index_id, bool* unique); void OnOpenObjectCursor( - const ViewHostMsg_IDBIndexOpenCursor_Params& params, - IPC::Message* reply_msg); - void OnOpenKeyCursor(const ViewHostMsg_IDBIndexOpenCursor_Params& params, - IPC::Message* reply_msg); + const IndexedDBHostMsg_IndexOpenCursor_Params& params, + WebKit::WebExceptionCode* ec); + void OnOpenKeyCursor(const IndexedDBHostMsg_IndexOpenCursor_Params& params, + WebKit::WebExceptionCode* ec); void OnGetObject(int idb_index_id, int32 response_id, const IndexedDBKey& key, int32 transaction_id, - IPC::Message* reply_msg); + WebKit::WebExceptionCode* ec); void OnGetKey(int idb_index_id, int32 response_id, const IndexedDBKey& key, int32 transaction_id, - IPC::Message* reply_msg); + WebKit::WebExceptionCode* ec); void OnDestroyed(int32 idb_index_id); IndexedDBDispatcherHost* parent_; @@ -163,34 +155,37 @@ class IndexedDBDispatcherHost bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); void Send(IPC::Message* message); - void OnName(int32 idb_object_store_id, IPC::Message* reply_msg); - void OnKeyPath(int32 idb_object_store_id, IPC::Message* reply_msg); - void OnIndexNames(int32 idb_object_store_id, IPC::Message* reply_msg); + void OnName(int32 idb_object_store_id, string16* name); + void OnKeyPath(int32 idb_object_store_id, NullableString16* keyPath); + void OnIndexNames(int32 idb_object_store_id, + std::vector<string16>* index_names); void OnGet(int idb_object_store_id, int32 response_id, const IndexedDBKey& key, int32 transaction_id, - IPC::Message* reply_msg); - void OnPut(const ViewHostMsg_IDBObjectStorePut_Params& params, - IPC::Message* reply_msg); + WebKit::WebExceptionCode* ec); + void OnPut(const IndexedDBHostMsg_ObjectStorePut_Params& params, + WebKit::WebExceptionCode* ec); void OnDelete(int idb_object_store_id, int32 response_id, const IndexedDBKey& key, int32 transaction_id, - IPC::Message* reply_msg); + WebKit::WebExceptionCode* ec); void OnCreateIndex( - const ViewHostMsg_IDBObjectStoreCreateIndex_Params& params, - IPC::Message* reply_msg); + const IndexedDBHostMsg_ObjectStoreCreateIndex_Params& params, + int32* index_id, + WebKit::WebExceptionCode* ec); void OnIndex(int32 idb_object_store_id, const string16& name, - IPC::Message* reply_msg); + int32* idb_index_id, + WebKit::WebExceptionCode* ec); void OnDeleteIndex(int32 idb_object_store_id, const string16& name, int32 transaction_id, - IPC::Message* reply_msg); + WebKit::WebExceptionCode* ec); void OnOpenCursor( - const ViewHostMsg_IDBObjectStoreOpenCursor_Params& params, - IPC::Message* reply_msg); + const IndexedDBHostMsg_ObjectStoreOpenCursor_Params& params, + WebKit::WebExceptionCode* ec); void OnDestroyed(int32 idb_object_store_id); IndexedDBDispatcherHost* parent_; @@ -205,20 +200,22 @@ class IndexedDBDispatcherHost bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); void Send(IPC::Message* message); - void OnDirection(int32 idb_object_store_id, IPC::Message* reply_msg); - void OnKey(int32 idb_object_store_id, IPC::Message* reply_msg); - void OnValue(int32 idb_object_store_id, IPC::Message* reply_msg); + void OnDirection(int32 idb_object_store_id, int32* direction); + void OnKey(int32 idb_object_store_id, IndexedDBKey* key); + void OnValue(int32 idb_object_store_id, + SerializedScriptValue* script_value, + IndexedDBKey* key); void OnUpdate(int32 idb_object_store_id, int32 response_id, const SerializedScriptValue& value, - IPC::Message* reply_msg); + WebKit::WebExceptionCode* ec); void OnContinue(int32 idb_object_store_id, int32 response_id, const IndexedDBKey& key, - IPC::Message* reply_msg); + WebKit::WebExceptionCode* ec); void OnDelete(int32 idb_object_store_id, int32 response_id, - IPC::Message* reply_msg); + WebKit::WebExceptionCode* ec); void OnDestroyed(int32 idb_cursor_id); IndexedDBDispatcherHost* parent_; @@ -235,10 +232,11 @@ 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 OnMode(int32 transaction_id, int* mode); void OnObjectStore(int32 transaction_id, const string16& name, - IPC::Message* reply_msg); + int32* object_store_id, + WebKit::WebExceptionCode* ec); void OnDidCompleteTaskEvents(int transaction_id); void OnDestroyed(int32 idb_transaction_id); @@ -247,9 +245,6 @@ class IndexedDBDispatcherHost MapType map_; }; - // Only use on the IO thread. - IPC::Message::Sender* sender_; - // Data shared between renderer processes with the same profile. scoped_refptr<WebKitContext> webkit_context_; @@ -263,10 +258,6 @@ class IndexedDBDispatcherHost scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; - // If we get a corrupt message from a renderer, we need to kill it using this - // handle. - base::ProcessHandle process_handle_; - // Used to dispatch messages to the correct view host. int process_id_; diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index f38401e..79cdfb3 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -40,6 +40,7 @@ #include "chrome/browser/gpu_process_host.h" #include "chrome/browser/history/history.h" #include "chrome/browser/in_process_webkit/dom_storage_message_filter.h" +#include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" #include "chrome/browser/io_thread.h" #include "chrome/browser/mime_registry_message_filter.h" #include "chrome/browser/platform_util.h" @@ -398,6 +399,7 @@ void BrowserRenderProcessHost::CreateMessageFilters() { channel_->AddFilter( new AppCacheDispatcherHost(profile()->GetRequestContext(), id())); channel_->AddFilter(new DOMStorageMessageFilter(id(), profile())); + channel_->AddFilter(new IndexedDBDispatcherHost(id(), profile())); channel_->AddFilter(new PepperFileMessageFilter(id(), profile())); channel_->AddFilter(new speech_input::SpeechInputDispatcherHost(id())); channel_->AddFilter( diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index ceda6a3..a3d66a3 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -25,7 +25,6 @@ #include "chrome/browser/geolocation/geolocation_permission_context.h" #include "chrome/browser/gpu_process_host.h" #include "chrome/browser/host_zoom_map.h" -#include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" #include "chrome/browser/metrics/histogram_synchronizer.h" #include "chrome/browser/nacl_host/nacl_process_host.h" #include "chrome/browser/net/chrome_url_request_context.h" @@ -246,8 +245,6 @@ ResourceMessageFilter::ResourceMessageFilter( media_request_context_(profile->GetRequestContextForMedia()), extensions_request_context_(profile->GetRequestContextForExtensions()), render_widget_helper_(render_widget_helper), - ALLOW_THIS_IN_INITIALIZER_LIST(indexed_db_dispatcher_host_( - new IndexedDBDispatcherHost(this, profile))), notification_prefs_( profile->GetDesktopNotificationService()->prefs_cache()), host_zoom_map_(profile->GetHostZoomMap()), @@ -275,9 +272,6 @@ ResourceMessageFilter::~ResourceMessageFilter() { // This function should be called on the IO thread. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - // Tell the Indexed DB dispatcher host to stop sending messages via us. - indexed_db_dispatcher_host_->Shutdown(); - // Let interested observers know we are being deleted. NotificationService::current()->Notify( NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN, @@ -305,7 +299,6 @@ void ResourceMessageFilter::OnChannelConnected(int32 peer_pid) { set_handle(peer_handle); WorkerService::GetInstance()->Initialize(resource_dispatcher_host_); - indexed_db_dispatcher_host_->Init(id(), handle()); } void ResourceMessageFilter::OnChannelError() { @@ -330,10 +323,9 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) { bool msg_is_ok = true; bool handled = resource_dispatcher_host_->OnMessageReceived(msg, this, &msg_is_ok) || - indexed_db_dispatcher_host_->OnMessageReceived(msg) || mp_dispatcher->OnMessageReceived( msg, this, next_route_id_callback(), &msg_is_ok) || - geolocation_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) ; + geolocation_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok); if (!handled) { DCHECK(msg_is_ok); // It should have been marked handled if it wasn't OK. diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index 2b7a214..1981f49 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -36,7 +36,6 @@ class ChromeURLRequestContext; struct FontDescriptor; class GeolocationDispatcherHostOld; class HostZoomMap; -class IndexedDBDispatcherHost; class NotificationsPrefsCache; class PpapiPluginProcessHost; class Profile; @@ -430,9 +429,6 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, scoped_refptr<RenderWidgetHelper> render_widget_helper_; - // Handles Indexed Database related messages. - scoped_refptr<IndexedDBDispatcherHost> indexed_db_dispatcher_host_; - // A cache of notifications preferences which is used to handle // Desktop Notifications permission messages. scoped_refptr<NotificationsPrefsCache> notification_prefs_; diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 1118732..3dd3e61 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -85,6 +85,8 @@ 'common/gpu_video_common.h', 'common/indexed_db_key.cc', 'common/indexed_db_key.h', + 'common/indexed_db_messages.cc', + 'common/indexed_db_messages.h', 'common/indexed_db_param_traits.cc', 'common/indexed_db_param_traits.h', 'common/logging_chrome.cc', diff --git a/chrome/common/indexed_db_messages.cc b/chrome/common/indexed_db_messages.cc new file mode 100644 index 0000000..c7c0e22 --- /dev/null +++ b/chrome/common/indexed_db_messages.cc @@ -0,0 +1,339 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/common_param_traits.h" + +#define IPC_MESSAGE_IMPL +#include "chrome/common/indexed_db_messages.h" + +IndexedDBHostMsg_FactoryOpen_Params::IndexedDBHostMsg_FactoryOpen_Params() + : routing_id(0), + response_id(0), + maximum_size(0) { +} + +IndexedDBHostMsg_FactoryOpen_Params::~IndexedDBHostMsg_FactoryOpen_Params() { +} + +IndexedDBHostMsg_DatabaseCreateObjectStore_Params:: + IndexedDBHostMsg_DatabaseCreateObjectStore_Params() + : auto_increment(false), + transaction_id(0), + idb_database_id(0) { +} + +IndexedDBHostMsg_DatabaseCreateObjectStore_Params:: + ~IndexedDBHostMsg_DatabaseCreateObjectStore_Params() { +} + +IndexedDBHostMsg_IndexOpenCursor_Params:: + IndexedDBHostMsg_IndexOpenCursor_Params() + : response_id(0), + lower_open(false), + upper_open(false), + direction(0), + idb_index_id(0), + transaction_id(0) { +} + +IndexedDBHostMsg_IndexOpenCursor_Params:: + ~IndexedDBHostMsg_IndexOpenCursor_Params() { +} + + +IndexedDBHostMsg_ObjectStorePut_Params:: + IndexedDBHostMsg_ObjectStorePut_Params() + : idb_object_store_id(0), + response_id(0), + add_only(false), + transaction_id(0) { +} + +IndexedDBHostMsg_ObjectStorePut_Params:: +~IndexedDBHostMsg_ObjectStorePut_Params() { +} + +IndexedDBHostMsg_ObjectStoreCreateIndex_Params:: + IndexedDBHostMsg_ObjectStoreCreateIndex_Params() + : unique(false), + transaction_id(0), + idb_object_store_id(0) { +} + +IndexedDBHostMsg_ObjectStoreCreateIndex_Params:: + ~IndexedDBHostMsg_ObjectStoreCreateIndex_Params() { +} + + +IndexedDBHostMsg_ObjectStoreOpenCursor_Params:: + IndexedDBHostMsg_ObjectStoreOpenCursor_Params() + : response_id(0), + lower_open(false), + upper_open(false), + direction(0), + idb_object_store_id(0), + transaction_id(0) { +} + +IndexedDBHostMsg_ObjectStoreOpenCursor_Params:: + ~IndexedDBHostMsg_ObjectStoreOpenCursor_Params() { +} + +namespace IPC { + +void ParamTraits<IndexedDBHostMsg_FactoryOpen_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.routing_id); + WriteParam(m, p.response_id); + WriteParam(m, p.origin); + WriteParam(m, p.name); + WriteParam(m, p.maximum_size); +} + +bool ParamTraits<IndexedDBHostMsg_FactoryOpen_Params>::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->routing_id) && + ReadParam(m, iter, &p->response_id) && + ReadParam(m, iter, &p->origin) && + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->maximum_size); +} + +void ParamTraits<IndexedDBHostMsg_FactoryOpen_Params>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.routing_id, l); + l->append(", "); + LogParam(p.response_id, l); + l->append(", "); + LogParam(p.origin, l); + l->append(", "); + LogParam(p.name, l); + l->append(", "); + LogParam(p.maximum_size, l); + l->append(")"); +} + +void ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.key_path); + WriteParam(m, p.auto_increment); + WriteParam(m, p.transaction_id); + WriteParam(m, p.idb_database_id); +} + +bool ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->key_path) && + ReadParam(m, iter, &p->auto_increment) && + ReadParam(m, iter, &p->transaction_id) && + ReadParam(m, iter, &p->idb_database_id); +} + +void ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.name, l); + l->append(", "); + LogParam(p.key_path, l); + l->append(", "); + LogParam(p.auto_increment, l); + l->append(", "); + LogParam(p.transaction_id, l); + l->append(", "); + LogParam(p.idb_database_id, l); + l->append(")"); +} + +void ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.response_id); + WriteParam(m, p.lower_key); + WriteParam(m, p.upper_key); + WriteParam(m, p.lower_open); + WriteParam(m, p.upper_open); + WriteParam(m, p.direction); + WriteParam(m, p.idb_index_id); + WriteParam(m, p.transaction_id); +} + +bool ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->response_id) && + ReadParam(m, iter, &p->lower_key) && + ReadParam(m, iter, &p->upper_key) && + ReadParam(m, iter, &p->lower_open) && + ReadParam(m, iter, &p->upper_open) && + ReadParam(m, iter, &p->direction) && + ReadParam(m, iter, &p->idb_index_id) && + ReadParam(m, iter, &p->transaction_id); +} + +void ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.response_id, l); + l->append(", "); + LogParam(p.lower_key, l); + l->append(", "); + LogParam(p.upper_key, l); + l->append(", "); + LogParam(p.lower_open, l); + l->append(", "); + LogParam(p.upper_open, l); + l->append(", "); + LogParam(p.direction, l); + l->append(", "); + LogParam(p.idb_index_id, l); + l->append(","); + LogParam(p.transaction_id, l); + l->append(")"); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.idb_object_store_id); + WriteParam(m, p.response_id); + WriteParam(m, p.serialized_value); + WriteParam(m, p.key); + WriteParam(m, p.add_only); + WriteParam(m, p.transaction_id); +} + +bool ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->idb_object_store_id) && + ReadParam(m, iter, &p->response_id) && + ReadParam(m, iter, &p->serialized_value) && + ReadParam(m, iter, &p->key) && + ReadParam(m, iter, &p->add_only) && + ReadParam(m, iter, &p->transaction_id); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.idb_object_store_id, l); + l->append(", "); + LogParam(p.response_id, l); + l->append(", "); + LogParam(p.serialized_value, l); + l->append(", "); + LogParam(p.key, l); + l->append(", "); + LogParam(p.add_only, l); + l->append(", "); + LogParam(p.transaction_id, l); + l->append(")"); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.key_path); + WriteParam(m, p.unique); + WriteParam(m, p.transaction_id); + WriteParam(m, p.idb_object_store_id); +} + +bool ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->key_path) && + ReadParam(m, iter, &p->unique) && + ReadParam(m, iter, &p->transaction_id) && + ReadParam(m, iter, &p->idb_object_store_id); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.name, l); + l->append(", "); + LogParam(p.key_path, l); + l->append(", "); + LogParam(p.unique, l); + l->append(", "); + LogParam(p.transaction_id, l); + l->append(", "); + LogParam(p.idb_object_store_id, l); + l->append(")"); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.response_id); + WriteParam(m, p.lower_key); + WriteParam(m, p.upper_key); + WriteParam(m, p.lower_open); + WriteParam(m, p.upper_open); + WriteParam(m, p.direction); + WriteParam(m, p.idb_object_store_id); + WriteParam(m, p.transaction_id); +} + +bool ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->response_id) && + ReadParam(m, iter, &p->lower_key) && + ReadParam(m, iter, &p->upper_key) && + ReadParam(m, iter, &p->lower_open) && + ReadParam(m, iter, &p->upper_open) && + ReadParam(m, iter, &p->direction) && + ReadParam(m, iter, &p->idb_object_store_id) && + ReadParam(m, iter, &p->transaction_id); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.response_id, l); + l->append(", "); + LogParam(p.lower_key, l); + l->append(", "); + LogParam(p.upper_key, l); + l->append(", "); + LogParam(p.lower_open, l); + l->append(", "); + LogParam(p.upper_open, l); + l->append(", "); + LogParam(p.direction, l); + l->append(", "); + LogParam(p.idb_object_store_id, l); + l->append(","); + LogParam(p.transaction_id, l); + l->append(")"); +} + +} // namespace IPC diff --git a/chrome/common/indexed_db_messages.h b/chrome/common/indexed_db_messages.h new file mode 100644 index 0000000..8eb77eb --- /dev/null +++ b/chrome/common/indexed_db_messages.h @@ -0,0 +1,493 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_INDEXED_DB_MESSAGES_H_ +#define CHROME_COMMON_INDEXED_DB_MESSAGES_H_ +#pragma once + +#include "chrome/common/indexed_db_key.h" +#include "chrome/common/indexed_db_param_traits.h" +#include "chrome/common/serialized_script_value.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "third_party/WebKit/WebKit/chromium/public/WebExceptionCode.h" + +#define IPC_MESSAGE_START IndexedDBMsgStart + +// Used to open an indexed database. +struct IndexedDBHostMsg_FactoryOpen_Params { + IndexedDBHostMsg_FactoryOpen_Params(); + ~IndexedDBHostMsg_FactoryOpen_Params(); + + // The routing ID of the view initiating the open. + int32 routing_id; + + // The response should have this id. + int32 response_id; + + // The origin doing the initiating. + string16 origin; + + // The name of the database. + string16 name; + + // The maximum size of the database. + uint64 maximum_size; +}; + +// Used to create an object store. +struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params { + IndexedDBHostMsg_DatabaseCreateObjectStore_Params(); + ~IndexedDBHostMsg_DatabaseCreateObjectStore_Params(); + + // The name of the object store. + string16 name; + + // The keyPath of the object store. + NullableString16 key_path; + + // Whether the object store created should have a key generator. + bool auto_increment; + + // The transaction this is associated with. + int32 transaction_id; + + // The database the object store belongs to. + int32 idb_database_id; +}; + +// Used to open both cursors and object cursors in IndexedDB. +struct IndexedDBHostMsg_IndexOpenCursor_Params { + IndexedDBHostMsg_IndexOpenCursor_Params(); + ~IndexedDBHostMsg_IndexOpenCursor_Params(); + + // The response should have this id. + int32 response_id; + + // The serialized lower key. + IndexedDBKey lower_key; + + // The serialized upper key. + IndexedDBKey upper_key; + + // Is the lower bound open? + bool lower_open; + + // Is the upper bound open? + bool upper_open; + + // The direction of this cursor. + int32 direction; + + // The index the index belongs to. + int32 idb_index_id; + + // The transaction this request belongs to. + int transaction_id; +}; + +// Used to set a value in an object store. +struct IndexedDBHostMsg_ObjectStorePut_Params { + IndexedDBHostMsg_ObjectStorePut_Params(); + ~IndexedDBHostMsg_ObjectStorePut_Params(); + + // The object store's id. + int32 idb_object_store_id; + + // The id any response should contain. + int32 response_id; + + // The value to set. + SerializedScriptValue serialized_value; + + // The key to set it on (may not be "valid"/set in some cases). + IndexedDBKey key; + + // If it already exists, don't update (just return an error). + bool add_only; + + // The transaction it's associated with. + int transaction_id; +}; + +// Used to create an index. +struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params { + IndexedDBHostMsg_ObjectStoreCreateIndex_Params(); + ~IndexedDBHostMsg_ObjectStoreCreateIndex_Params(); + + // The name of the index. + string16 name; + + // The keyPath of the index. + NullableString16 key_path; + + // Whether the index created has unique keys. + bool unique; + + // The transaction this is associated with. + int32 transaction_id; + + // The object store the index belongs to. + int32 idb_object_store_id; +}; + +// Used to open an IndexedDB cursor. +struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params { + IndexedDBHostMsg_ObjectStoreOpenCursor_Params(); + ~IndexedDBHostMsg_ObjectStoreOpenCursor_Params(); + + // The response should have this id. + int32 response_id; + + // The serialized lower key. + IndexedDBKey lower_key; + + // The serialized upper key. + IndexedDBKey upper_key; + + // Is the lower bound open? + bool lower_open; + + // Is the upper bound open? + bool upper_open; + + // The direction of this cursor. + int32 direction; + + // The object store the cursor belongs to. + int32 idb_object_store_id; + + // The transaction this request belongs to. + int transaction_id; +}; + +namespace IPC { +template <> +struct ParamTraits<IndexedDBHostMsg_FactoryOpen_Params> { + typedef IndexedDBHostMsg_FactoryOpen_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params> { + typedef IndexedDBHostMsg_DatabaseCreateObjectStore_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params> { + typedef IndexedDBHostMsg_IndexOpenCursor_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params> { + typedef IndexedDBHostMsg_ObjectStorePut_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params> { + typedef IndexedDBHostMsg_ObjectStoreCreateIndex_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params> { + typedef IndexedDBHostMsg_ObjectStoreOpenCursor_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +} // namespace IPC + +// Indexed DB messages sent from the browser to the renderer. + +// IDBCallback message handlers. +IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessNull, + int32 /* response_id */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBCursor, + int32 /* response_id */, + int32 /* cursor_id */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBDatabase, + int32 /* response_id */, + int32 /* idb_database_id */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIndexedDBKey, + int32 /* response_id */, + IndexedDBKey /* indexed_db_key */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBIndex, + int32 /* response_id */, + int32 /* idb_index_id */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBObjectStore, + int32 /* response_id */, + int32 /* idb_object_store_id */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBTransaction, + int32 /* response_id */, + int32 /* idb_transaction_id */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, + int32 /* response_id */, + SerializedScriptValue /* serialized_script_value */) +IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksError, + int32 /* response_id */, + int /* code */, + string16 /* message */) + +// IDBTransactionCallback message handlers. +IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksAbort, + int32 /* transaction_id */) +IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksComplete, + int32 /* transaction_id */) +IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksTimeout, + int32 /* transaction_id */) + + +// Indexed DB messages sent from the renderer to the browser. + +// WebIDBCursor::direction() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorDirection, + int32, /* idb_cursor_id */ + int32 /* direction */) + +// WebIDBCursor::key() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorKey, + int32, /* idb_cursor_id */ + IndexedDBKey /* key */) + +// WebIDBCursor::value() message. +IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_CursorValue, + int32, /* idb_cursor_id */ + SerializedScriptValue, /* script_value */ + IndexedDBKey /* key */) + +// WebIDBCursor::update() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorUpdate, + int32, /* idb_cursor_id */ + int32, /* response_id */ + SerializedScriptValue, /* value */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBCursor::continue() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorContinue, + int32, /* idb_cursor_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBCursor::remove() message. +IPC_SYNC_MESSAGE_CONTROL2_1(IndexedDBHostMsg_CursorDelete, + int32, /* idb_cursor_id */ + int32, /* response_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBFactory::open() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_FactoryOpen, + IndexedDBHostMsg_FactoryOpen_Params) + +// WebIDBDatabase::name() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseName, + int32, /* idb_database_id */ + string16 /* name */) + +// WebIDBDatabase::version() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseVersion, + int32, /* idb_database_id */ + string16 /* version */) + +// WebIDBDatabase::objectStoreNames() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseObjectStoreNames, + int32, /* idb_database_id */ + std::vector<string16> /* objectStoreNames */) + +// WebIDBDatabase::createObjectStore() message. +IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_DatabaseCreateObjectStore, + IndexedDBHostMsg_DatabaseCreateObjectStore_Params, + int32, /* object_store_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBDatabase::removeObjectStore() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseDeleteObjectStore, + int32, /* idb_database_id */ + string16, /* name */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBDatabase::setVersion() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseSetVersion, + 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_2(IndexedDBHostMsg_DatabaseTransaction, + int32, /* idb_database_id */ + std::vector<string16>, /* object_stores */ + int32, /* mode */ + int32, /* timeout */ + int32, /* idb_transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBDatabase::~WebIDBDatabase() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseDestroyed, + int32 /* idb_database_id */) + +// WebIDBIndex::name() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexName, + int32, /* idb_index_id */ + string16 /* name */) + +// WebIDBIndex::storeName() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexStoreName, + int32, /* idb_index_id */ + string16 /* store_name */) + +// WebIDBIndex::keyPath() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexKeyPath, + int32, /* idb_index_id */ + NullableString16 /* key_path */) + +// WebIDBIndex::unique() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexUnique, + int32, /* idb_unique_id */ + bool /* unique */) + +// WebIDBIndex::openObjectCursor() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexOpenObjectCursor, + IndexedDBHostMsg_IndexOpenCursor_Params, + WebKit::WebExceptionCode /* ec */) + +// WebIDBIndex::openKeyCursor() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexOpenKeyCursor, + IndexedDBHostMsg_IndexOpenCursor_Params, + WebKit::WebExceptionCode /* ec */) + +// WebIDBIndex::getObject() message. +IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_IndexGetObject, + int32, /* idb_index_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBIndex::getKey() message. +IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_IndexGetKey, + int32, /* idb_index_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBIndex::~WebIDBIndex() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_IndexDestroyed, + int32 /* idb_index_id */) + +// WebIDBObjectStore::name() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreName, + int32, /* idb_object_store_id */ + string16 /* name */) + +// WebIDBObjectStore::keyPath() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreKeyPath, + int32, /* idb_object_store_id */ + NullableString16 /* keyPath */) + +// WebIDBObjectStore::indexNames() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreIndexNames, + int32, /* idb_object_store_id */ + std::vector<string16> /* index_names */) + +// WebIDBObjectStore::get() message. +IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreGet, + int32, /* idb_object_store_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::put() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStorePut, + IndexedDBHostMsg_ObjectStorePut_Params, + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::delete() message. +IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreDelete, + int32, /* idb_object_store_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::createIndex() message. +IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_ObjectStoreCreateIndex, + IndexedDBHostMsg_ObjectStoreCreateIndex_Params, + int32, /* index_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::index() message. +IPC_SYNC_MESSAGE_CONTROL2_2(IndexedDBHostMsg_ObjectStoreIndex, + int32, /* idb_object_store_id */ + string16, /* name */ + int32, /* idb_index_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::deleteIndex() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_ObjectStoreDeleteIndex, + int32, /* idb_object_store_id */ + string16, /* name */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::openCursor() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreOpenCursor, + IndexedDBHostMsg_ObjectStoreOpenCursor_Params, + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::~WebIDBObjectStore() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_ObjectStoreDestroyed, + int32 /* idb_object_store_id */) + +// WebIDBDatabase::~WebIDBCursor() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_CursorDestroyed, + int32 /* idb_cursor_id */) + +// IDBTransaction::ObjectStore message. +IPC_SYNC_MESSAGE_CONTROL2_2(IndexedDBHostMsg_TransactionObjectStore, + int32, /* transaction_id */ + string16, /* name */ + int32, /* object_store_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBTransaction::mode() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_TransactionMode, + int32, /* idb_transaction_id */ + int /* mode */) + +// WebIDBTransaction::abort() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionAbort, + int32 /* idb_transaction_id */) + +// IDBTransaction::DidCompleteTaskEvents() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDidCompleteTaskEvents, + int32 /* idb_transaction_id */) + +// WebIDBTransaction::~WebIDBTransaction() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDestroyed, + int32 /* idb_transaction_id */) + +#endif // CHROME_COMMON_INDEXED_DB_MESSAGES_H_ diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index 04472bf..ed0fa20 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -7,11 +7,8 @@ #include "chrome/common/extensions/extension_extent.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/gpu_param_traits.h" -#include "chrome/common/indexed_db_key.h" -#include "chrome/common/indexed_db_param_traits.h" #include "chrome/common/render_messages_params.h" #include "chrome/common/resource_response.h" -#include "chrome/common/serialized_script_value.h" #include "chrome/common/speech_input_result.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/web_apps.h" diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index b7de06d..e5d0e2a 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -17,7 +17,6 @@ #include "base/string16.h" #include "chrome/common/common_param_traits.h" #include "chrome/common/css_colors.h" -#include "chrome/common/indexed_db_param_traits.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" @@ -101,12 +100,6 @@ struct ViewHostMsg_DidPrintPage_Params; struct ViewHostMsg_Audio_CreateStream_Params; struct ViewHostMsg_ShowPopup_Params; struct ViewHostMsg_ScriptedPrint_Params; -struct ViewHostMsg_IDBFactoryOpen_Params; -struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params; -struct ViewHostMsg_IDBIndexOpenCursor_Params; -struct ViewHostMsg_IDBObjectStoreCreateIndex_Params; -struct ViewHostMsg_IDBObjectStoreOpenCursor_Params; -struct ViewHostMsg_IDBObjectStorePut_Params; struct ViewMsg_ExecuteCode_Params; struct ViewHostMsg_CreateWorker_Params; struct ViewHostMsg_ShowNotification_Params; diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index c981923..304dcae 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -23,7 +23,6 @@ #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" #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" @@ -51,7 +50,6 @@ typedef std::map<std::string, std::string> SubstitutionMap; class Value; class GPUInfo; -class SerializedScriptValue; class SkBitmap; struct ThumbnailScore; class WebCursor; @@ -902,43 +900,6 @@ IPC_MESSAGE_ROUTED1(ViewMsg_NotifyRenderViewType, IPC_MESSAGE_ROUTED1(ViewMsg_ExecuteCode, ViewMsg_ExecuteCode_Params) -// IDBCallback message handlers. -IPC_MESSAGE_CONTROL1(ViewMsg_IDBCallbacksSuccessNull, - int32 /* response_id */) -IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIDBCursor, - int32 /* response_id */, - int32 /* cursor_id */) -IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIDBDatabase, - int32 /* response_id */, - int32 /* idb_database_id */) -IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIndexedDBKey, - int32 /* response_id */, - IndexedDBKey /* indexed_db_key */) -IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIDBIndex, - int32 /* response_id */, - int32 /* idb_index_id */) -IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIDBObjectStore, - int32 /* response_id */, - int32 /* idb_object_store_id */) -IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIDBTransaction, - int32 /* response_id */, - int32 /* idb_transaction_id */) -IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessSerializedScriptValue, - int32 /* response_id */, - SerializedScriptValue /* serialized_script_value */) -IPC_MESSAGE_CONTROL3(ViewMsg_IDBCallbacksError, - int32 /* response_id */, - int /* code */, - string16 /* message */) - -// IDBTransactionCallback message handlers. -IPC_MESSAGE_CONTROL1(ViewMsg_IDBTransactionCallbacksAbort, - int32 /* transaction_id */) -IPC_MESSAGE_CONTROL1(ViewMsg_IDBTransactionCallbacksComplete, - int32 /* transaction_id */) -IPC_MESSAGE_CONTROL1(ViewMsg_IDBTransactionCallbacksTimeout, - int32 /* transaction_id */) - #if defined(IPC_MESSAGE_LOG_ENABLED) // Tell the renderer process to begin or end IPC message logging. IPC_MESSAGE_CONTROL1(ViewMsg_SetIPCLoggingEnabled, @@ -2353,241 +2314,6 @@ IPC_MESSAGE_CONTROL3(ViewHostMsg_DidGenerateCacheableMetadata, double /* expected_response_time */, std::vector<char> /* data */) -// WebIDBCursor::direction() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBCursorDirection, - int32, /* idb_cursor_id */ - int32 /* direction */) - -// WebIDBCursor::key() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBCursorKey, - int32, /* idb_cursor_id */ - IndexedDBKey) - -// WebIDBCursor::value() message. -IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_IDBCursorValue, - int32, /* idb_cursor_id */ - SerializedScriptValue, /* script_value */ - IndexedDBKey /* key */) - -// WebIDBCursor::update() message. -IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBCursorUpdate, - int32, /* idb_cursor_id */ - int32, /* response_id */ - SerializedScriptValue, /* value */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBCursor::continue() message. -IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBCursorContinue, - int32, /* idb_cursor_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBCursor::remove() message. -IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_IDBCursorDelete, - int32, /* idb_cursor_id */ - int32, /* response_id */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBFactory::open() message. -IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBFactoryOpen, - ViewHostMsg_IDBFactoryOpen_Params) - -// WebIDBDatabase::name() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBDatabaseName, - int32, /* idb_database_id */ - string16 /* name */) - -// WebIDBDatabase::version() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBDatabaseVersion, - int32, /* idb_database_id */ - string16 /* vesion */) - -// WebIDBDatabase::objectStoreNames() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBDatabaseObjectStoreNames, - int32, /* idb_database_id */ - std::vector<string16> /* objectStoreNames */) - -// WebIDBDatabase::createObjectStore() message. -IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_IDBDatabaseCreateObjectStore, - ViewHostMsg_IDBDatabaseCreateObjectStore_Params, - int32, /* object_store_id */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBDatabase::removeObjectStore() message. -IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBDatabaseDeleteObjectStore, - int32, /* idb_database_id */ - string16, /* name */ - int32, /* transaction_id */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBDatabase::setVersion() message. -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_2(ViewHostMsg_IDBDatabaseTransaction, - int32, /* idb_database_id */ - std::vector<string16>, /* object_stores */ - int32, /* mode */ - int32, /* timeout */ - int32, /* idb_transaction_id */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBDatabase::~WebIDBDatabase() message. -IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBDatabaseDestroyed, - int32 /* idb_database_id */) - -// WebIDBIndex::name() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexName, - int32, /* idb_index_id */ - string16 /* name */) - -// WebIDBIndex::storeName() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexStoreName, - int32, /* idb_index_id */ - string16 /* store_name */) - -// WebIDBIndex::keyPath() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexKeyPath, - int32, /* idb_index_id */ - NullableString16 /* key_path */) - -// WebIDBIndex::unique() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexUnique, - int32, /* idb_unique_id */ - bool /* unique */) - -// WebIDBIndex::openObjectCursor() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexOpenObjectCursor, - ViewHostMsg_IDBIndexOpenCursor_Params, - WebKit::WebExceptionCode /* ec */) - -// WebIDBIndex::openKeyCursor() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexOpenKeyCursor, - ViewHostMsg_IDBIndexOpenCursor_Params, - WebKit::WebExceptionCode /* ec */) - -// WebIDBIndex::getObject() message. -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_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, - int32 /* idb_index_id */) - -// WebIDBObjectStore::name() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStoreName, - int32, /* idb_object_store_id */ - string16 /* name */) - -// WebIDBObjectStore::keyPath() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStoreKeyPath, - int32, /* idb_object_store_id */ - NullableString16 /* keyPath */) - -// WebIDBObjectStore::indexNames() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStoreIndexNames, - int32, /* idb_object_store_id */ - std::vector<string16> /* index_names */) - -// WebIDBObjectStore::get() message. -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_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStorePut, - ViewHostMsg_IDBObjectStorePut_Params, - WebKit::WebExceptionCode /* ec */) - -// WebIDBObjectStore::delete() message. -IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_IDBObjectStoreDelete, - int32, /* idb_object_store_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - int32, /* transaction_id */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBObjectStore::createIndex() message. -IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_IDBObjectStoreCreateIndex, - ViewHostMsg_IDBObjectStoreCreateIndex_Params, - int32, /* index_id */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBObjectStore::index() message. -IPC_SYNC_MESSAGE_CONTROL2_2(ViewHostMsg_IDBObjectStoreIndex, - int32, /* idb_object_store_id */ - string16, /* name */ - int32, /* idb_index_id */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBObjectStore::deleteIndex() message. -IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBObjectStoreDeleteIndex, - int32, /* idb_object_store_id */ - string16, /* name */ - int32, /* transaction_id */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBObjectStore::openCursor() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStoreOpenCursor, - ViewHostMsg_IDBObjectStoreOpenCursor_Params, - WebKit::WebExceptionCode /* ec */) - -// WebIDBObjectStore::~WebIDBObjectStore() message. -IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBObjectStoreDestroyed, - int32 /* idb_object_store_id */) - -// WebIDBDatabase::~WebIDBCursor() message. -IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBCursorDestroyed, - int32 /* idb_cursor_id */) - -// IDBTransaction::ObjectStore message. -IPC_SYNC_MESSAGE_CONTROL2_2(ViewHostMsg_IDBTransactionObjectStore, - int32, /* transaction_id */ - string16, /* name */ - int32, /* object_store_id */ - WebKit::WebExceptionCode /* ec */) - -// WebIDBTransaction::mode() message. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBTransactionMode, - int32, /* idb_transaction_id */ - int /* mode */) - -// WebIDBTransaction::abort() message. -IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBTransactionAbort, - int32 /* idb_transaction_id */) - -// IDBTransaction::DidCompleteTaskEvents() message. -IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBTransactionDidCompleteTaskEvents, - int32 /* idb_transaction_id */) - -// WebIDBTransaction::~WebIDBTransaction() message. -IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBTransactionDestroyed, - int32 /* idb_transaction_id */) - // Opens a file asynchronously. The response returns a file descriptor // and an error code from base/platform_file.h. IPC_MESSAGE_ROUTED3(ViewHostMsg_AsyncOpenFile, diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc index 01d3d58..618ca8e 100644 --- a/chrome/common/render_messages_params.cc +++ b/chrome/common/render_messages_params.cc @@ -6,7 +6,6 @@ #include "chrome/common/navigation_gesture.h" #include "chrome/common/common_param_traits.h" -#include "chrome/common/indexed_db_param_traits.h" #include "chrome/common/render_messages.h" #include "net/base/upload_data.h" @@ -166,76 +165,6 @@ ViewHostMsg_ScriptedPrint_Params::ViewHostMsg_ScriptedPrint_Params() ViewHostMsg_ScriptedPrint_Params::~ViewHostMsg_ScriptedPrint_Params() { } -ViewHostMsg_IDBFactoryOpen_Params::ViewHostMsg_IDBFactoryOpen_Params() - : routing_id_(0), - response_id_(0), - maximum_size_(0) { -} - -ViewHostMsg_IDBFactoryOpen_Params::~ViewHostMsg_IDBFactoryOpen_Params() { -} - -ViewHostMsg_IDBDatabaseCreateObjectStore_Params:: - ViewHostMsg_IDBDatabaseCreateObjectStore_Params() - : auto_increment_(false), - transaction_id_(0), - idb_database_id_(0) { -} - -ViewHostMsg_IDBDatabaseCreateObjectStore_Params:: - ~ViewHostMsg_IDBDatabaseCreateObjectStore_Params() { -} - -ViewHostMsg_IDBIndexOpenCursor_Params::ViewHostMsg_IDBIndexOpenCursor_Params() - : response_id_(0), - lower_open_(false), - upper_open_(false), - direction_(0), - idb_index_id_(0), - transaction_id_(0) { -} - -ViewHostMsg_IDBIndexOpenCursor_Params:: - ~ViewHostMsg_IDBIndexOpenCursor_Params() { -} - - -ViewHostMsg_IDBObjectStorePut_Params::ViewHostMsg_IDBObjectStorePut_Params() - : idb_object_store_id_(0), - response_id_(0), - add_only_(false), - transaction_id_(0) { -} - -ViewHostMsg_IDBObjectStorePut_Params::~ViewHostMsg_IDBObjectStorePut_Params() { -} - -ViewHostMsg_IDBObjectStoreCreateIndex_Params:: -ViewHostMsg_IDBObjectStoreCreateIndex_Params() - : unique_(false), - transaction_id_(0), - idb_object_store_id_(0) { -} - -ViewHostMsg_IDBObjectStoreCreateIndex_Params:: -~ViewHostMsg_IDBObjectStoreCreateIndex_Params() { -} - - -ViewHostMsg_IDBObjectStoreOpenCursor_Params:: - ViewHostMsg_IDBObjectStoreOpenCursor_Params() - : response_id_(0), - lower_open_(false), - upper_open_(false), - direction_(0), - idb_object_store_id_(0), - transaction_id_(0) { -} - -ViewHostMsg_IDBObjectStoreOpenCursor_Params:: - ~ViewHostMsg_IDBObjectStoreOpenCursor_Params() { -} - ViewMsg_ExecuteCode_Params::ViewMsg_ExecuteCode_Params() { } @@ -1211,260 +1140,6 @@ void ParamTraits<ViewHostMsg_ScriptedPrint_Params>::Log(const param_type& p, l->append(")"); } -void ParamTraits<ViewHostMsg_IDBFactoryOpen_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.routing_id_); - WriteParam(m, p.response_id_); - WriteParam(m, p.origin_); - WriteParam(m, p.name_); - WriteParam(m, p.maximum_size_); -} - -bool ParamTraits<ViewHostMsg_IDBFactoryOpen_Params>::Read(const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->routing_id_) && - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->origin_) && - ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->maximum_size_); -} - -void ParamTraits<ViewHostMsg_IDBFactoryOpen_Params>::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.routing_id_, l); - l->append(", "); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.origin_, l); - l->append(", "); - LogParam(p.name_, l); - l->append(", "); - LogParam(p.maximum_size_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.name_); - WriteParam(m, p.key_path_); - WriteParam(m, p.auto_increment_); - WriteParam(m, p.transaction_id_); - WriteParam(m, p.idb_database_id_); -} - -bool ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->key_path_) && - ReadParam(m, iter, &p->auto_increment_) && - ReadParam(m, iter, &p->transaction_id_) && - ReadParam(m, iter, &p->idb_database_id_); -} - -void ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.name_, l); - l->append(", "); - LogParam(p.key_path_, l); - l->append(", "); - LogParam(p.auto_increment_, l); - l->append(", "); - LogParam(p.transaction_id_, l); - l->append(", "); - LogParam(p.idb_database_id_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.response_id_); - WriteParam(m, p.lower_key_); - WriteParam(m, p.upper_key_); - WriteParam(m, p.lower_open_); - WriteParam(m, p.upper_open_); - WriteParam(m, p.direction_); - WriteParam(m, p.idb_index_id_); - WriteParam(m, p.transaction_id_); -} - -bool ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->lower_key_) && - ReadParam(m, iter, &p->upper_key_) && - ReadParam(m, iter, &p->lower_open_) && - ReadParam(m, iter, &p->upper_open_) && - ReadParam(m, iter, &p->direction_) && - ReadParam(m, iter, &p->idb_index_id_) && - ReadParam(m, iter, &p->transaction_id_); -} - -void ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.lower_key_, l); - l->append(", "); - LogParam(p.upper_key_, l); - l->append(", "); - LogParam(p.lower_open_, l); - l->append(", "); - LogParam(p.upper_open_, l); - l->append(", "); - LogParam(p.direction_, l); - l->append(", "); - LogParam(p.idb_index_id_, l); - l->append(","); - LogParam(p.transaction_id_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBObjectStorePut_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.idb_object_store_id_); - WriteParam(m, p.response_id_); - WriteParam(m, p.serialized_value_); - WriteParam(m, p.key_); - WriteParam(m, p.add_only_); - WriteParam(m, p.transaction_id_); -} - -bool ParamTraits<ViewHostMsg_IDBObjectStorePut_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->idb_object_store_id_) && - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->serialized_value_) && - ReadParam(m, iter, &p->key_) && - ReadParam(m, iter, &p->add_only_) && - ReadParam(m, iter, &p->transaction_id_); -} - -void ParamTraits<ViewHostMsg_IDBObjectStorePut_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.idb_object_store_id_, l); - l->append(", "); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.serialized_value_, l); - l->append(", "); - LogParam(p.key_, l); - l->append(", "); - LogParam(p.add_only_, l); - l->append(", "); - LogParam(p.transaction_id_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.name_); - WriteParam(m, p.key_path_); - WriteParam(m, p.unique_); - WriteParam(m, p.transaction_id_); - WriteParam(m, p.idb_object_store_id_); -} - -bool ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->key_path_) && - ReadParam(m, iter, &p->unique_) && - ReadParam(m, iter, &p->transaction_id_) && - ReadParam(m, iter, &p->idb_object_store_id_); -} - -void ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.name_, l); - l->append(", "); - LogParam(p.key_path_, l); - l->append(", "); - LogParam(p.unique_, l); - l->append(", "); - LogParam(p.transaction_id_, l); - l->append(", "); - LogParam(p.idb_object_store_id_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.response_id_); - WriteParam(m, p.lower_key_); - WriteParam(m, p.upper_key_); - WriteParam(m, p.lower_open_); - WriteParam(m, p.upper_open_); - WriteParam(m, p.direction_); - WriteParam(m, p.idb_object_store_id_); - WriteParam(m, p.transaction_id_); -} - -bool ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->lower_key_) && - ReadParam(m, iter, &p->upper_key_) && - ReadParam(m, iter, &p->lower_open_) && - ReadParam(m, iter, &p->upper_open_) && - ReadParam(m, iter, &p->direction_) && - ReadParam(m, iter, &p->idb_object_store_id_) && - ReadParam(m, iter, &p->transaction_id_); -} - -void ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.lower_key_, l); - l->append(", "); - LogParam(p.upper_key_, l); - l->append(", "); - LogParam(p.lower_open_, l); - l->append(", "); - LogParam(p.upper_open_, l); - l->append(", "); - LogParam(p.direction_, l); - l->append(", "); - LogParam(p.idb_object_store_id_, l); - l->append(","); - LogParam(p.transaction_id_, l); - l->append(")"); -} - void ParamTraits<ViewMsg_ExecuteCode_Params>::Write(Message* m, const param_type& p) { WriteParam(m, p.request_id); diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h index b522e66..af32a1a 100644 --- a/chrome/common/render_messages_params.h +++ b/chrome/common/render_messages_params.h @@ -19,7 +19,6 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_extent.h" #include "chrome/common/extensions/url_pattern.h" -#include "chrome/common/indexed_db_key.h" #include "chrome/common/navigation_gesture.h" #include "chrome/common/navigation_types.h" #include "chrome/common/page_transition_types.h" @@ -634,153 +633,6 @@ struct ViewHostMsg_ScriptedPrint_Params { bool use_overlays; }; -// Used to open an indexed database. -struct ViewHostMsg_IDBFactoryOpen_Params { - ViewHostMsg_IDBFactoryOpen_Params(); - ~ViewHostMsg_IDBFactoryOpen_Params(); - - // The routing ID of the view initiating the open. - int32 routing_id_; - - // The response should have this id. - int32 response_id_; - - // The origin doing the initiating. - string16 origin_; - - // The name of the database. - string16 name_; - - // The maximum size of the database. - uint64 maximum_size_; -}; - -// Used to create an object store. -struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params { - ViewHostMsg_IDBDatabaseCreateObjectStore_Params(); - ~ViewHostMsg_IDBDatabaseCreateObjectStore_Params(); - - // The name of the object store. - string16 name_; - - // The keyPath of the object store. - NullableString16 key_path_; - - // Whether the object store created should have a key generator. - bool auto_increment_; - - // The transaction this is associated with. - int32 transaction_id_; - - // The database the object store belongs to. - int32 idb_database_id_; -}; - -// Used to open both cursors and object cursors in IndexedDB. -struct ViewHostMsg_IDBIndexOpenCursor_Params { - ViewHostMsg_IDBIndexOpenCursor_Params(); - ~ViewHostMsg_IDBIndexOpenCursor_Params(); - - // The response should have this id. - int32 response_id_; - - // The serialized lower key. - IndexedDBKey lower_key_; - - // The serialized upper key. - IndexedDBKey upper_key_; - - // Is the lower bound open? - bool lower_open_; - - // Is the upper bound open? - bool upper_open_; - - // The direction of this cursor. - int32 direction_; - - // The index the index belongs to. - int32 idb_index_id_; - - // The transaction this request belongs to. - int transaction_id_; -}; - -// Used to set a value in an object store. -struct ViewHostMsg_IDBObjectStorePut_Params { - ViewHostMsg_IDBObjectStorePut_Params(); - ~ViewHostMsg_IDBObjectStorePut_Params(); - - // The object store's id. - int32 idb_object_store_id_; - - // The id any response should contain. - int32 response_id_; - - // The value to set. - SerializedScriptValue serialized_value_; - - // The key to set it on (may not be "valid"/set in some cases). - IndexedDBKey key_; - - // If it already exists, don't update (just return an error). - bool add_only_; - - // The transaction it's associated with. - int transaction_id_; -}; - -// Used to create an index. -struct ViewHostMsg_IDBObjectStoreCreateIndex_Params { - ViewHostMsg_IDBObjectStoreCreateIndex_Params(); - ~ViewHostMsg_IDBObjectStoreCreateIndex_Params(); - - // The name of the index. - string16 name_; - - // The keyPath of the index. - NullableString16 key_path_; - - // Whether the index created has unique keys. - bool unique_; - - // The transaction this is associated with. - int32 transaction_id_; - - // The object store the index belongs to. - int32 idb_object_store_id_; -}; - -// Used to open an IndexedDB cursor. -struct ViewHostMsg_IDBObjectStoreOpenCursor_Params { - ViewHostMsg_IDBObjectStoreOpenCursor_Params(); - ~ViewHostMsg_IDBObjectStoreOpenCursor_Params(); - - // The response should have this id. - int32 response_id_; - - // The serialized lower key. - IndexedDBKey lower_key_; - - // The serialized upper key. - IndexedDBKey upper_key_; - - // Is the lower bound open? - bool lower_open_; - - // Is the upper bound open? - bool upper_open_; - - // The direction of this cursor. - int32 direction_; - - // The object store the cursor belongs to. - int32 idb_object_store_id_; - - // The transaction this request belongs to. - int transaction_id_; -}; - // Allows an extension to execute code in a tab. struct ViewMsg_ExecuteCode_Params { ViewMsg_ExecuteCode_Params(); @@ -1166,53 +1018,6 @@ struct ParamTraits<ViewHostMsg_ScriptedPrint_Params> { }; template <> -struct ParamTraits<ViewHostMsg_IDBFactoryOpen_Params> { - typedef ViewHostMsg_IDBFactoryOpen_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params> { - typedef ViewHostMsg_IDBDatabaseCreateObjectStore_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params> { - typedef ViewHostMsg_IDBIndexOpenCursor_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<ViewHostMsg_IDBObjectStorePut_Params> { - typedef ViewHostMsg_IDBObjectStorePut_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params> { - typedef ViewHostMsg_IDBObjectStoreCreateIndex_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params> { - typedef ViewHostMsg_IDBObjectStoreOpenCursor_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - template<> struct ParamTraits<ViewMsg_ExecuteCode_Params> { typedef ViewMsg_ExecuteCode_Params param_type; diff --git a/chrome/renderer/indexed_db_dispatcher.cc b/chrome/renderer/indexed_db_dispatcher.cc index 83d3d16..8960504 100644 --- a/chrome/renderer/indexed_db_dispatcher.cc +++ b/chrome/renderer/indexed_db_dispatcher.cc @@ -4,10 +4,7 @@ #include "chrome/renderer/indexed_db_dispatcher.h" -#include "chrome/common/indexed_db_key.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" -#include "chrome/common/serialized_script_value.h" +#include "chrome/common/indexed_db_messages.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view.h" #include "chrome/renderer/renderer_webidbcursor_impl.h" @@ -40,30 +37,25 @@ IndexedDBDispatcher::~IndexedDBDispatcher() { bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg) - IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessNull, - OnSuccessNull) - IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBCursor, + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessNull, OnSuccessNull) + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursor, OnSuccessOpenCursor) - IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBDatabase, + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBDatabase, OnSuccessIDBDatabase) - IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBIndex, + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBIndex, OnSuccessIDBIndex) - IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIndexedDBKey, + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey, OnSuccessIndexedDBKey) - IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBObjectStore, + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBObjectStore, OnSuccessIDBObjectStore) - IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBTransaction, + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBTransaction, OnSuccessIDBTransaction) - IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessSerializedScriptValue, + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, OnSuccessSerializedScriptValue) - IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksError, - OnError) - IPC_MESSAGE_HANDLER(ViewMsg_IDBTransactionCallbacksAbort, - OnAbort) - IPC_MESSAGE_HANDLER(ViewMsg_IDBTransactionCallbacksComplete, - OnComplete) - IPC_MESSAGE_HANDLER(ViewMsg_IDBTransactionCallbacksTimeout, - OnTimeout) + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) + IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) + IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) + IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksTimeout, OnTimeout) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -78,7 +70,7 @@ void IndexedDBDispatcher::RequestIDBCursorUpdate( int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBCursorUpdate(idb_cursor_id, response_id, value, ec)); + new IndexedDBHostMsg_CursorUpdate(idb_cursor_id, response_id, value, ec)); if (*ec) pending_callbacks_.Remove(response_id); } @@ -92,7 +84,7 @@ void IndexedDBDispatcher::RequestIDBCursorContinue( int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBCursorContinue(idb_cursor_id, response_id, key, ec)); + new IndexedDBHostMsg_CursorContinue(idb_cursor_id, response_id, key, ec)); if (*ec) pending_callbacks_.Remove(response_id); } @@ -105,7 +97,7 @@ void IndexedDBDispatcher::RequestIDBCursorDelete( int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBCursorDelete(idb_cursor_id, response_id, ec)); + new IndexedDBHostMsg_CursorDelete(idb_cursor_id, response_id, ec)); if (*ec) pending_callbacks_.Remove(response_id); } @@ -124,13 +116,13 @@ void IndexedDBDispatcher::RequestIDBFactoryOpen( if (!render_view) return; // We must be shutting down. - ViewHostMsg_IDBFactoryOpen_Params params; - params.routing_id_ = render_view->routing_id(); - params.response_id_ = pending_callbacks_.Add(callbacks.release()); - params.origin_ = origin; - params.name_ = name; - params.maximum_size_ = maximum_size; - RenderThread::current()->Send(new ViewHostMsg_IDBFactoryOpen(params)); + IndexedDBHostMsg_FactoryOpen_Params params; + params.routing_id = render_view->routing_id(); + params.response_id = pending_callbacks_.Add(callbacks.release()); + params.origin = origin; + params.name = name; + params.maximum_size = maximum_size; + RenderThread::current()->Send(new IndexedDBHostMsg_FactoryOpen(params)); } void IndexedDBDispatcher::RequestIDBDatabaseSetVersion( @@ -142,7 +134,7 @@ void IndexedDBDispatcher::RequestIDBDatabaseSetVersion( int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBDatabaseSetVersion(idb_database_id, response_id, + new IndexedDBHostMsg_DatabaseSetVersion(idb_database_id, response_id, version, ec)); if (*ec) pending_callbacks_.Remove(response_id); @@ -156,19 +148,19 @@ void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( const WebIDBTransaction& transaction, WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); - ViewHostMsg_IDBIndexOpenCursor_Params params; - params.response_id_ = pending_callbacks_.Add(callbacks.release()); - params.lower_key_.Set(idb_key_range.lower()); - params.upper_key_.Set(idb_key_range.upper()); - params.lower_open_ = idb_key_range.lowerOpen(); - params.upper_open_ = idb_key_range.upperOpen(); - params.direction_ = direction; - params.idb_index_id_ = idb_index_id; - params.transaction_id_ = TransactionId(transaction); + IndexedDBHostMsg_IndexOpenCursor_Params params; + params.response_id = pending_callbacks_.Add(callbacks.release()); + params.lower_key.Set(idb_key_range.lower()); + params.upper_key.Set(idb_key_range.upper()); + params.lower_open = idb_key_range.lowerOpen(); + params.upper_open = idb_key_range.upperOpen(); + params.direction = direction; + params.idb_index_id = idb_index_id; + params.transaction_id = TransactionId(transaction); RenderThread::current()->Send( - new ViewHostMsg_IDBIndexOpenObjectCursor(params, ec)); + new IndexedDBHostMsg_IndexOpenObjectCursor(params, ec)); if (*ec) - pending_callbacks_.Remove(params.response_id_); + pending_callbacks_.Remove(params.response_id); } void IndexedDBDispatcher::RequestIDBIndexOpenKeyCursor( @@ -179,21 +171,21 @@ void IndexedDBDispatcher::RequestIDBIndexOpenKeyCursor( const WebIDBTransaction& transaction, WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); - ViewHostMsg_IDBIndexOpenCursor_Params params; - params.response_id_ = pending_callbacks_.Add(callbacks.release()); + IndexedDBHostMsg_IndexOpenCursor_Params params; + params.response_id = pending_callbacks_.Add(callbacks.release()); // TODO(jorlow): We really should just create a Chromium abstraction for // KeyRange rather than doing it ad-hoc like this. - params.lower_key_.Set(idb_key_range.lower()); - params.upper_key_.Set(idb_key_range.upper()); - params.lower_open_ = idb_key_range.lowerOpen(); - params.upper_open_ = idb_key_range.upperOpen(); - params.direction_ = direction; - params.idb_index_id_ = idb_index_id; - params.transaction_id_ = TransactionId(transaction); + params.lower_key.Set(idb_key_range.lower()); + params.upper_key.Set(idb_key_range.upper()); + params.lower_open = idb_key_range.lowerOpen(); + params.upper_open = idb_key_range.upperOpen(); + params.direction = direction; + params.idb_index_id = idb_index_id; + params.transaction_id = TransactionId(transaction); RenderThread::current()->Send( - new ViewHostMsg_IDBIndexOpenKeyCursor(params, ec)); + new IndexedDBHostMsg_IndexOpenKeyCursor(params, ec)); if (*ec) - pending_callbacks_.Remove(params.response_id_); + pending_callbacks_.Remove(params.response_id); } void IndexedDBDispatcher::RequestIDBIndexGetObject( @@ -205,7 +197,7 @@ void IndexedDBDispatcher::RequestIDBIndexGetObject( scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBIndexGetObject( + new IndexedDBHostMsg_IndexGetObject( idb_index_id, response_id, key, TransactionId(transaction), ec)); if (*ec) @@ -221,7 +213,7 @@ void IndexedDBDispatcher::RequestIDBIndexGetKey( scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBIndexGetKey( + new IndexedDBHostMsg_IndexGetKey( idb_index_id, response_id, key, TransactionId(transaction), ec)); if (*ec) @@ -238,7 +230,7 @@ void IndexedDBDispatcher::RequestIDBObjectStoreGet( int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreGet( + new IndexedDBHostMsg_ObjectStoreGet( idb_object_store_id, response_id, key, TransactionId(transaction), ec)); if (*ec) @@ -254,16 +246,17 @@ void IndexedDBDispatcher::RequestIDBObjectStorePut( const WebIDBTransaction& transaction, WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); - ViewHostMsg_IDBObjectStorePut_Params params; - params.idb_object_store_id_ = idb_object_store_id; - params.response_id_ = pending_callbacks_.Add(callbacks.release()); - params.serialized_value_ = value; - params.key_ = key; - params.add_only_ = add_only; - params.transaction_id_ = TransactionId(transaction); - RenderThread::current()->Send(new ViewHostMsg_IDBObjectStorePut(params, ec)); + IndexedDBHostMsg_ObjectStorePut_Params params; + params.idb_object_store_id = idb_object_store_id; + params.response_id = pending_callbacks_.Add(callbacks.release()); + params.serialized_value = value; + params.key = key; + params.add_only = add_only; + params.transaction_id = TransactionId(transaction); + RenderThread::current()->Send(new IndexedDBHostMsg_ObjectStorePut( + params, ec)); if (*ec) - pending_callbacks_.Remove(params.response_id_); + pending_callbacks_.Remove(params.response_id); } void IndexedDBDispatcher::RequestIDBObjectStoreDelete( @@ -276,7 +269,7 @@ void IndexedDBDispatcher::RequestIDBObjectStoreDelete( int32 response_id = pending_callbacks_.Add(callbacks.release()); RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreDelete( + new IndexedDBHostMsg_ObjectStoreDelete( idb_object_store_id, response_id, key, TransactionId(transaction), ec)); if (*ec) @@ -291,19 +284,19 @@ void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( const WebIDBTransaction& transaction, WebExceptionCode* ec) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); - ViewHostMsg_IDBObjectStoreOpenCursor_Params params; - params.response_id_ = pending_callbacks_.Add(callbacks.release()); - params.lower_key_.Set(idb_key_range.lower()); - params.upper_key_.Set(idb_key_range.upper()); - params.lower_open_ = idb_key_range.lowerOpen(); - params.upper_open_ = idb_key_range.upperOpen(); - params.direction_ = direction; - params.idb_object_store_id_ = idb_object_store_id; - params.transaction_id_ = TransactionId(transaction); + IndexedDBHostMsg_ObjectStoreOpenCursor_Params params; + params.response_id = pending_callbacks_.Add(callbacks.release()); + params.lower_key.Set(idb_key_range.lower()); + params.upper_key.Set(idb_key_range.upper()); + params.lower_open = idb_key_range.lowerOpen(); + params.upper_open = idb_key_range.upperOpen(); + params.direction = direction; + params.idb_object_store_id = idb_object_store_id; + params.transaction_id = TransactionId(transaction); RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreOpenCursor(params, ec)); + new IndexedDBHostMsg_ObjectStoreOpenCursor(params, ec)); if (*ec) - pending_callbacks_.Remove(params.response_id_); + pending_callbacks_.Remove(params.response_id); } void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks( diff --git a/chrome/renderer/renderer_webidbcursor_impl.cc b/chrome/renderer/renderer_webidbcursor_impl.cc index 97f4f06..89b2392 100644 --- a/chrome/renderer/renderer_webidbcursor_impl.cc +++ b/chrome/renderer/renderer_webidbcursor_impl.cc @@ -4,9 +4,7 @@ #include "chrome/renderer/renderer_webidbcursor_impl.h" -#include "chrome/common/indexed_db_key.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/serialized_script_value.h" +#include "chrome/common/indexed_db_messages.h" #include "chrome/renderer/indexed_db_dispatcher.h" #include "chrome/renderer/render_thread.h" @@ -20,21 +18,21 @@ RendererWebIDBCursorImpl::RendererWebIDBCursorImpl(int32 idb_cursor_id) } RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() { - RenderThread::current()->Send(new ViewHostMsg_IDBCursorDestroyed( + RenderThread::current()->Send(new IndexedDBHostMsg_CursorDestroyed( idb_cursor_id_)); } unsigned short RendererWebIDBCursorImpl::direction() const { int direction; RenderThread::current()->Send( - new ViewHostMsg_IDBCursorDirection(idb_cursor_id_, &direction)); + new IndexedDBHostMsg_CursorDirection(idb_cursor_id_, &direction)); return direction; } WebIDBKey RendererWebIDBCursorImpl::key() const { IndexedDBKey key; RenderThread::current()->Send( - new ViewHostMsg_IDBCursorKey(idb_cursor_id_, &key)); + new IndexedDBHostMsg_CursorKey(idb_cursor_id_, &key)); return key; } @@ -44,8 +42,8 @@ void RendererWebIDBCursorImpl::value( SerializedScriptValue scriptValue; IndexedDBKey key; RenderThread::current()->Send( - new ViewHostMsg_IDBCursorValue(idb_cursor_id_, &scriptValue, - &key)); + new IndexedDBHostMsg_CursorValue(idb_cursor_id_, &scriptValue, + &key)); // Only one or the other type should have been "returned" to us. DCHECK(scriptValue.is_null() != (key.type() == WebIDBKey::InvalidType)); webScriptValue = scriptValue; diff --git a/chrome/renderer/renderer_webidbdatabase_impl.cc b/chrome/renderer/renderer_webidbdatabase_impl.cc index f2a0bf5..d65e8a18 100644 --- a/chrome/renderer/renderer_webidbdatabase_impl.cc +++ b/chrome/renderer/renderer_webidbdatabase_impl.cc @@ -4,13 +4,13 @@ #include "chrome/renderer/renderer_webidbdatabase_impl.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" +#include "chrome/common/indexed_db_messages.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/indexed_db_dispatcher.h" #include "chrome/renderer/renderer_webidbobjectstore_impl.h" #include "chrome/renderer/renderer_webidbtransaction_impl.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" using WebKit::WebDOMStringList; using WebKit::WebExceptionCode; @@ -27,28 +27,28 @@ RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 idb_database_id) RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { // TODO(jorlow): Is it possible for this to be destroyed but still have // pending callbacks? If so, fix! - RenderThread::current()->Send(new ViewHostMsg_IDBDatabaseDestroyed( + RenderThread::current()->Send(new IndexedDBHostMsg_DatabaseDestroyed( idb_database_id_)); } WebString RendererWebIDBDatabaseImpl::name() const { string16 result; RenderThread::current()->Send( - new ViewHostMsg_IDBDatabaseName(idb_database_id_, &result)); + new IndexedDBHostMsg_DatabaseName(idb_database_id_, &result)); return result; } WebString RendererWebIDBDatabaseImpl::version() const { string16 result; RenderThread::current()->Send( - new ViewHostMsg_IDBDatabaseVersion(idb_database_id_, &result)); + new IndexedDBHostMsg_DatabaseVersion(idb_database_id_, &result)); return result; } WebDOMStringList RendererWebIDBDatabaseImpl::objectStoreNames() const { std::vector<string16> result; RenderThread::current()->Send( - new ViewHostMsg_IDBDatabaseObjectStoreNames(idb_database_id_, &result)); + new IndexedDBHostMsg_DatabaseObjectStoreNames(idb_database_id_, &result)); WebDOMStringList webResult; for (std::vector<string16>::const_iterator it = result.begin(); it != result.end(); ++it) { @@ -63,16 +63,16 @@ WebKit::WebIDBObjectStore* RendererWebIDBDatabaseImpl::createObjectStore( bool auto_increment, const WebKit::WebIDBTransaction& transaction, WebExceptionCode& ec) { - ViewHostMsg_IDBDatabaseCreateObjectStore_Params params; - params.name_ = name; - params.key_path_ = key_path; - params.auto_increment_ = auto_increment; - params.transaction_id_ = IndexedDBDispatcher::TransactionId(transaction); - params.idb_database_id_ = idb_database_id_; + IndexedDBHostMsg_DatabaseCreateObjectStore_Params params; + params.name = name; + params.key_path = key_path; + params.auto_increment = auto_increment; + params.transaction_id = IndexedDBDispatcher::TransactionId(transaction); + params.idb_database_id = idb_database_id_; int object_store; RenderThread::current()->Send( - new ViewHostMsg_IDBDatabaseCreateObjectStore(params, &object_store, &ec)); + new IndexedDBHostMsg_DatabaseCreateObjectStore(params, &object_store, &ec)); if (!object_store) return NULL; return new RendererWebIDBObjectStoreImpl(object_store); @@ -83,7 +83,7 @@ void RendererWebIDBDatabaseImpl::deleteObjectStore( const WebIDBTransaction& transaction, WebExceptionCode& ec) { RenderThread::current()->Send( - new ViewHostMsg_IDBDatabaseDeleteObjectStore( + new IndexedDBHostMsg_DatabaseDeleteObjectStore( idb_database_id_, name, IndexedDBDispatcher::TransactionId(transaction), &ec)); } @@ -110,7 +110,7 @@ WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction( int transaction_id; RenderThread::current()->Send( - new ViewHostMsg_IDBDatabaseTransaction( + new IndexedDBHostMsg_DatabaseTransaction( idb_database_id_, object_stores, mode, timeout, &transaction_id, &ec)); if (!transaction_id) diff --git a/chrome/renderer/renderer_webidbindex_impl.cc b/chrome/renderer/renderer_webidbindex_impl.cc index 230011b..12e990f 100644 --- a/chrome/renderer/renderer_webidbindex_impl.cc +++ b/chrome/renderer/renderer_webidbindex_impl.cc @@ -4,11 +4,12 @@ #include "chrome/renderer/renderer_webidbindex_impl.h" -#include "chrome/common/indexed_db_key.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/indexed_db_messages.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/indexed_db_dispatcher.h" #include "chrome/renderer/renderer_webidbtransaction_impl.h" +#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" using WebKit::WebExceptionCode; using WebKit::WebDOMStringList; @@ -22,35 +23,35 @@ RendererWebIDBIndexImpl::RendererWebIDBIndexImpl(int32 idb_index_id) RendererWebIDBIndexImpl::~RendererWebIDBIndexImpl() { // TODO(jorlow): Is it possible for this to be destroyed but still have // pending callbacks? If so, fix! - RenderThread::current()->Send(new ViewHostMsg_IDBIndexDestroyed( + RenderThread::current()->Send(new IndexedDBHostMsg_IndexDestroyed( idb_index_id_)); } WebString RendererWebIDBIndexImpl::name() const { string16 result; RenderThread::current()->Send( - new ViewHostMsg_IDBIndexName(idb_index_id_, &result)); + new IndexedDBHostMsg_IndexName(idb_index_id_, &result)); return result; } WebString RendererWebIDBIndexImpl::storeName() const { string16 result; RenderThread::current()->Send( - new ViewHostMsg_IDBIndexStoreName(idb_index_id_, &result)); + new IndexedDBHostMsg_IndexStoreName(idb_index_id_, &result)); return result; } WebString RendererWebIDBIndexImpl::keyPath() const { NullableString16 result; RenderThread::current()->Send( - new ViewHostMsg_IDBIndexKeyPath(idb_index_id_, &result)); + new IndexedDBHostMsg_IndexKeyPath(idb_index_id_, &result)); return result; } bool RendererWebIDBIndexImpl::unique() const { bool result; RenderThread::current()->Send( - new ViewHostMsg_IDBIndexUnique(idb_index_id_, &result)); + new IndexedDBHostMsg_IndexUnique(idb_index_id_, &result)); return result; } diff --git a/chrome/renderer/renderer_webidbobjectstore_impl.cc b/chrome/renderer/renderer_webidbobjectstore_impl.cc index 8b356df..8a138da 100644 --- a/chrome/renderer/renderer_webidbobjectstore_impl.cc +++ b/chrome/renderer/renderer_webidbobjectstore_impl.cc @@ -4,9 +4,7 @@ #include "chrome/renderer/renderer_webidbobjectstore_impl.h" -#include "chrome/common/indexed_db_key.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" +#include "chrome/common/indexed_db_messages.h" #include "chrome/common/serialized_script_value.h" #include "chrome/renderer/indexed_db_dispatcher.h" #include "chrome/renderer/render_thread.h" @@ -37,27 +35,28 @@ RendererWebIDBObjectStoreImpl::RendererWebIDBObjectStoreImpl( RendererWebIDBObjectStoreImpl::~RendererWebIDBObjectStoreImpl() { RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreDestroyed(idb_object_store_id_)); + new IndexedDBHostMsg_ObjectStoreDestroyed(idb_object_store_id_)); } WebString RendererWebIDBObjectStoreImpl::name() const { string16 result; RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreName(idb_object_store_id_, &result)); + new IndexedDBHostMsg_ObjectStoreName(idb_object_store_id_, &result)); return result; } WebString RendererWebIDBObjectStoreImpl::keyPath() const { NullableString16 result; RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreKeyPath(idb_object_store_id_, &result)); + new IndexedDBHostMsg_ObjectStoreKeyPath(idb_object_store_id_, &result)); return result; } WebDOMStringList RendererWebIDBObjectStoreImpl::indexNames() const { std::vector<string16> result; RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreIndexNames(idb_object_store_id_, &result)); + new IndexedDBHostMsg_ObjectStoreIndexNames( + idb_object_store_id_, &result)); WebDOMStringList web_result; for (std::vector<string16>::const_iterator it = result.begin(); it != result.end(); ++it) { @@ -108,16 +107,16 @@ WebIDBIndex* RendererWebIDBObjectStoreImpl::createIndex( bool unique, const WebIDBTransaction& transaction, WebExceptionCode& ec) { - ViewHostMsg_IDBObjectStoreCreateIndex_Params params; - params.name_ = name; - params.key_path_ = key_path; - params.unique_ = unique; - params.transaction_id_ = IndexedDBDispatcher::TransactionId(transaction); - params.idb_object_store_id_ = idb_object_store_id_; + IndexedDBHostMsg_ObjectStoreCreateIndex_Params params; + params.name = name; + params.key_path = key_path; + params.unique = unique; + params.transaction_id = IndexedDBDispatcher::TransactionId(transaction); + params.idb_object_store_id = idb_object_store_id_; int32 index_id; RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreCreateIndex(params, &index_id, &ec)); + new IndexedDBHostMsg_ObjectStoreCreateIndex(params, &index_id, &ec)); if (!index_id) return NULL; return new RendererWebIDBIndexImpl(index_id); @@ -128,8 +127,8 @@ WebIDBIndex* RendererWebIDBObjectStoreImpl::index( WebExceptionCode& ec) { int32 idb_index_id; RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreIndex(idb_object_store_id_, name, - &idb_index_id, &ec)); + new IndexedDBHostMsg_ObjectStoreIndex(idb_object_store_id_, name, + &idb_index_id, &ec)); if (!idb_index_id) return NULL; return new RendererWebIDBIndexImpl(idb_index_id); @@ -140,7 +139,7 @@ void RendererWebIDBObjectStoreImpl::deleteIndex( const WebIDBTransaction& transaction, WebExceptionCode& ec) { RenderThread::current()->Send( - new ViewHostMsg_IDBObjectStoreDeleteIndex( + new IndexedDBHostMsg_ObjectStoreDeleteIndex( idb_object_store_id_, name, IndexedDBDispatcher::TransactionId(transaction), &ec)); } diff --git a/chrome/renderer/renderer_webidbtransaction_impl.cc b/chrome/renderer/renderer_webidbtransaction_impl.cc index b1b024e..8a705e2 100644 --- a/chrome/renderer/renderer_webidbtransaction_impl.cc +++ b/chrome/renderer/renderer_webidbtransaction_impl.cc @@ -4,7 +4,7 @@ #include "chrome/renderer/renderer_webidbtransaction_impl.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/indexed_db_messages.h" #include "chrome/renderer/indexed_db_dispatcher.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/renderer_webidbobjectstore_impl.h" @@ -22,14 +22,14 @@ RendererWebIDBTransactionImpl::RendererWebIDBTransactionImpl( } RendererWebIDBTransactionImpl::~RendererWebIDBTransactionImpl() { - RenderThread::current()->Send(new ViewHostMsg_IDBTransactionDestroyed( + RenderThread::current()->Send(new IndexedDBHostMsg_TransactionDestroyed( idb_transaction_id_)); } int RendererWebIDBTransactionImpl::mode() const { int mode; - RenderThread::current()->Send(new ViewHostMsg_IDBTransactionMode( + RenderThread::current()->Send(new IndexedDBHostMsg_TransactionMode( idb_transaction_id_, &mode)); return mode; } @@ -40,7 +40,7 @@ WebIDBObjectStore* RendererWebIDBTransactionImpl::objectStore( { int object_store_id; RenderThread::current()->Send( - new ViewHostMsg_IDBTransactionObjectStore( + new IndexedDBHostMsg_TransactionObjectStore( idb_transaction_id_, name, &object_store_id, &ec)); if (!object_store_id) return NULL; @@ -49,14 +49,14 @@ WebIDBObjectStore* RendererWebIDBTransactionImpl::objectStore( void RendererWebIDBTransactionImpl::abort() { - RenderThread::current()->Send(new ViewHostMsg_IDBTransactionAbort( + RenderThread::current()->Send(new IndexedDBHostMsg_TransactionAbort( idb_transaction_id_)); } void RendererWebIDBTransactionImpl::didCompleteTaskEvents() { RenderThread::current()->Send( - new ViewHostMsg_IDBTransactionDidCompleteTaskEvents( + new IndexedDBHostMsg_TransactionDidCompleteTaskEvents( idb_transaction_id_)); } diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index a7cdfd5..224b194 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -63,6 +63,7 @@ enum IPCMessageStart { MimeRegistryMsgStart, DatabaseMsgStart, DOMStorageMsgStart, + IndexedDBMsgStart, }; class DictionaryValue; |