diff options
-rw-r--r-- | chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc | 125 | ||||
-rw-r--r-- | chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h | 23 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 1 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 28 | ||||
-rw-r--r-- | chrome/common/render_messages_params.cc | 71 | ||||
-rw-r--r-- | chrome/common/render_messages_params.h | 39 | ||||
-rw-r--r-- | chrome/renderer/indexed_db_dispatcher.cc | 80 | ||||
-rw-r--r-- | chrome/renderer/indexed_db_dispatcher.h | 72 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbindex_impl.cc | 42 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbindex_impl.h | 12 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbobjectstore_impl.cc | 46 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbobjectstore_impl.h | 22 |
12 files changed, 172 insertions, 389 deletions
diff --git a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc index 91b0325..292bbc0 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -33,7 +33,6 @@ #include "webkit/glue/webkit_glue.h" using WebKit::WebDOMStringList; -using WebKit::WebIDBCallbacks; using WebKit::WebIDBCursor; using WebKit::WebIDBDatabase; using WebKit::WebIDBDatabaseError; @@ -559,75 +558,52 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenObjectCursor( const ViewHostMsg_IDBIndexOpenCursor_Params& params) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( - &map_, params.idb_index_id_, NULL, + &parent_->index_dispatcher_host_->map_, + params.idb_index_id_, NULL, ViewHostMsg_IDBIndexOpenObjectCursor::ID); - WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, - params.transaction_id_, NULL, ViewHostMsg_IDBIndexOpenObjectCursor::ID); - if (!idb_transaction || !idb_index) + if (!idb_index) return; - - scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); idb_index->openObjectCursor( WebIDBKeyRange(params.left_key_, params.right_key_, params.key_flags_), - params.direction_, callbacks.release(), *idb_transaction); + params.direction_, + new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenCursor( const ViewHostMsg_IDBIndexOpenCursor_Params& params) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( - &map_, params.idb_index_id_, NULL, ViewHostMsg_IDBIndexOpenCursor::ID); - WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, params.transaction_id_, - NULL, ViewHostMsg_IDBIndexOpenCursor::ID); - if (!idb_transaction || !idb_index) + &parent_->index_dispatcher_host_->map_, + params.idb_index_id_, NULL, + ViewHostMsg_IDBIndexOpenCursor::ID); + if (!idb_index) return; - - scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); idb_index->openCursor( WebIDBKeyRange(params.left_key_, params.right_key_, params.key_flags_), - params.direction_, callbacks.release(), *idb_transaction); + params.direction_, + new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( - int idb_index_id, - int32 response_id, - const IndexedDBKey& key, - int transaction_id) { + int idb_index_id, int32 response_id, const IndexedDBKey& key) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( &map_, idb_index_id, NULL, ViewHostMsg_IDBIndexGetObject::ID); - WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL, - ViewHostMsg_IDBIndexGetObject::ID); - if (!idb_transaction || !idb_index) + if (!idb_index) return; - - scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); - idb_index->getObject(key, callbacks.release(), *idb_transaction); + idb_index->getObject(key, new IndexedDBCallbacks<WebSerializedScriptValue>( + parent_, response_id)); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnGet( - int idb_index_id, - int32 response_id, - const IndexedDBKey& key, - int transaction_id) { + int idb_index_id, int32 response_id, const IndexedDBKey& key) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( &map_, idb_index_id, NULL, ViewHostMsg_IDBIndexGet::ID); - WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL, - ViewHostMsg_IDBIndexGet::ID); - if (!idb_transaction || !idb_index) + if (!idb_index) return; - - scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); - idb_index->get(key, callbacks.release(), *idb_transaction); + idb_index->get(key, new IndexedDBCallbacks<WebSerializedScriptValue>( + parent_, response_id)); } void IndexedDBDispatcherHost::IndexDispatcherHost::OnDestroyed( @@ -710,59 +686,39 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames( } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet( - int idb_object_store_id, - int32 response_id, - const IndexedDBKey& key, - int transaction_id) { + int idb_object_store_id, int32 response_id, const IndexedDBKey& key) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( &map_, idb_object_store_id, NULL, ViewHostMsg_IDBObjectStoreGet::ID); - WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL, - ViewHostMsg_IDBObjectStoreGet::ID); - if (!idb_transaction || !idb_object_store) + if (!idb_object_store) return; - - scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id)); - idb_object_store->get(key, callbacks.release(), *idb_transaction); + idb_object_store->get(key, new IndexedDBCallbacks<WebSerializedScriptValue>( + parent_, response_id)); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut( - const ViewHostMsg_IDBObjectStorePut_Params& params) { + int idb_object_store_id, int32 response_id, + const SerializedScriptValue& value, const IndexedDBKey& key, + bool add_only) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( - &map_, params.idb_object_store_id_, NULL, - ViewHostMsg_IDBObjectStorePut::ID); - WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, params.transaction_id_, - NULL, ViewHostMsg_IDBObjectStorePut::ID); - if (!idb_transaction || !idb_object_store) + &map_, idb_object_store_id, NULL, ViewHostMsg_IDBObjectStorePut::ID); + if (!idb_object_store) return; - - scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id_)); - idb_object_store->put(params.serialized_value_, params.key_, params.add_only_, - callbacks.release(), *idb_transaction); + idb_object_store->put( + value, key, add_only, new IndexedDBCallbacks<WebIDBKey>( + parent_, response_id)); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnRemove( - int idb_object_store_id, - int32 response_id, - const IndexedDBKey& key, - int transaction_id) { + int idb_object_store_id, int32 response_id, const IndexedDBKey& key) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( &map_, idb_object_store_id, NULL, ViewHostMsg_IDBObjectStoreRemove::ID); - WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL, - ViewHostMsg_IDBObjectStoreRemove::ID); - if (!idb_transaction || !idb_object_store) + if (!idb_object_store) return; - - scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<void>(parent_, response_id)); - idb_object_store->remove(key, callbacks.release(), *idb_transaction); + idb_object_store->remove(key, new IndexedDBCallbacks<void>(parent_, + response_id)); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCreateIndex( @@ -812,17 +768,12 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnOpenCursor( &parent_->object_store_dispatcher_host_->map_, params.idb_object_store_id_, NULL, ViewHostMsg_IDBObjectStoreOpenCursor::ID); - WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &parent_->transaction_dispatcher_host_->map_, params.transaction_id_, - NULL, ViewHostMsg_IDBObjectStoreOpenCursor::ID); - if (!idb_transaction || !idb_object_store) + if (!idb_object_store) return; - - scoped_ptr<WebIDBCallbacks> callbacks( - new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); idb_object_store->openCursor( WebIDBKeyRange(params.left_key_, params.right_key_, params.flags_), - params.direction_, callbacks.release(), *idb_transaction); + params.direction_, + new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_)); } void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed( diff --git a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h index 982c861..654b3ab 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h @@ -22,7 +22,6 @@ struct ViewHostMsg_IDBFactoryOpen_Params; struct ViewHostMsg_IDBIndexOpenCursor_Params; struct ViewHostMsg_IDBObjectStoreCreateIndex_Params; struct ViewHostMsg_IDBObjectStoreOpenCursor_Params; -struct ViewHostMsg_IDBObjectStorePut_Params; namespace WebKit { class WebIDBCursor; @@ -138,12 +137,10 @@ class IndexedDBDispatcherHost void OnOpenCursor(const ViewHostMsg_IDBIndexOpenCursor_Params& params); void OnGetObject(int idb_index_id, int32 response_id, - const IndexedDBKey& key, - int transaction_id); + const IndexedDBKey& key); void OnGet(int idb_index_id, int32 response_id, - const IndexedDBKey& key, - int transaction_id); + const IndexedDBKey& key); void OnDestroyed(int32 idb_index_id); IndexedDBDispatcherHost* parent_; @@ -161,15 +158,13 @@ class IndexedDBDispatcherHost 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 OnGet(int idb_object_store_id, - int32 response_id, - const IndexedDBKey& key, - int transaction_id); - void OnPut(const ViewHostMsg_IDBObjectStorePut_Params& params); - void OnRemove(int idb_object_store_id, - int32 response_id, - const IndexedDBKey& key, - int transaction_id); + void OnGet(int idb_object_store_id, int32 response_id, + const IndexedDBKey& key); + void OnPut(int idb_object_store_id, int32 response_id, + const SerializedScriptValue& value, const IndexedDBKey& key, + bool add_only); + void OnRemove(int idb_object_store_id, int32 response_id, + const IndexedDBKey& key); void OnCreateIndex( const ViewHostMsg_IDBObjectStoreCreateIndex_Params& params); void OnIndex(int32 idb_object_store_id, const string16& name, diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 2b810af..4fcb1e5 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -95,7 +95,6 @@ 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 0149bf4..969ea16 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -2462,18 +2462,16 @@ IPC_BEGIN_MESSAGES(ViewHost) ViewHostMsg_IDBIndexOpenCursor_Params) // WebIDBIndex::getObject() message. - IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBIndexGetObject, + IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBIndexGetObject, int32, /* idb_index_id */ int32, /* response_id */ - IndexedDBKey, /* key */ - int /* transaction_id */) + IndexedDBKey /* key */) // WebIDBIndex::get() message. - IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBIndexGet, + IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBIndexGet, int32, /* idb_index_id */ int32, /* response_id */ - IndexedDBKey, /* key */ - int /* transaction_id */) + IndexedDBKey /* key */) // WebIDBIndex::~WebIDBIndex() message. IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBIndexDestroyed, @@ -2495,22 +2493,24 @@ IPC_BEGIN_MESSAGES(ViewHost) std::vector<string16> /* index_names */) // WebIDBObjectStore::get() message. - IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBObjectStoreGet, + IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBObjectStoreGet, int32, /* idb_object_store_id */ int32, /* response_id */ - IndexedDBKey, /* key */ - int /* transaction_id */) + IndexedDBKey /* key */) // WebIDBObjectStore::put() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBObjectStorePut, - ViewHostMsg_IDBObjectStorePut_Params) + IPC_MESSAGE_CONTROL5(ViewHostMsg_IDBObjectStorePut, + int32, /* idb_object_store_id */ + int32, /* response_id */ + SerializedScriptValue, /* serialized_value */ + IndexedDBKey, /* key */ + bool /* add_only */) // WebIDBObjectStore::remove() message. - IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBObjectStoreRemove, + IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBObjectStoreRemove, int32, /* idb_object_store_id */ int32, /* response_id */ - IndexedDBKey, /* key */ - int /* transaction_id */) + IndexedDBKey /* key */) // WebIDBObjectStore::createIndex() message. IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBObjectStoreCreateIndex, diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc index bcd47f6..4fd83a3 100644 --- a/chrome/common/render_messages_params.cc +++ b/chrome/common/render_messages_params.cc @@ -181,20 +181,31 @@ ViewHostMsg_IDBFactoryOpen_Params::~ViewHostMsg_IDBFactoryOpen_Params() { ViewHostMsg_IDBDatabaseCreateObjectStore_Params:: ViewHostMsg_IDBDatabaseCreateObjectStore_Params() : response_id_(0), - auto_increment_(false) { + auto_increment_(false), + idb_database_id_(0) { } ViewHostMsg_IDBDatabaseCreateObjectStore_Params:: ~ViewHostMsg_IDBDatabaseCreateObjectStore_Params() { } +ViewHostMsg_IDBObjectStoreCreateIndex_Params:: + ViewHostMsg_IDBObjectStoreCreateIndex_Params() + : response_id_(0), + unique_(false), + idb_object_store_id_(0) { +} + +ViewHostMsg_IDBObjectStoreCreateIndex_Params:: + ~ViewHostMsg_IDBObjectStoreCreateIndex_Params() { +} + ViewHostMsg_IDBObjectStoreOpenCursor_Params:: ViewHostMsg_IDBObjectStoreOpenCursor_Params() : response_id_(0), flags_(0), direction_(0), - idb_object_store_id_(0), - transaction_id_(0) { + idb_object_store_id_(0) { } ViewHostMsg_IDBObjectStoreOpenCursor_Params:: @@ -1259,7 +1270,6 @@ void ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Write( WriteParam(m, p.key_flags_); WriteParam(m, p.direction_); WriteParam(m, p.idb_index_id_); - WriteParam(m, p.transaction_id_); } bool ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Read( @@ -1272,8 +1282,7 @@ bool ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Read( ReadParam(m, iter, &p->right_key_) && ReadParam(m, iter, &p->key_flags_) && ReadParam(m, iter, &p->direction_) && - ReadParam(m, iter, &p->idb_index_id_) && - ReadParam(m, iter, &p->transaction_id_); + ReadParam(m, iter, &p->idb_index_id_); } void ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Log( @@ -1291,50 +1300,6 @@ void ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Log( 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(")"); } @@ -1385,7 +1350,6 @@ void ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Write( WriteParam(m, p.flags_); WriteParam(m, p.direction_); WriteParam(m, p.idb_object_store_id_); - WriteParam(m, p.transaction_id_); } bool ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Read( @@ -1398,8 +1362,7 @@ bool ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Read( ReadParam(m, iter, &p->right_key_) && ReadParam(m, iter, &p->flags_) && ReadParam(m, iter, &p->direction_) && - ReadParam(m, iter, &p->idb_object_store_id_) && - ReadParam(m, iter, &p->transaction_id_); + ReadParam(m, iter, &p->idb_object_store_id_); } void ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Log( @@ -1417,8 +1380,6 @@ void ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Log( LogParam(p.direction_, l); l->append(", "); LogParam(p.idb_object_store_id_, l); - l->append(","); - LogParam(p.transaction_id_, l); l->append(")"); } diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h index 05c2d7e..70f9825 100644 --- a/chrome/common/render_messages_params.h +++ b/chrome/common/render_messages_params.h @@ -25,7 +25,6 @@ #include "chrome/common/navigation_types.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/renderer_preferences.h" -#include "chrome/common/serialized_script_value.h" #include "chrome/common/window_container_type.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_param_traits.h" @@ -672,34 +671,13 @@ struct ViewHostMsg_IDBIndexOpenCursor_Params { // 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 { - // 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 transaciton it's associated with. - int transaction_id_; }; // Used to create an index. struct ViewHostMsg_IDBObjectStoreCreateIndex_Params { + ViewHostMsg_IDBObjectStoreCreateIndex_Params(); + ~ViewHostMsg_IDBObjectStoreCreateIndex_Params(); + // The response should have this id. int32 response_id_; @@ -738,9 +716,6 @@ struct ViewHostMsg_IDBObjectStoreOpenCursor_Params { // 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. @@ -1166,14 +1141,6 @@ struct ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params> { }; 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); diff --git a/chrome/renderer/indexed_db_dispatcher.cc b/chrome/renderer/indexed_db_dispatcher.cc index 813a4fc..3ba6f08 100644 --- a/chrome/renderer/indexed_db_dispatcher.cc +++ b/chrome/renderer/indexed_db_dispatcher.cc @@ -150,11 +150,8 @@ void IndexedDBDispatcher::RequestIDBDatabaseSetVersion( } void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( - const WebIDBKeyRange& idb_key_range, - unsigned short direction, - WebIDBCallbacks* callbacks_ptr, - int32 idb_index_id, - int transaction_id) { + const WebIDBKeyRange& idb_key_range, unsigned short direction, + WebIDBCallbacks* callbacks_ptr, int32 idb_index_id) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); ViewHostMsg_IDBIndexOpenCursor_Params params; params.response_id_ = pending_callbacks_.Add(callbacks.release()); @@ -163,17 +160,13 @@ void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( params.key_flags_ = idb_key_range.flags(); params.direction_ = direction; params.idb_index_id_ = idb_index_id; - params.transaction_id_ = transaction_id; RenderThread::current()->Send( new ViewHostMsg_IDBIndexOpenObjectCursor(params)); } void IndexedDBDispatcher::RequestIDBIndexOpenCursor( - const WebIDBKeyRange& idb_key_range, - unsigned short direction, - WebIDBCallbacks* callbacks_ptr, - int32 idb_index_id, - int transaction_id) { + const WebIDBKeyRange& idb_key_range, unsigned short direction, + WebIDBCallbacks* callbacks_ptr, int32 idb_index_id) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); ViewHostMsg_IDBIndexOpenCursor_Params params; params.response_id_ = pending_callbacks_.Add(callbacks.release()); @@ -182,79 +175,62 @@ void IndexedDBDispatcher::RequestIDBIndexOpenCursor( params.key_flags_ = idb_key_range.flags(); params.direction_ = direction; params.idb_index_id_ = idb_index_id; - params.transaction_id_ = transaction_id; RenderThread::current()->Send( new ViewHostMsg_IDBIndexOpenCursor(params)); } void IndexedDBDispatcher::RequestIDBIndexGetObject( - const IndexedDBKey& key, - WebKit::WebIDBCallbacks* callbacks_ptr, - int32 idb_index_id, - int transaction_id) { + const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks_ptr, + int32 idb_index_id) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); RenderThread::current()->Send( new ViewHostMsg_IDBIndexGetObject( - idb_index_id, pending_callbacks_.Add(callbacks.release()), key, - transaction_id)); + idb_index_id, pending_callbacks_.Add(callbacks.release()), key)); } void IndexedDBDispatcher::RequestIDBIndexGet( - const IndexedDBKey& key, - WebKit::WebIDBCallbacks* callbacks_ptr, - int32 idb_index_id, - int transaction_id) { + const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks_ptr, + int32 idb_index_id) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); RenderThread::current()->Send( new ViewHostMsg_IDBIndexGet( - idb_index_id, pending_callbacks_.Add(callbacks.release()), key, - transaction_id)); + idb_index_id, pending_callbacks_.Add(callbacks.release()), key)); } void IndexedDBDispatcher::RequestIDBObjectStoreGet( - const IndexedDBKey& key, - WebKit::WebIDBCallbacks* callbacks_ptr, - int32 idb_object_store_id, - int transaction_id) { + const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks_ptr, + int32 idb_object_store_id) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); RenderThread::current()->Send( new ViewHostMsg_IDBObjectStoreGet( idb_object_store_id, pending_callbacks_.Add(callbacks.release()), - key, transaction_id)); + key)); } void IndexedDBDispatcher::RequestIDBObjectStorePut( - const SerializedScriptValue& value, - const IndexedDBKey& key, - bool add_only, - WebKit::WebIDBCallbacks* callbacks_ptr, - int32 idb_object_store_id, - int transaction_id) { + const SerializedScriptValue& value, const IndexedDBKey& key, + bool add_only, WebKit::WebIDBCallbacks* callbacks_ptr, + int32 idb_object_store_id) { 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_ = transaction_id; - RenderThread::current()->Send(new ViewHostMsg_IDBObjectStorePut(params)); + + RenderThread::current()->Send( + new ViewHostMsg_IDBObjectStorePut( + idb_object_store_id, pending_callbacks_.Add(callbacks.release()), + value, key, add_only)); } void IndexedDBDispatcher::RequestIDBObjectStoreRemove( - const IndexedDBKey& key, - WebKit::WebIDBCallbacks* callbacks_ptr, - int32 idb_object_store_id, - int transaction_id) { + const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks_ptr, + int32 idb_object_store_id) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); RenderThread::current()->Send( new ViewHostMsg_IDBObjectStoreRemove( idb_object_store_id, pending_callbacks_.Add(callbacks.release()), - key, transaction_id)); + key)); } void IndexedDBDispatcher::RequestIDBObjectStoreCreateIndex( @@ -284,11 +260,8 @@ void IndexedDBDispatcher::RequestIDBObjectStoreRemoveIndex( } void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( - const WebIDBKeyRange& idb_key_range, - unsigned short direction, - WebIDBCallbacks* callbacks_ptr, - int32 idb_object_store_id, - int transaction_id) { + const WebIDBKeyRange& idb_key_range, unsigned short direction, + WebIDBCallbacks* callbacks_ptr, int32 idb_object_store_id) { scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); ViewHostMsg_IDBObjectStoreOpenCursor_Params params; params.response_id_ = pending_callbacks_.Add(callbacks.release()); @@ -297,7 +270,6 @@ void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( params.flags_ = idb_key_range.flags(); params.direction_ = direction; params.idb_object_store_id_ = idb_object_store_id; - params.transaction_id_ = transaction_id; RenderThread::current()->Send( new ViewHostMsg_IDBObjectStoreOpenCursor(params)); } diff --git a/chrome/renderer/indexed_db_dispatcher.h b/chrome/renderer/indexed_db_dispatcher.h index 2868358..edf11b2 100644 --- a/chrome/renderer/indexed_db_dispatcher.h +++ b/chrome/renderer/indexed_db_dispatcher.h @@ -65,44 +65,33 @@ class IndexedDBDispatcher { int32 idb_database_id); void RequestIDBIndexOpenObjectCursor( - const WebKit::WebIDBKeyRange& idb_key_range, - unsigned short direction, - WebKit::WebIDBCallbacks* callbacks, - int32 idb_index_id, - int transaction_id); - - void RequestIDBIndexOpenCursor(const WebKit::WebIDBKeyRange& idb_key_range, - unsigned short direction, - WebKit::WebIDBCallbacks* callbacks, - int32 idb_index_id, - int transaction_id); - - void RequestIDBIndexGetObject(const IndexedDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - int32 idb_index_id, - int transaction_id); - - void RequestIDBIndexGet(const IndexedDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - int32 idb_index_id, - int transaction_id); - - void RequestIDBObjectStoreGet(const IndexedDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - int32 idb_object_store_id, - int transaction_id); - - void RequestIDBObjectStorePut(const SerializedScriptValue& value, - const IndexedDBKey& key, - bool add_only, - WebKit::WebIDBCallbacks* callbacks, - int32 idb_object_store_id, - int transaction_id); - - void RequestIDBObjectStoreRemove(const IndexedDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - int32 idb_object_store_id, - int transaction_id); + const WebKit::WebIDBKeyRange& idb_key_range, unsigned short direction, + WebKit::WebIDBCallbacks* callbacks, int32 idb_index_id); + + void RequestIDBIndexOpenCursor( + const WebKit::WebIDBKeyRange& idb_key_range, unsigned short direction, + WebKit::WebIDBCallbacks* callbacks, int32 idb_index_id); + + void RequestIDBIndexGetObject( + const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks, + int32 idb_index_id); + + void RequestIDBIndexGet( + const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks, + int32 idb_index_id); + + void RequestIDBObjectStoreGet( + const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks, + int32 idb_object_store_id); + + void RequestIDBObjectStorePut( + const SerializedScriptValue& value, const IndexedDBKey& key, + bool add_only, WebKit::WebIDBCallbacks* callbacks, + int32 idb_object_store_id); + + void RequestIDBObjectStoreRemove( + const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks, + int32 idb_object_store_id); void RequestIDBObjectStoreCreateIndex( const string16& name, const NullableString16& key_path, bool unique, @@ -113,11 +102,8 @@ class IndexedDBDispatcher { int32 idb_object_store_id); void RequestIDBObjectStoreOpenCursor( - const WebKit::WebIDBKeyRange& idb_key_range, - unsigned short direction, - WebKit::WebIDBCallbacks* callbacks, - int32 idb_object_store_id, - int transaction_id); + const WebKit::WebIDBKeyRange& idb_key_range, unsigned short direction, + WebKit::WebIDBCallbacks* callbacks, int32 idb_object_store_id); void RequestIDBTransactionSetCallbacks( WebKit::WebIDBTransactionCallbacks* callbacks); diff --git a/chrome/renderer/renderer_webidbindex_impl.cc b/chrome/renderer/renderer_webidbindex_impl.cc index de3eda5..5fa4115 100644 --- a/chrome/renderer/renderer_webidbindex_impl.cc +++ b/chrome/renderer/renderer_webidbindex_impl.cc @@ -8,7 +8,6 @@ #include "chrome/common/render_messages.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/indexed_db_dispatcher.h" -#include "chrome/renderer/renderer_webidbtransaction_impl.h" using WebKit::WebDOMStringList; using WebKit::WebString; @@ -56,49 +55,34 @@ bool RendererWebIDBIndexImpl::unique() const { void RendererWebIDBIndexImpl::openObjectCursor( const WebKit::WebIDBKeyRange& range, unsigned short direction, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + WebKit::WebIDBCallbacks* callbacks) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - int transaction_id = - static_cast<const RendererWebIDBTransactionImpl*>(&transaction)->id(); - dispatcher->RequestIDBIndexOpenObjectCursor( - range, direction, callbacks, idb_index_id_, transaction_id); + dispatcher->RequestIDBIndexOpenObjectCursor(range, direction, + callbacks, idb_index_id_); } void RendererWebIDBIndexImpl::openCursor( const WebKit::WebIDBKeyRange& range, unsigned short direction, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + WebKit::WebIDBCallbacks* callbacks) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - int transaction_id = - static_cast<const RendererWebIDBTransactionImpl*>(&transaction)->id(); - dispatcher->RequestIDBIndexOpenCursor( - range, direction, callbacks, idb_index_id_, transaction_id); + dispatcher->RequestIDBIndexOpenCursor(range, direction, + callbacks, idb_index_id_); } -void RendererWebIDBIndexImpl::getObject( - const WebKit::WebIDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { +void RendererWebIDBIndexImpl::getObject(const WebKit::WebIDBKey& key, + WebKit::WebIDBCallbacks* callbacks) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - int transaction_id = - static_cast<const RendererWebIDBTransactionImpl*>(&transaction)->id(); - dispatcher->RequestIDBIndexGetObject( - IndexedDBKey(key), callbacks, idb_index_id_, transaction_id); + dispatcher->RequestIDBIndexGetObject(IndexedDBKey(key), callbacks, + idb_index_id_); } -void RendererWebIDBIndexImpl::get( - const WebKit::WebIDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { +void RendererWebIDBIndexImpl::get(const WebKit::WebIDBKey& key, + WebKit::WebIDBCallbacks* callbacks) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - int transaction_id = - static_cast<const RendererWebIDBTransactionImpl*>(&transaction)->id(); - dispatcher->RequestIDBIndexGet( - IndexedDBKey(key), callbacks, idb_index_id_, transaction_id); + dispatcher->RequestIDBIndexGet(IndexedDBKey(key), callbacks, idb_index_id_); } diff --git a/chrome/renderer/renderer_webidbindex_impl.h b/chrome/renderer/renderer_webidbindex_impl.h index 1faab64..de77920 100644 --- a/chrome/renderer/renderer_webidbindex_impl.h +++ b/chrome/renderer/renderer_webidbindex_impl.h @@ -22,18 +22,14 @@ class RendererWebIDBIndexImpl : public WebKit::WebIDBIndex { virtual bool unique() const; virtual void openObjectCursor(const WebKit::WebIDBKeyRange& range, unsigned short direction, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + WebKit::WebIDBCallbacks* callbacks); virtual void openCursor(const WebKit::WebIDBKeyRange& range, unsigned short direction, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + WebKit::WebIDBCallbacks* callbacks); virtual void getObject(const WebKit::WebIDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + WebKit::WebIDBCallbacks* callbacks); virtual void get(const WebKit::WebIDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + WebKit::WebIDBCallbacks* callbacks); private: int32 idb_index_id_; diff --git a/chrome/renderer/renderer_webidbobjectstore_impl.cc b/chrome/renderer/renderer_webidbobjectstore_impl.cc index ead8e53..d29a326 100644 --- a/chrome/renderer/renderer_webidbobjectstore_impl.cc +++ b/chrome/renderer/renderer_webidbobjectstore_impl.cc @@ -10,7 +10,6 @@ #include "chrome/renderer/indexed_db_dispatcher.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/renderer_webidbindex_impl.h" -#include "chrome/renderer/renderer_webidbtransaction_impl.h" #include "third_party/WebKit/WebKit/chromium/public/WebDOMStringList.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBKey.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBKeyRange.h" @@ -62,43 +61,30 @@ WebDOMStringList RendererWebIDBObjectStoreImpl::indexNames() const { return web_result; } -void RendererWebIDBObjectStoreImpl::get( - const WebIDBKey& key, - WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { +void RendererWebIDBObjectStoreImpl::get(const WebIDBKey& key, + WebIDBCallbacks* callbacks) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - int transaction_id = - static_cast<const RendererWebIDBTransactionImpl*>(&transaction)->id(); - dispatcher->RequestIDBObjectStoreGet( - IndexedDBKey(key), callbacks, idb_object_store_id_, transaction_id); + dispatcher->RequestIDBObjectStoreGet(IndexedDBKey(key), + callbacks, idb_object_store_id_); } void RendererWebIDBObjectStoreImpl::put( - const WebSerializedScriptValue& value, - const WebIDBKey& key, - bool add_only, - WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + const WebSerializedScriptValue& value, const WebIDBKey& key, bool add_only, + WebIDBCallbacks* callbacks) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - int transaction_id = - static_cast<const RendererWebIDBTransactionImpl*>(&transaction)->id(); dispatcher->RequestIDBObjectStorePut( SerializedScriptValue(value), IndexedDBKey(key), add_only, callbacks, - idb_object_store_id_, transaction_id); + idb_object_store_id_); } -void RendererWebIDBObjectStoreImpl::remove( - const WebIDBKey& key, - WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { +void RendererWebIDBObjectStoreImpl::remove(const WebIDBKey& key, + WebIDBCallbacks* callbacks) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - int transaction_id = - static_cast<const RendererWebIDBTransactionImpl*>(&transaction)->id(); - dispatcher->RequestIDBObjectStoreRemove( - IndexedDBKey(key), callbacks, idb_object_store_id_, transaction_id); + dispatcher->RequestIDBObjectStoreRemove(IndexedDBKey(key), callbacks, + idb_object_store_id_); } void RendererWebIDBObjectStoreImpl::createIndex( @@ -132,13 +118,9 @@ void RendererWebIDBObjectStoreImpl::removeIndex(const WebString& name, void RendererWebIDBObjectStoreImpl::openCursor( const WebIDBKeyRange& idb_key_range, - unsigned short direction, WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction) { + unsigned short direction, WebIDBCallbacks* callbacks) { IndexedDBDispatcher* dispatcher = RenderThread::current()->indexed_db_dispatcher(); - int transaction_id = - static_cast<const RendererWebIDBTransactionImpl*>(&transaction)->id(); - dispatcher->RequestIDBObjectStoreOpenCursor( - idb_key_range, direction, callbacks, idb_object_store_id_, - transaction_id); + dispatcher->RequestIDBObjectStoreOpenCursor(idb_key_range, direction, + callbacks, idb_object_store_id_); } diff --git a/chrome/renderer/renderer_webidbobjectstore_impl.h b/chrome/renderer/renderer_webidbobjectstore_impl.h index 1cca553..88e5ad4 100644 --- a/chrome/renderer/renderer_webidbobjectstore_impl.h +++ b/chrome/renderer/renderer_webidbobjectstore_impl.h @@ -29,31 +29,21 @@ class RendererWebIDBObjectStoreImpl : public WebKit::WebIDBObjectStore { WebKit::WebString keyPath() const; WebKit::WebDOMStringList indexNames() const; - void get(const WebKit::WebIDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + void get(const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callbacks); void put(const WebKit::WebSerializedScriptValue& value, - const WebKit::WebIDBKey& key, - bool add_only, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); - void remove(const WebKit::WebIDBKey& key, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + const WebKit::WebIDBKey& key, bool add_only, + WebKit::WebIDBCallbacks* callbacks); + void remove(const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callbacks); void createIndex(const WebKit::WebString& name, - const WebKit::WebString& key_path, - bool unique, + const WebKit::WebString& key_path, bool unique, WebKit::WebIDBCallbacks* callbacks); // Transfers ownership of the WebIDBIndex to the caller. WebKit::WebIDBIndex* index(const WebKit::WebString& name); void removeIndex(const WebKit::WebString& name, WebKit::WebIDBCallbacks* callbacks); - void openCursor(const WebKit::WebIDBKeyRange& idb_key_range, - unsigned short direction, - WebKit::WebIDBCallbacks* callbacks, - const WebKit::WebIDBTransaction& transaction); + unsigned short direction, WebKit::WebIDBCallbacks* callbacks); private: int32 idb_object_store_id_; }; |