Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: content/browser/in_process_webkit/indexed_db_callbacks.cc

Issue 12326023: Proxy new WebData-based onSuccess() calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more .data()-related android bustage Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/in_process_webkit/indexed_db_callbacks.cc
diff --git a/content/browser/in_process_webkit/indexed_db_callbacks.cc b/content/browser/in_process_webkit/indexed_db_callbacks.cc
index 4f7fe94f38e506c3441c08c717342e8cfa9f0d1d..10950f2554a4e910403906ad6f29827eda3e1b1e 100644
--- a/content/browser/in_process_webkit/indexed_db_callbacks.cc
+++ b/content/browser/in_process_webkit/indexed_db_callbacks.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "content/common/indexed_db/indexed_db_messages.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h"
#include "webkit/quota/quota_manager.h"
namespace content {
@@ -93,13 +94,30 @@ void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
const WebKit::WebIDBKey& primaryKey,
const WebKit::WebSerializedScriptValue& value) {
int32 ipc_object_id = dispatcher_host()->Add(idb_cursor);
- IndexedDBMsg_CallbacksSuccessIDBCursor_Params params;
+ IndexedDBMsg_CallbacksSuccessIDBCursorOld_Params params;
params.ipc_thread_id = ipc_thread_id();
params.ipc_response_id = ipc_response_id();
params.ipc_cursor_id = ipc_object_id;
params.key = IndexedDBKey(key);
params.primary_key = IndexedDBKey(primaryKey);
params.serialized_value = SerializedScriptValue(value);
+ dispatcher_host()->Send(
+ new IndexedDBMsg_CallbacksSuccessIDBCursorOld(params));
+}
+
+void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
+ WebKit::WebIDBCursor* idb_cursor,
+ const WebKit::WebIDBKey& key,
+ const WebKit::WebIDBKey& primaryKey,
+ const WebKit::WebData& value) {
+ int32 ipc_object_id = dispatcher_host()->Add(idb_cursor);
+ IndexedDBMsg_CallbacksSuccessIDBCursor_Params params;
+ params.ipc_thread_id = ipc_thread_id();
+ params.ipc_response_id = ipc_response_id();
+ params.ipc_cursor_id = ipc_object_id;
+ params.key = IndexedDBKey(key);
+ params.primary_key = IndexedDBKey(primaryKey);
+ params.value.assign(value.data(), value.data() + value.size());
dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(params));
}
@@ -111,6 +129,14 @@ void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
}
void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
+ const WebKit::WebData& webValue) {
+ std::vector<char> value(webValue.data(), webValue.data() + webValue.size());
+ dispatcher_host()->Send(
+ new IndexedDBMsg_CallbacksSuccessValue(
+ ipc_thread_id(), ipc_response_id(), value));
+}
+
+void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
const WebKit::WebIDBKey& key,
const WebKit::WebIDBKey& primaryKey,
const WebKit::WebSerializedScriptValue& value) {
@@ -121,7 +147,7 @@ void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
DCHECK(idb_cursor);
if (!idb_cursor)
return;
- IndexedDBMsg_CallbacksSuccessCursorContinue_Params params;
+ IndexedDBMsg_CallbacksSuccessCursorContinueOld_Params params;
params.ipc_thread_id = ipc_thread_id();
params.ipc_response_id = ipc_response_id();
params.ipc_cursor_id = ipc_cursor_id_;
@@ -129,6 +155,28 @@ void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
params.primary_key = IndexedDBKey(primaryKey);
params.serialized_value = SerializedScriptValue(value);
dispatcher_host()->Send(
+ new IndexedDBMsg_CallbacksSuccessCursorContinueOld(params));
+}
+
+void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
+ const WebKit::WebIDBKey& key,
+ const WebKit::WebIDBKey& primaryKey,
+ const WebKit::WebData& value) {
+ DCHECK_NE(ipc_cursor_id_, -1);
+ WebKit::WebIDBCursor* idb_cursor = dispatcher_host()->GetCursorFromId(
+ ipc_cursor_id_);
+
+ DCHECK(idb_cursor);
+ if (!idb_cursor)
+ return;
+ IndexedDBMsg_CallbacksSuccessCursorContinue_Params params;
+ params.ipc_thread_id = ipc_thread_id();
+ params.ipc_response_id = ipc_response_id();
+ params.ipc_cursor_id = ipc_cursor_id_;
+ params.key = IndexedDBKey(key);
+ params.primary_key = IndexedDBKey(primaryKey);
+ params.value.assign(value.data(), value.data() + value.size());
+ dispatcher_host()->Send(
new IndexedDBMsg_CallbacksSuccessCursorContinue(params));
}
@@ -148,6 +196,35 @@ void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithPrefetch(
msgValues.push_back(SerializedScriptValue(values[i]));
}
+ IndexedDBMsg_CallbacksSuccessCursorPrefetchOld_Params params;
+ params.ipc_thread_id = ipc_thread_id();
+ params.ipc_response_id = ipc_response_id();
+ params.ipc_cursor_id = ipc_cursor_id_;
+ params.keys = msgKeys;
+ params.primary_keys = msgPrimaryKeys;
+ params.values = msgValues;
+ dispatcher_host()->Send(
+ new IndexedDBMsg_CallbacksSuccessCursorPrefetchOld(params));
+}
+
+void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithPrefetch(
+ const WebKit::WebVector<WebKit::WebIDBKey>& keys,
+ const WebKit::WebVector<WebKit::WebIDBKey>& primaryKeys,
+ const WebKit::WebVector<WebKit::WebData>& values) {
+ DCHECK_NE(ipc_cursor_id_, -1);
+
+ std::vector<IndexedDBKey> msgKeys;
+ std::vector<IndexedDBKey> msgPrimaryKeys;
+ std::vector<std::vector<char> > msgValues;
+
+ for (size_t i = 0; i < keys.size(); ++i) {
+ msgKeys.push_back(IndexedDBKey(keys[i]));
+ msgPrimaryKeys.push_back(IndexedDBKey(primaryKeys[i]));
+ msgValues.push_back(
+ std::vector<char>(values[i].data(),
+ values[i].data() + values[i].size()));
+ }
+
IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params params;
params.ipc_thread_id = ipc_thread_id();
params.ipc_response_id = ipc_response_id();
@@ -178,14 +255,22 @@ void IndexedDBCallbacks<WebKit::WebDOMStringList>::onSuccess(
ipc_thread_id(), ipc_response_id(), list));
}
-void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess(
+void IndexedDBCallbacks<WebKit::WebData>::onSuccess(
const WebKit::WebSerializedScriptValue& value) {
dispatcher_host()->Send(
new IndexedDBMsg_CallbacksSuccessSerializedScriptValue(
ipc_thread_id(), ipc_response_id(), SerializedScriptValue(value)));
}
-void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess(
+void IndexedDBCallbacks<WebKit::WebData>::onSuccess(
+ const WebKit::WebData& value) {
+ dispatcher_host()->Send(
+ new IndexedDBMsg_CallbacksSuccessValue(
+ ipc_thread_id(), ipc_response_id(),
+ std::vector<char>(value.data(), value.data() + value.size())));
+}
+
+void IndexedDBCallbacks<WebKit::WebData>::onSuccess(
const WebKit::WebSerializedScriptValue& value,
const WebKit::WebIDBKey& primaryKey,
const WebKit::WebIDBKeyPath& keyPath) {
@@ -195,7 +280,18 @@ void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess(
IndexedDBKey(primaryKey), IndexedDBKeyPath(keyPath)));
}
-void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess(
+void IndexedDBCallbacks<WebKit::WebData>::onSuccess(
+ const WebKit::WebData& value,
+ const WebKit::WebIDBKey& primaryKey,
+ const WebKit::WebIDBKeyPath& keyPath) {
+ dispatcher_host()->Send(
+ new IndexedDBMsg_CallbacksSuccessValueWithKey(
+ ipc_thread_id(), ipc_response_id(),
+ std::vector<char>(value.data(), value.data() + value.size()),
+ IndexedDBKey(primaryKey), IndexedDBKeyPath(keyPath)));
+}
+
+void IndexedDBCallbacks<WebKit::WebData>::onSuccess(
long long value) {
dispatcher_host()->Send(
new IndexedDBMsg_CallbacksSuccessInteger(ipc_thread_id(),
@@ -203,13 +299,13 @@ void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess(
value));
}
-void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess() {
+void IndexedDBCallbacks<WebKit::WebData>::onSuccess() {
dispatcher_host()->Send(
new IndexedDBMsg_CallbacksSuccessUndefined(ipc_thread_id(),
ipc_response_id()));
}
-void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess(
+void IndexedDBCallbacks<WebKit::WebData>::onSuccess(
const WebKit::WebIDBKey& value) {
dispatcher_host()->Send(
new IndexedDBMsg_CallbacksSuccessIndexedDBKey(

Powered by Google App Engine
This is Rietveld 408576698