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

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

Issue 12217049: Proxy WebData-based WebIDBDatabase::put (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_dispatcher_host.cc
diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
index c5549c8699dfa35d3ad78cbaecd9caa2e2290b74..3f8190bd447f08e93739a9a6a11b210f095f3d52 100644
--- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -21,6 +21,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
#include "googleurl/src/gurl.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebData.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h"
@@ -342,6 +343,7 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived(
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseGet, OnGet)
+ IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabasePutOld, OnPutOld)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabasePut, OnPut)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetIndexKeys,
OnSetIndexKeys)
@@ -460,8 +462,8 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnGet(
params.key_range, params.key_only, callbacks.release());
}
-void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut(
- const IndexedDBHostMsg_DatabasePut_Params& params) {
+void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPutOld(
+ const IndexedDBHostMsg_DatabasePutOld_Params& params) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
WebIDBDatabase* database = parent_->GetOrTerminateProcess(
@@ -487,6 +489,33 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut(
(*map)[host_transaction_id] += params.value.size();
}
+void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut(
+ const IndexedDBHostMsg_DatabasePut_Params& params) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
+
+ WebIDBDatabase* database = parent_->GetOrTerminateProcess(
+ &map_, params.ipc_database_id);
+ if (!database)
+ return;
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<WebIDBKey>(parent_, params.ipc_thread_id,
+ params.ipc_response_id));
+
+ WebKit::WebData value(params.value);
jsbell 2013/02/07 00:06:07 In .cc files we typically add a "using" line near
+ int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id);
+ database->put(host_transaction_id,
+ params.object_store_id,
+ value, params.key,
+ params.put_mode, callbacks.release(),
+ params.index_ids,
+ params.index_keys);
+ WebIDBTransactionIDToSizeMap* map =
+ &parent_->database_dispatcher_host_->transaction_size_map_;
+ // Size can't be big enough to overflow because it represents the
+ // actual bytes passed through IPC.
+ (*map)[host_transaction_id] += params.value.size();
+}
+
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetIndexKeys(
const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));

Powered by Google App Engine
This is Rietveld 408576698