diff options
author | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-02 16:50:42 +0000 |
---|---|---|
committer | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-02 16:50:42 +0000 |
commit | 2758531ff10c3e0b1141fa34fc9bb18838079a4e (patch) | |
tree | 55141f7406e66adef6101095a668041f96806c21 /chrome/common | |
parent | 45be8ec632f31d816a93e01d03dd1a676ab553cd (diff) | |
download | chromium_src-2758531ff10c3e0b1141fa34fc9bb18838079a4e.zip chromium_src-2758531ff10c3e0b1141fa34fc9bb18838079a4e.tar.gz chromium_src-2758531ff10c3e0b1141fa34fc9bb18838079a4e.tar.bz2 |
IndexedDB: Update calls to WebIDBObjectStore::put().
The put() function has been updated to take a PutMode parameter rather
than the addOnly bool. Update calls, and ship the PutMode across IPC.
BUG=64052
TEST=none
Review URL: http://codereview.chromium.org/6250049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/indexed_db_messages.cc | 32 | ||||
-rw-r--r-- | chrome/common/indexed_db_messages.h | 13 |
2 files changed, 39 insertions, 6 deletions
diff --git a/chrome/common/indexed_db_messages.cc b/chrome/common/indexed_db_messages.cc index c7c0e22..fdffbc2 100644 --- a/chrome/common/indexed_db_messages.cc +++ b/chrome/common/indexed_db_messages.cc @@ -46,7 +46,7 @@ IndexedDBHostMsg_ObjectStorePut_Params:: IndexedDBHostMsg_ObjectStorePut_Params() : idb_object_store_id(0), response_id(0), - add_only(false), + put_mode(), transaction_id(0) { } @@ -213,7 +213,7 @@ void ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Write( WriteParam(m, p.response_id); WriteParam(m, p.serialized_value); WriteParam(m, p.key); - WriteParam(m, p.add_only); + WriteParam(m, p.put_mode); WriteParam(m, p.transaction_id); } @@ -226,7 +226,7 @@ bool ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Read( 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->put_mode) && ReadParam(m, iter, &p->transaction_id); } @@ -242,7 +242,7 @@ void ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Log( l->append(", "); LogParam(p.key, l); l->append(", "); - LogParam(p.add_only, l); + LogParam(p.put_mode, l); l->append(", "); LogParam(p.transaction_id, l); l->append(")"); @@ -336,4 +336,28 @@ void ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params>::Log( l->append(")"); } +void ParamTraits<WebKit::WebIDBObjectStore::PutMode>::Write( + Message* m, + const param_type& p) { + WriteParam(m, static_cast<int>(p)); +} + +bool ParamTraits<WebKit::WebIDBObjectStore::PutMode>::Read( + const Message* m, + void** iter, + param_type* p) { + int i; + bool ok = ReadParam(m, iter, &i); + if (!ok) + i = 0; + *p = static_cast<param_type>(i); + return ok; +} + +void ParamTraits<WebKit::WebIDBObjectStore::PutMode>::Log( + const param_type& p, + std::string* l) { + LogParam(static_cast<int>(p), l); +} + } // namespace IPC diff --git a/chrome/common/indexed_db_messages.h b/chrome/common/indexed_db_messages.h index 5742b1f..d3893b0 100644 --- a/chrome/common/indexed_db_messages.h +++ b/chrome/common/indexed_db_messages.h @@ -12,6 +12,7 @@ #include "ipc/ipc_message_macros.h" #include "ipc/ipc_param_traits.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" #define IPC_MESSAGE_START IndexedDBMsgStart @@ -104,8 +105,8 @@ struct IndexedDBHostMsg_ObjectStorePut_Params { // 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; + // Whether this is an add or a put. + WebKit::WebIDBObjectStore::PutMode put_mode; // The transaction it's associated with. int transaction_id; @@ -211,6 +212,14 @@ struct ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params> { static void Log(const param_type& p, std::string* l); }; +template <> +struct ParamTraits<WebKit::WebIDBObjectStore::PutMode> { + typedef WebKit::WebIDBObjectStore::PutMode 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. |