Index: content/common/indexed_db/indexed_db_dispatcher.cc |
diff --git a/content/common/indexed_db/indexed_db_dispatcher.cc b/content/common/indexed_db/indexed_db_dispatcher.cc |
index 7e190c28fded636f62543acb93162e94d1516334..9886188ae2e8fccd8f0c07ed18610bbe86ed886a 100644 |
--- a/content/common/indexed_db/indexed_db_dispatcher.cc |
+++ b/content/common/indexed_db/indexed_db_dispatcher.cc |
@@ -18,6 +18,7 @@ |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseException.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h" |
using WebKit::WebDOMStringList; |
using WebKit::WebData; |
@@ -131,12 +132,20 @@ WebIDBMetadata IndexedDBDispatcher::ConvertMetadata( |
void IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { |
bool handled = true; |
IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg) |
+ IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursorOld, |
+ OnSuccessOpenCursorOld) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursor, |
OnSuccessOpenCursor) |
+ IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorAdvanceOld, |
+ OnSuccessCursorContinueOld) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorAdvance, |
OnSuccessCursorContinue) |
+ IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorContinueOld, |
+ OnSuccessCursorContinueOld) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorContinue, |
OnSuccessCursorContinue) |
+ IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorPrefetchOld, |
+ OnSuccessCursorPrefetchOld) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorPrefetch, |
OnSuccessCursorPrefetch) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBDatabase, |
@@ -147,8 +156,12 @@ void IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { |
OnSuccessStringList) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, |
OnSuccessSerializedScriptValue) |
+ IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessValue, |
+ OnSuccessValue) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKey, |
OnSuccessSerializedScriptValueWithKey) |
+ IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessValueWithKey, |
+ OnSuccessValueWithKey) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessInteger, |
OnSuccessInteger) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessUndefined, |
@@ -576,6 +589,20 @@ void IndexedDBDispatcher::OnSuccessSerializedScriptValue( |
pending_callbacks_.Remove(ipc_response_id); |
} |
+void IndexedDBDispatcher::OnSuccessValue( |
+ int32 ipc_thread_id, int32 ipc_response_id, |
+ const std::vector<char>& value) { |
+ DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
+ WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
+ if (!callbacks) |
+ return; |
+ WebData web_value; |
+ if (value.size()) |
+ web_value.assign(&value.front(), value.size()); |
+ callbacks->onSuccess(web_value); |
+ pending_callbacks_.Remove(ipc_response_id); |
+} |
+ |
void IndexedDBDispatcher::OnSuccessSerializedScriptValueWithKey( |
int32 ipc_thread_id, int32 ipc_response_id, |
const SerializedScriptValue& value, |
@@ -590,6 +617,23 @@ void IndexedDBDispatcher::OnSuccessSerializedScriptValueWithKey( |
pending_callbacks_.Remove(ipc_response_id); |
} |
+void IndexedDBDispatcher::OnSuccessValueWithKey( |
+ int32 ipc_thread_id, int32 ipc_response_id, |
+ const std::vector<char>& value, |
+ const IndexedDBKey& primary_key, |
+ const IndexedDBKeyPath& key_path) { |
+ DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
+ WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
+ if (!callbacks) |
+ return; |
+ WebData web_value; |
+ if (value.size()) |
+ web_value.assign(&value.front(), value.size()); |
+ callbacks->onSuccess(web_value, |
+ primary_key, key_path); |
+ pending_callbacks_.Remove(ipc_response_id); |
+} |
+ |
void IndexedDBDispatcher::OnSuccessInteger( |
int32 ipc_thread_id, int32 ipc_response_id, int64 value) { |
DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
@@ -610,8 +654,8 @@ void IndexedDBDispatcher::OnSuccessUndefined( |
pending_callbacks_.Remove(ipc_response_id); |
} |
-void IndexedDBDispatcher::OnSuccessOpenCursor( |
- const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) { |
+void IndexedDBDispatcher::OnSuccessOpenCursorOld( |
+ const IndexedDBMsg_CallbacksSuccessIDBCursorOld_Params& p) { |
DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
int32 ipc_response_id = p.ipc_response_id; |
int32 ipc_object_id = p.ipc_cursor_id; |
@@ -633,8 +677,32 @@ void IndexedDBDispatcher::OnSuccessOpenCursor( |
pending_callbacks_.Remove(ipc_response_id); |
} |
-void IndexedDBDispatcher::OnSuccessCursorContinue( |
- const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) { |
+void IndexedDBDispatcher::OnSuccessOpenCursor( |
+ const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) { |
+ DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
+ int32 ipc_response_id = p.ipc_response_id; |
+ int32 ipc_object_id = p.ipc_cursor_id; |
+ const IndexedDBKey& key = p.key; |
+ const IndexedDBKey& primary_key = p.primary_key; |
+ WebData web_value; |
+ if (p.value.size()) |
+ web_value.assign(&p.value.front(), p.value.size()); |
+ |
+ WebIDBCallbacks* callbacks = |
+ pending_callbacks_.Lookup(ipc_response_id); |
+ if (!callbacks) |
+ return; |
+ |
+ RendererWebIDBCursorImpl* cursor = |
+ new RendererWebIDBCursorImpl(ipc_object_id); |
+ cursors_[ipc_object_id] = cursor; |
+ callbacks->onSuccess(cursor, key, primary_key, web_value); |
+ |
+ pending_callbacks_.Remove(ipc_response_id); |
+} |
+ |
+void IndexedDBDispatcher::OnSuccessCursorContinueOld( |
+ const IndexedDBMsg_CallbacksSuccessCursorContinueOld_Params& p) { |
DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
int32 ipc_response_id = p.ipc_response_id; |
int32 ipc_cursor_id = p.ipc_cursor_id; |
@@ -655,6 +723,48 @@ void IndexedDBDispatcher::OnSuccessCursorContinue( |
pending_callbacks_.Remove(ipc_response_id); |
} |
+void IndexedDBDispatcher::OnSuccessCursorContinue( |
+ const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) { |
+ DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
+ int32 ipc_response_id = p.ipc_response_id; |
+ int32 ipc_cursor_id = p.ipc_cursor_id; |
+ const IndexedDBKey& key = p.key; |
+ const IndexedDBKey& primary_key = p.primary_key; |
+ const std::vector<char>& value = p.value; |
+ |
+ RendererWebIDBCursorImpl* cursor = cursors_[ipc_cursor_id]; |
+ DCHECK(cursor); |
+ |
+ WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
+ if (!callbacks) |
+ return; |
+ |
+ WebData web_value; |
+ if (value.size()) |
+ web_value.assign(&value.front(), value.size()); |
+ callbacks->onSuccess(key, primary_key, web_value); |
+ |
+ pending_callbacks_.Remove(ipc_response_id); |
+} |
+ |
+void IndexedDBDispatcher::OnSuccessCursorPrefetchOld( |
+ const IndexedDBMsg_CallbacksSuccessCursorPrefetchOld_Params& p) { |
+ DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
+ int32 ipc_response_id = p.ipc_response_id; |
+ int32 ipc_cursor_id = p.ipc_cursor_id; |
+ const std::vector<IndexedDBKey>& keys = p.keys; |
+ const std::vector<IndexedDBKey>& primary_keys = p.primary_keys; |
+ const std::vector<SerializedScriptValue>& values = p.values; |
+ RendererWebIDBCursorImpl* cursor = cursors_[ipc_cursor_id]; |
+ DCHECK(cursor); |
+ cursor->SetPrefetchDataOld(keys, primary_keys, values); |
+ |
+ WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
+ DCHECK(callbacks); |
+ cursor->CachedContinueOld(callbacks); |
+ pending_callbacks_.Remove(ipc_response_id); |
+} |
+ |
void IndexedDBDispatcher::OnSuccessCursorPrefetch( |
const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) { |
DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
@@ -662,7 +772,11 @@ void IndexedDBDispatcher::OnSuccessCursorPrefetch( |
int32 ipc_cursor_id = p.ipc_cursor_id; |
const std::vector<IndexedDBKey>& keys = p.keys; |
const std::vector<IndexedDBKey>& primary_keys = p.primary_keys; |
- const std::vector<SerializedScriptValue>& values = p.values; |
+ std::vector<WebData> values(p.values.size()); |
+ for (size_t i = 0; i < p.values.size(); ++i) { |
+ if (p.values[i].size()) |
+ values[i].assign(&p.values[i].front(), p.values[i].size()); |
+ } |
RendererWebIDBCursorImpl* cursor = cursors_[ipc_cursor_id]; |
DCHECK(cursor); |
cursor->SetPrefetchData(keys, primary_keys, values); |