summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-23 10:47:00 +0000
committerjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-23 10:47:00 +0000
commit2e21b5e7458998a0d01bc6f3797c0e3e64e8294e (patch)
treece45a96cbc53cfc6a30fc58df00959874386c39b /chrome/browser
parentcb40fd2e6057b3d6b1fa4329b4fdffb9c271cc93 (diff)
downloadchromium_src-2e21b5e7458998a0d01bc6f3797c0e3e64e8294e.zip
chromium_src-2e21b5e7458998a0d01bc6f3797c0e3e64e8294e.tar.gz
chromium_src-2e21b5e7458998a0d01bc6f3797c0e3e64e8294e.tar.bz2
Add the transaction id plumbing to IndexedDB.
TEST=none BUG=none Review URL: http://codereview.chromium.org/3478003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc125
-rw-r--r--chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h23
2 files changed, 101 insertions, 47 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 292bbc0..91b0325 100644
--- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -33,6 +33,7 @@
#include "webkit/glue/webkit_glue.h"
using WebKit::WebDOMStringList;
+using WebKit::WebIDBCallbacks;
using WebKit::WebIDBCursor;
using WebKit::WebIDBDatabase;
using WebKit::WebIDBDatabaseError;
@@ -558,52 +559,75 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenObjectCursor(
const ViewHostMsg_IDBIndexOpenCursor_Params& params) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
- &parent_->index_dispatcher_host_->map_,
- params.idb_index_id_, NULL,
+ &map_, params.idb_index_id_, NULL,
ViewHostMsg_IDBIndexOpenObjectCursor::ID);
- if (!idb_index)
+ WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
+ &parent_->transaction_dispatcher_host_->map_,
+ params.transaction_id_, NULL, ViewHostMsg_IDBIndexOpenObjectCursor::ID);
+ if (!idb_transaction || !idb_index)
return;
+
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_));
idb_index->openObjectCursor(
WebIDBKeyRange(params.left_key_, params.right_key_, params.key_flags_),
- params.direction_,
- new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_));
+ params.direction_, callbacks.release(), *idb_transaction);
}
void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenCursor(
const ViewHostMsg_IDBIndexOpenCursor_Params& params) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
- &parent_->index_dispatcher_host_->map_,
- params.idb_index_id_, NULL,
- ViewHostMsg_IDBIndexOpenCursor::ID);
- if (!idb_index)
+ &map_, params.idb_index_id_, NULL, ViewHostMsg_IDBIndexOpenCursor::ID);
+ WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
+ &parent_->transaction_dispatcher_host_->map_, params.transaction_id_,
+ NULL, ViewHostMsg_IDBIndexOpenCursor::ID);
+ if (!idb_transaction || !idb_index)
return;
+
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_));
idb_index->openCursor(
WebIDBKeyRange(params.left_key_, params.right_key_, params.key_flags_),
- params.direction_,
- new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_));
+ params.direction_, callbacks.release(), *idb_transaction);
}
void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject(
- int idb_index_id, int32 response_id, const IndexedDBKey& key) {
+ int idb_index_id,
+ int32 response_id,
+ const IndexedDBKey& key,
+ int transaction_id) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
&map_, idb_index_id, NULL, ViewHostMsg_IDBIndexGetObject::ID);
- if (!idb_index)
+ WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
+ &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL,
+ ViewHostMsg_IDBIndexGetObject::ID);
+ if (!idb_transaction || !idb_index)
return;
- idb_index->getObject(key, new IndexedDBCallbacks<WebSerializedScriptValue>(
- parent_, response_id));
+
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id));
+ idb_index->getObject(key, callbacks.release(), *idb_transaction);
}
void IndexedDBDispatcherHost::IndexDispatcherHost::OnGet(
- int idb_index_id, int32 response_id, const IndexedDBKey& key) {
+ int idb_index_id,
+ int32 response_id,
+ const IndexedDBKey& key,
+ int transaction_id) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
&map_, idb_index_id, NULL, ViewHostMsg_IDBIndexGet::ID);
- if (!idb_index)
+ WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
+ &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL,
+ ViewHostMsg_IDBIndexGet::ID);
+ if (!idb_transaction || !idb_index)
return;
- idb_index->get(key, new IndexedDBCallbacks<WebSerializedScriptValue>(
- parent_, response_id));
+
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id));
+ idb_index->get(key, callbacks.release(), *idb_transaction);
}
void IndexedDBDispatcherHost::IndexDispatcherHost::OnDestroyed(
@@ -686,39 +710,59 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames(
}
void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet(
- int idb_object_store_id, int32 response_id, const IndexedDBKey& key) {
+ int idb_object_store_id,
+ int32 response_id,
+ const IndexedDBKey& key,
+ int transaction_id) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
&map_, idb_object_store_id, NULL, ViewHostMsg_IDBObjectStoreGet::ID);
- if (!idb_object_store)
+ WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
+ &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL,
+ ViewHostMsg_IDBObjectStoreGet::ID);
+ if (!idb_transaction || !idb_object_store)
return;
- idb_object_store->get(key, new IndexedDBCallbacks<WebSerializedScriptValue>(
- parent_, response_id));
+
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id));
+ idb_object_store->get(key, callbacks.release(), *idb_transaction);
}
void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut(
- int idb_object_store_id, int32 response_id,
- const SerializedScriptValue& value, const IndexedDBKey& key,
- bool add_only) {
+ const ViewHostMsg_IDBObjectStorePut_Params& params) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
- &map_, idb_object_store_id, NULL, ViewHostMsg_IDBObjectStorePut::ID);
- if (!idb_object_store)
+ &map_, params.idb_object_store_id_, NULL,
+ ViewHostMsg_IDBObjectStorePut::ID);
+ WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
+ &parent_->transaction_dispatcher_host_->map_, params.transaction_id_,
+ NULL, ViewHostMsg_IDBObjectStorePut::ID);
+ if (!idb_transaction || !idb_object_store)
return;
- idb_object_store->put(
- value, key, add_only, new IndexedDBCallbacks<WebIDBKey>(
- parent_, response_id));
+
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id_));
+ idb_object_store->put(params.serialized_value_, params.key_, params.add_only_,
+ callbacks.release(), *idb_transaction);
}
void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnRemove(
- int idb_object_store_id, int32 response_id, const IndexedDBKey& key) {
+ int idb_object_store_id,
+ int32 response_id,
+ const IndexedDBKey& key,
+ int transaction_id) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
&map_, idb_object_store_id, NULL, ViewHostMsg_IDBObjectStoreRemove::ID);
- if (!idb_object_store)
+ WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
+ &parent_->transaction_dispatcher_host_->map_, transaction_id, NULL,
+ ViewHostMsg_IDBObjectStoreRemove::ID);
+ if (!idb_transaction || !idb_object_store)
return;
- idb_object_store->remove(key, new IndexedDBCallbacks<void>(parent_,
- response_id));
+
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<void>(parent_, response_id));
+ idb_object_store->remove(key, callbacks.release(), *idb_transaction);
}
void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCreateIndex(
@@ -768,12 +812,17 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnOpenCursor(
&parent_->object_store_dispatcher_host_->map_,
params.idb_object_store_id_, NULL,
ViewHostMsg_IDBObjectStoreOpenCursor::ID);
- if (!idb_object_store)
+ WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
+ &parent_->transaction_dispatcher_host_->map_, params.transaction_id_,
+ NULL, ViewHostMsg_IDBObjectStoreOpenCursor::ID);
+ if (!idb_transaction || !idb_object_store)
return;
+
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_));
idb_object_store->openCursor(
WebIDBKeyRange(params.left_key_, params.right_key_, params.flags_),
- params.direction_,
- new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id_));
+ params.direction_, callbacks.release(), *idb_transaction);
}
void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed(
diff --git a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h
index 654b3ab..982c861 100644
--- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h
+++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h
@@ -22,6 +22,7 @@ struct ViewHostMsg_IDBFactoryOpen_Params;
struct ViewHostMsg_IDBIndexOpenCursor_Params;
struct ViewHostMsg_IDBObjectStoreCreateIndex_Params;
struct ViewHostMsg_IDBObjectStoreOpenCursor_Params;
+struct ViewHostMsg_IDBObjectStorePut_Params;
namespace WebKit {
class WebIDBCursor;
@@ -137,10 +138,12 @@ class IndexedDBDispatcherHost
void OnOpenCursor(const ViewHostMsg_IDBIndexOpenCursor_Params& params);
void OnGetObject(int idb_index_id,
int32 response_id,
- const IndexedDBKey& key);
+ const IndexedDBKey& key,
+ int transaction_id);
void OnGet(int idb_index_id,
int32 response_id,
- const IndexedDBKey& key);
+ const IndexedDBKey& key,
+ int transaction_id);
void OnDestroyed(int32 idb_index_id);
IndexedDBDispatcherHost* parent_;
@@ -158,13 +161,15 @@ class IndexedDBDispatcherHost
void OnName(int32 idb_object_store_id, IPC::Message* reply_msg);
void OnKeyPath(int32 idb_object_store_id, IPC::Message* reply_msg);
void OnIndexNames(int32 idb_object_store_id, IPC::Message* reply_msg);
- void OnGet(int idb_object_store_id, int32 response_id,
- const IndexedDBKey& key);
- void OnPut(int idb_object_store_id, int32 response_id,
- const SerializedScriptValue& value, const IndexedDBKey& key,
- bool add_only);
- void OnRemove(int idb_object_store_id, int32 response_id,
- const IndexedDBKey& key);
+ void OnGet(int idb_object_store_id,
+ int32 response_id,
+ const IndexedDBKey& key,
+ int transaction_id);
+ void OnPut(const ViewHostMsg_IDBObjectStorePut_Params& params);
+ void OnRemove(int idb_object_store_id,
+ int32 response_id,
+ const IndexedDBKey& key,
+ int transaction_id);
void OnCreateIndex(
const ViewHostMsg_IDBObjectStoreCreateIndex_Params& params);
void OnIndex(int32 idb_object_store_id, const string16& name,