diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 10:47:00 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 10:47:00 +0000 |
commit | 2e21b5e7458998a0d01bc6f3797c0e3e64e8294e (patch) | |
tree | ce45a96cbc53cfc6a30fc58df00959874386c39b /chrome/common | |
parent | cb40fd2e6057b3d6b1fa4329b4fdffb9c271cc93 (diff) | |
download | chromium_src-2e21b5e7458998a0d01bc6f3797c0e3e64e8294e.zip chromium_src-2e21b5e7458998a0d01bc6f3797c0e3e64e8294e.tar.gz chromium_src-2e21b5e7458998a0d01bc6f3797c0e3e64e8294e.tar.bz2 |
Add the transaction id plumbing to IndexedDB.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3478003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-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 |
4 files changed, 106 insertions, 33 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 4fcb1e5..2b810af 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -95,6 +95,7 @@ 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 969ea16..0149bf4 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -2462,16 +2462,18 @@ IPC_BEGIN_MESSAGES(ViewHost) ViewHostMsg_IDBIndexOpenCursor_Params) // WebIDBIndex::getObject() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBIndexGetObject, + IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBIndexGetObject, int32, /* idb_index_id */ int32, /* response_id */ - IndexedDBKey /* key */) + IndexedDBKey, /* key */ + int /* transaction_id */) // WebIDBIndex::get() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBIndexGet, + IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBIndexGet, int32, /* idb_index_id */ int32, /* response_id */ - IndexedDBKey /* key */) + IndexedDBKey, /* key */ + int /* transaction_id */) // WebIDBIndex::~WebIDBIndex() message. IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBIndexDestroyed, @@ -2493,24 +2495,22 @@ IPC_BEGIN_MESSAGES(ViewHost) std::vector<string16> /* index_names */) // WebIDBObjectStore::get() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBObjectStoreGet, + IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBObjectStoreGet, int32, /* idb_object_store_id */ int32, /* response_id */ - IndexedDBKey /* key */) + IndexedDBKey, /* key */ + int /* transaction_id */) // WebIDBObjectStore::put() message. - IPC_MESSAGE_CONTROL5(ViewHostMsg_IDBObjectStorePut, - int32, /* idb_object_store_id */ - int32, /* response_id */ - SerializedScriptValue, /* serialized_value */ - IndexedDBKey, /* key */ - bool /* add_only */) + IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBObjectStorePut, + ViewHostMsg_IDBObjectStorePut_Params) // WebIDBObjectStore::remove() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBObjectStoreRemove, + IPC_MESSAGE_CONTROL4(ViewHostMsg_IDBObjectStoreRemove, int32, /* idb_object_store_id */ int32, /* response_id */ - IndexedDBKey /* key */) + IndexedDBKey, /* key */ + int /* transaction_id */) // 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 4fd83a3..bcd47f6 100644 --- a/chrome/common/render_messages_params.cc +++ b/chrome/common/render_messages_params.cc @@ -181,31 +181,20 @@ ViewHostMsg_IDBFactoryOpen_Params::~ViewHostMsg_IDBFactoryOpen_Params() { ViewHostMsg_IDBDatabaseCreateObjectStore_Params:: ViewHostMsg_IDBDatabaseCreateObjectStore_Params() : response_id_(0), - auto_increment_(false), - idb_database_id_(0) { + auto_increment_(false) { } 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) { + idb_object_store_id_(0), + transaction_id_(0) { } ViewHostMsg_IDBObjectStoreOpenCursor_Params:: @@ -1270,6 +1259,7 @@ 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( @@ -1282,7 +1272,8 @@ 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->idb_index_id_) && + ReadParam(m, iter, &p->transaction_id_); } void ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Log( @@ -1300,6 +1291,50 @@ 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(")"); } @@ -1350,6 +1385,7 @@ 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( @@ -1362,7 +1398,8 @@ 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->idb_object_store_id_) && + ReadParam(m, iter, &p->transaction_id_); } void ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Log( @@ -1380,6 +1417,8 @@ 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 70f9825..05c2d7e 100644 --- a/chrome/common/render_messages_params.h +++ b/chrome/common/render_messages_params.h @@ -25,6 +25,7 @@ #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" @@ -671,13 +672,34 @@ 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_; @@ -716,6 +738,9 @@ 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. @@ -1141,6 +1166,14 @@ 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); |