summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-02 16:50:42 +0000
committerhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-02 16:50:42 +0000
commit2758531ff10c3e0b1141fa34fc9bb18838079a4e (patch)
tree55141f7406e66adef6101095a668041f96806c21
parent45be8ec632f31d816a93e01d03dd1a676ab553cd (diff)
downloadchromium_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
-rw-r--r--chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc2
-rw-r--r--chrome/common/indexed_db_messages.cc32
-rw-r--r--chrome/common/indexed_db_messages.h13
-rw-r--r--chrome/renderer/indexed_db_dispatcher.cc4
-rw-r--r--chrome/renderer/indexed_db_dispatcher.h3
-rw-r--r--chrome/renderer/renderer_webidbobjectstore_impl.cc4
-rw-r--r--chrome/renderer/renderer_webidbobjectstore_impl.h2
7 files changed, 47 insertions, 13 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 de75674..ddc9327 100644
--- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -658,7 +658,7 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut(
*ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id));
- idb_object_store->put(params.serialized_value, params.key, params.add_only,
+ idb_object_store->put(params.serialized_value, params.key, params.put_mode,
callbacks.release(), *idb_transaction, *ec);
}
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.
diff --git a/chrome/renderer/indexed_db_dispatcher.cc b/chrome/renderer/indexed_db_dispatcher.cc
index 41cd38d..d425b41 100644
--- a/chrome/renderer/indexed_db_dispatcher.cc
+++ b/chrome/renderer/indexed_db_dispatcher.cc
@@ -239,7 +239,7 @@ void IndexedDBDispatcher::RequestIDBObjectStoreGet(
void IndexedDBDispatcher::RequestIDBObjectStorePut(
const SerializedScriptValue& value,
const IndexedDBKey& key,
- bool add_only,
+ WebKit::WebIDBObjectStore::PutMode put_mode,
WebIDBCallbacks* callbacks_ptr,
int32 idb_object_store_id,
const WebIDBTransaction& transaction,
@@ -250,7 +250,7 @@ void IndexedDBDispatcher::RequestIDBObjectStorePut(
params.response_id = pending_callbacks_.Add(callbacks.release());
params.serialized_value = value;
params.key = key;
- params.add_only = add_only;
+ params.put_mode = put_mode;
params.transaction_id = TransactionId(transaction);
RenderThread::current()->Send(new IndexedDBHostMsg_ObjectStorePut(
params, ec));
diff --git a/chrome/renderer/indexed_db_dispatcher.h b/chrome/renderer/indexed_db_dispatcher.h
index 44da3d4..4f5dc44 100644
--- a/chrome/renderer/indexed_db_dispatcher.h
+++ b/chrome/renderer/indexed_db_dispatcher.h
@@ -12,6 +12,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCallbacks.h"
class IndexedDBKey;
@@ -98,7 +99,7 @@ class IndexedDBDispatcher : public IPC::Channel::Listener {
void RequestIDBObjectStorePut(const SerializedScriptValue& value,
const IndexedDBKey& key,
- bool add_only,
+ WebKit::WebIDBObjectStore::PutMode putMode,
WebKit::WebIDBCallbacks* callbacks,
int32 idb_object_store_id,
const WebKit::WebIDBTransaction& transaction,
diff --git a/chrome/renderer/renderer_webidbobjectstore_impl.cc b/chrome/renderer/renderer_webidbobjectstore_impl.cc
index 41c96ca..c2bc011 100644
--- a/chrome/renderer/renderer_webidbobjectstore_impl.cc
+++ b/chrome/renderer/renderer_webidbobjectstore_impl.cc
@@ -83,14 +83,14 @@ void RendererWebIDBObjectStoreImpl::get(
void RendererWebIDBObjectStoreImpl::put(
const WebSerializedScriptValue& value,
const WebIDBKey& key,
- bool add_only,
+ PutMode put_mode,
WebIDBCallbacks* callbacks,
const WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
RenderThread::current()->indexed_db_dispatcher();
dispatcher->RequestIDBObjectStorePut(
- SerializedScriptValue(value), IndexedDBKey(key), add_only, callbacks,
+ SerializedScriptValue(value), IndexedDBKey(key), put_mode, callbacks,
idb_object_store_id_, transaction, &ec);
}
diff --git a/chrome/renderer/renderer_webidbobjectstore_impl.h b/chrome/renderer/renderer_webidbobjectstore_impl.h
index c6897f6..e1be85a 100644
--- a/chrome/renderer/renderer_webidbobjectstore_impl.h
+++ b/chrome/renderer/renderer_webidbobjectstore_impl.h
@@ -35,7 +35,7 @@ class RendererWebIDBObjectStoreImpl : public WebKit::WebIDBObjectStore {
WebKit::WebExceptionCode& ec);
virtual void put(const WebKit::WebSerializedScriptValue& value,
const WebKit::WebIDBKey& key,
- bool add_only,
+ PutMode put_mode,
WebKit::WebIDBCallbacks* callbacks,
const WebKit::WebIDBTransaction& transaction,
WebKit::WebExceptionCode& ec);