summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-16 02:04:38 +0000
committerdgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-16 02:04:38 +0000
commit31bfae7928aed4a5d350ca2ea7acfd7d258a9eb3 (patch)
tree1129dc3953e764160d52b6dc5618bc7da554fa44
parent0de6c96b65bfbac8e517fc71d2c2bf0e1484697c (diff)
downloadchromium_src-31bfae7928aed4a5d350ca2ea7acfd7d258a9eb3.zip
chromium_src-31bfae7928aed4a5d350ca2ea7acfd7d258a9eb3.tar.gz
chromium_src-31bfae7928aed4a5d350ca2ea7acfd7d258a9eb3.tar.bz2
Async IDB host messages now contain a thread_id corresponding to the requesting thread. The id is 0 for the main thread and >0 for worker threads. The browser process includes the thread_id in its reply, allowing the IO thread in the renderer to look up the right worker thread.
BUG=64054 TEST= Review URL: http://codereview.chromium.org/8747002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114747 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/in_process_webkit/indexed_db_callbacks.cc57
-rw-r--r--content/browser/in_process_webkit/indexed_db_callbacks.h43
-rw-r--r--content/browser/in_process_webkit/indexed_db_database_callbacks.cc6
-rw-r--r--content/browser/in_process_webkit/indexed_db_database_callbacks.h2
-rw-r--r--content/browser/in_process_webkit/indexed_db_dispatcher_host.cc72
-rw-r--r--content/browser/in_process_webkit/indexed_db_dispatcher_host.h23
-rw-r--r--content/browser/in_process_webkit/indexed_db_transaction_callbacks.cc7
-rw-r--r--content/browser/in_process_webkit/indexed_db_transaction_callbacks.h2
-rw-r--r--content/common/indexed_db_messages.h141
-rw-r--r--content/content_renderer.gypi2
-rw-r--r--content/renderer/indexed_db_dispatcher.cc168
-rw-r--r--content/renderer/indexed_db_dispatcher.h74
-rw-r--r--content/renderer/indexed_db_message_filter.cc37
-rw-r--r--content/renderer/indexed_db_message_filter.h28
-rw-r--r--content/renderer/render_thread_impl.cc8
-rw-r--r--content/renderer/render_thread_impl.h6
-rw-r--r--content/renderer/renderer_webidbcursor_impl.cc10
-rw-r--r--content/renderer/renderer_webidbdatabase_impl.cc16
-rw-r--r--content/renderer/renderer_webidbfactory_impl.cc6
-rw-r--r--content/renderer/renderer_webidbindex_impl.cc8
-rw-r--r--content/renderer/renderer_webidbobjectstore_impl.cc10
-rw-r--r--content/renderer/renderer_webidbtransaction_impl.cc2
22 files changed, 506 insertions, 222 deletions
diff --git a/content/browser/in_process_webkit/indexed_db_callbacks.cc b/content/browser/in_process_webkit/indexed_db_callbacks.cc
index 969a430..9dcab25 100644
--- a/content/browser/in_process_webkit/indexed_db_callbacks.cc
+++ b/content/browser/in_process_webkit/indexed_db_callbacks.cc
@@ -9,36 +9,43 @@
IndexedDBCallbacksBase::IndexedDBCallbacksBase(
IndexedDBDispatcherHost* dispatcher_host,
+ int32 thread_id,
int32 response_id)
: dispatcher_host_(dispatcher_host),
- response_id_(response_id) {
+ response_id_(response_id),
+ thread_id_(thread_id) {
}
IndexedDBCallbacksBase::~IndexedDBCallbacksBase() {}
void IndexedDBCallbacksBase::onError(const WebKit::WebIDBDatabaseError& error) {
dispatcher_host_->Send(new IndexedDBMsg_CallbacksError(
- response_id_, error.code(), error.message()));
+ thread_id_, response_id_, error.code(), error.message()));
}
void IndexedDBCallbacksBase::onBlocked() {
- dispatcher_host_->Send(new IndexedDBMsg_CallbacksBlocked(response_id_));
+ dispatcher_host_->Send(new IndexedDBMsg_CallbacksBlocked(thread_id_,
+ response_id_));
}
void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
WebKit::WebIDBCursor* idb_object) {
int32 object_id = dispatcher_host()->Add(idb_object);
- dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(
- response_id(), object_id, IndexedDBKey(idb_object->key()),
- IndexedDBKey(idb_object->primaryKey()),
- content::SerializedScriptValue(idb_object->value())));
+ IndexedDBMsg_CallbacksSuccessIDBCursor_Params params;
+ params.thread_id = thread_id();
+ params.response_id = response_id();
+ params.cursor_id = object_id;
+ params.key = IndexedDBKey(idb_object->key());
+ params.primary_key = IndexedDBKey(idb_object->primaryKey());
+ params.serialized_value = content::SerializedScriptValue(idb_object->value());
+ dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(params));
}
void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
const WebKit::WebSerializedScriptValue& value) {
dispatcher_host()->Send(
new IndexedDBMsg_CallbacksSuccessSerializedScriptValue(
- response_id(), content::SerializedScriptValue(value)));
+ thread_id(), response_id(), content::SerializedScriptValue(value)));
}
void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithContinuation() {
@@ -49,14 +56,16 @@ void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithContinuation() {
DCHECK(idb_cursor);
if (!idb_cursor)
return;
+ IndexedDBMsg_CallbacksSuccessCursorContinue_Params params;
+ params.thread_id = thread_id();
+ params.response_id = response_id();
+ params.cursor_id = cursor_id_;
+ params.key = IndexedDBKey(idb_cursor->key());
+ params.primary_key = IndexedDBKey(idb_cursor->primaryKey());
+ params.serialized_value = content::SerializedScriptValue(idb_cursor->value());
dispatcher_host()->Send(
- new IndexedDBMsg_CallbacksSuccessCursorContinue(
- response_id(),
- cursor_id_,
- IndexedDBKey(idb_cursor->key()),
- IndexedDBKey(idb_cursor->primaryKey()),
- content::SerializedScriptValue(idb_cursor->value())));
+ new IndexedDBMsg_CallbacksSuccessCursorContinue(params));
}
void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithPrefetch(
@@ -75,20 +84,22 @@ void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithPrefetch(
msgValues.push_back(content::SerializedScriptValue(values[i]));
}
+ IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params params;
+ params.thread_id = thread_id();
+ params.response_id = response_id();
+ params.cursor_id = cursor_id_;
+ params.keys = msgKeys;
+ params.primary_keys = msgPrimaryKeys;
+ params.values = msgValues;
dispatcher_host()->Send(
- new IndexedDBMsg_CallbacksSuccessCursorPrefetch(
- response_id(),
- cursor_id_,
- msgKeys,
- msgPrimaryKeys,
- msgValues));
+ new IndexedDBMsg_CallbacksSuccessCursorPrefetch(params));
}
void IndexedDBCallbacks<WebKit::WebIDBKey>::onSuccess(
const WebKit::WebIDBKey& value) {
dispatcher_host()->Send(
new IndexedDBMsg_CallbacksSuccessIndexedDBKey(
- response_id(), IndexedDBKey(value)));
+ thread_id(), response_id(), IndexedDBKey(value)));
}
void IndexedDBCallbacks<WebKit::WebDOMStringList>::onSuccess(
@@ -100,12 +111,12 @@ void IndexedDBCallbacks<WebKit::WebDOMStringList>::onSuccess(
dispatcher_host()->Send(
new IndexedDBMsg_CallbacksSuccessStringList(
- response_id(), list));
+ thread_id(), response_id(), list));
}
void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess(
const WebKit::WebSerializedScriptValue& value) {
dispatcher_host()->Send(
new IndexedDBMsg_CallbacksSuccessSerializedScriptValue(
- response_id(), content::SerializedScriptValue(value)));
+ thread_id(), response_id(), content::SerializedScriptValue(value)));
}
diff --git a/content/browser/in_process_webkit/indexed_db_callbacks.h b/content/browser/in_process_webkit/indexed_db_callbacks.h
index f980060..bcf6ca1 100644
--- a/content/browser/in_process_webkit/indexed_db_callbacks.h
+++ b/content/browser/in_process_webkit/indexed_db_callbacks.h
@@ -33,6 +33,7 @@ template <> struct WebIDBToMsgHelper<WebKit::WebIDBTransaction> {
class IndexedDBCallbacksBase : public WebKit::WebIDBCallbacks {
public:
IndexedDBCallbacksBase(IndexedDBDispatcherHost* dispatcher_host,
+ int32 thread_id,
int32 response_id);
virtual ~IndexedDBCallbacksBase();
@@ -44,11 +45,13 @@ class IndexedDBCallbacksBase : public WebKit::WebIDBCallbacks {
IndexedDBDispatcherHost* dispatcher_host() const {
return dispatcher_host_.get();
}
+ int32 thread_id() const { return thread_id_; }
int32 response_id() const { return response_id_; }
private:
scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_;
int32 response_id_;
+ int32 thread_id_;
DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacksBase);
};
@@ -58,16 +61,20 @@ template <class WebObjectType>
class IndexedDBCallbacks : public IndexedDBCallbacksBase {
public:
IndexedDBCallbacks(
- IndexedDBDispatcherHost* dispatcher_host, int32 response_id,
+ IndexedDBDispatcherHost* dispatcher_host,
+ int32 thread_id,
+ int32 response_id,
const GURL& origin_url)
- : IndexedDBCallbacksBase(dispatcher_host, response_id),
- origin_url_(origin_url) {
+ : IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id),
+ origin_url_(origin_url) {
}
virtual void onSuccess(WebObjectType* idb_object) {
- int32 object_id = dispatcher_host()->Add(idb_object, origin_url_);
+ int32 object_id = dispatcher_host()->Add(idb_object, thread_id(),
+ origin_url_);
dispatcher_host()->Send(
- new typename WebIDBToMsgHelper<WebObjectType>::MsgType(response_id(),
+ new typename WebIDBToMsgHelper<WebObjectType>::MsgType(thread_id(),
+ response_id(),
object_id));
}
@@ -85,9 +92,11 @@ class IndexedDBCallbacks<WebKit::WebIDBCursor>
: public IndexedDBCallbacksBase {
public:
IndexedDBCallbacks(
- IndexedDBDispatcherHost* dispatcher_host, int32 response_id,
+ IndexedDBDispatcherHost* dispatcher_host,
+ int32 thread_id,
+ int32 response_id,
int32 cursor_id)
- : IndexedDBCallbacksBase(dispatcher_host, response_id),
+ : IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id),
cursor_id_(cursor_id) { }
virtual void onSuccess(WebKit::WebIDBCursor* idb_object);
@@ -113,9 +122,10 @@ template <>
class IndexedDBCallbacks<WebKit::WebIDBKey>
: public IndexedDBCallbacksBase {
public:
- IndexedDBCallbacks(
- IndexedDBDispatcherHost* dispatcher_host, int32 response_id)
- : IndexedDBCallbacksBase(dispatcher_host, response_id) { }
+ IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
+ int32 thread_id,
+ int32 response_id)
+ : IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id) { }
virtual void onSuccess(const WebKit::WebIDBKey& value);
@@ -131,8 +141,10 @@ class IndexedDBCallbacks<WebKit::WebDOMStringList>
: public IndexedDBCallbacksBase {
public:
IndexedDBCallbacks(
- IndexedDBDispatcherHost* dispatcher_host, int32 response_id)
- : IndexedDBCallbacksBase(dispatcher_host, response_id) { }
+ IndexedDBDispatcherHost* dispatcher_host,
+ int32 thread_id,
+ int32 response_id)
+ : IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id) { }
virtual void onSuccess(const WebKit::WebDOMStringList& value);
@@ -147,9 +159,10 @@ template <>
class IndexedDBCallbacks<WebKit::WebSerializedScriptValue>
: public IndexedDBCallbacksBase {
public:
- IndexedDBCallbacks(
- IndexedDBDispatcherHost* dispatcher_host, int32 response_id)
- : IndexedDBCallbacksBase(dispatcher_host, response_id) { }
+ IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
+ int32 thread_id,
+ int32 response_id)
+ : IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id) { }
virtual void onSuccess(const WebKit::WebSerializedScriptValue& value);
diff --git a/content/browser/in_process_webkit/indexed_db_database_callbacks.cc b/content/browser/in_process_webkit/indexed_db_database_callbacks.cc
index 2c23aa5..18a7cae 100644
--- a/content/browser/in_process_webkit/indexed_db_database_callbacks.cc
+++ b/content/browser/in_process_webkit/indexed_db_database_callbacks.cc
@@ -9,8 +9,10 @@
IndexedDBDatabaseCallbacks::IndexedDBDatabaseCallbacks(
IndexedDBDispatcherHost* dispatcher_host,
+ int thread_id,
int database_id)
: dispatcher_host_(dispatcher_host),
+ thread_id_(thread_id),
database_id_(database_id) {
}
@@ -20,6 +22,6 @@ IndexedDBDatabaseCallbacks::~IndexedDBDatabaseCallbacks() {
void IndexedDBDatabaseCallbacks::onVersionChange(
const WebKit::WebString& requested_version) {
dispatcher_host_->Send(
- new IndexedDBMsg_DatabaseCallbacksVersionChange(
- database_id_, requested_version));
+ new IndexedDBMsg_DatabaseCallbacksVersionChange(thread_id_, database_id_,
+ requested_version));
}
diff --git a/content/browser/in_process_webkit/indexed_db_database_callbacks.h b/content/browser/in_process_webkit/indexed_db_database_callbacks.h
index 6d4af18..6c0dc83 100644
--- a/content/browser/in_process_webkit/indexed_db_database_callbacks.h
+++ b/content/browser/in_process_webkit/indexed_db_database_callbacks.h
@@ -15,6 +15,7 @@ class IndexedDBDatabaseCallbacks
: public WebKit::WebIDBDatabaseCallbacks {
public:
IndexedDBDatabaseCallbacks(IndexedDBDispatcherHost* dispatcher_host,
+ int thread_id,
int database_id);
virtual ~IndexedDBDatabaseCallbacks();
@@ -23,6 +24,7 @@ class IndexedDBDatabaseCallbacks
private:
scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_;
+ int thread_id_;
int database_id_;
};
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 8a7f622..21fe1ea 100644
--- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -149,6 +149,7 @@ int32 IndexedDBDispatcherHost::Add(WebIDBCursor* idb_cursor) {
}
int32 IndexedDBDispatcherHost::Add(WebIDBDatabase* idb_database,
+ int32 thread_id,
const GURL& origin_url) {
if (!database_dispatcher_host_.get()) {
delete idb_database;
@@ -181,13 +182,15 @@ int32 IndexedDBDispatcherHost::Add(WebIDBObjectStore* idb_object_store) {
}
int32 IndexedDBDispatcherHost::Add(WebIDBTransaction* idb_transaction,
+ int32 thread_id,
const GURL& url) {
if (!transaction_dispatcher_host_.get()) {
delete idb_transaction;
return 0;
}
int32 id = transaction_dispatcher_host_->map_.Add(idb_transaction);
- idb_transaction->setCallbacks(new IndexedDBTransactionCallbacks(this, id));
+ idb_transaction->setCallbacks(
+ new IndexedDBTransactionCallbacks(this, thread_id, id));
transaction_dispatcher_host_->transaction_url_map_[id] = url;
return id;
}
@@ -218,8 +221,9 @@ void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
Context()->GetIDBFactory()->getDatabaseNames(
- new IndexedDBCallbacks<WebDOMStringList>(this, params.response_id),
- origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path));
+ new IndexedDBCallbacks<WebDOMStringList>(this, params.thread_id,
+ params.response_id), origin, NULL,
+ webkit_glue::FilePathToWebString(indexed_db_path));
}
void IndexedDBDispatcherHost::OnIDBFactoryOpen(
@@ -246,8 +250,8 @@ void IndexedDBDispatcherHost::OnIDBFactoryOpen(
// created) if this origin is already over quota.
Context()->GetIDBFactory()->open(
params.name,
- new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id,
- origin_url),
+ new IndexedDBCallbacks<WebIDBDatabase>(this, params.thread_id,
+ params.response_id, origin_url),
origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path));
}
@@ -264,6 +268,7 @@ void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase(
Context()->GetIDBFactory()->deleteDatabase(
params.name,
new IndexedDBCallbacks<WebSerializedScriptValue>(this,
+ params.thread_id,
params.response_id),
WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL,
webkit_glue::FilePathToWebString(indexed_db_path));
@@ -419,6 +424,7 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore(
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion(
int32 idb_database_id,
+ int32 thread_id,
int32 response_id,
const string16& version,
WebKit::WebExceptionCode* ec) {
@@ -431,12 +437,13 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion(
*ec = 0;
idb_database->setVersion(
version,
- new IndexedDBCallbacks<WebIDBTransaction>(parent_, response_id,
+ new IndexedDBCallbacks<WebIDBTransaction>(parent_, thread_id, response_id,
database_url_map_[idb_database_id]),
*ec);
}
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction(
+ int32 thread_id,
int32 idb_database_id,
const std::vector<string16>& names,
int32 mode,
@@ -458,16 +465,18 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction(
object_stores, mode, *ec);
DCHECK(!transaction != !*ec);
*idb_transaction_id =
- *ec ? 0 : parent_->Add(transaction, database_url_map_[idb_database_id]);
+ *ec ? 0 : parent_->Add(transaction, thread_id,
+ database_url_map_[idb_database_id]);
}
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen(
- int32 idb_database_id, int32 response_id) {
+ int32 idb_database_id, int32 thread_id, int32 response_id) {
WebIDBDatabase* database = parent_->GetOrTerminateProcess(
&map_, idb_database_id);
if (!database)
return;
- database->open(new IndexedDBDatabaseCallbacks(parent_, response_id));
+ database->open(new IndexedDBDatabaseCallbacks(parent_, thread_id,
+ response_id));
}
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose(
@@ -560,7 +569,8 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenObjectCursor(
*ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
- new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id, -1));
+ new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id,
+ params.response_id, -1));
idb_index->openObjectCursor(
WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
params.upper_open),
@@ -580,7 +590,8 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor(
*ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
- new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id, -1));
+ new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id,
+ params.response_id, -1));
idb_index->openKeyCursor(
WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
params.upper_open),
@@ -589,6 +600,7 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor(
void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject(
int idb_index_id,
+ int32 thread_id,
int32 response_id,
const IndexedDBKey& key,
int32 transaction_id,
@@ -603,12 +615,14 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject(
*ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
- new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id));
+ new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
+ response_id));
idb_index->getObject(key, callbacks.release(), *idb_transaction, *ec);
}
void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey(
int idb_index_id,
+ int32 thread_id,
int32 response_id,
const IndexedDBKey& key,
int32 transaction_id,
@@ -623,7 +637,7 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey(
*ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
- new IndexedDBCallbacks<WebIDBKey>(parent_, response_id));
+ new IndexedDBCallbacks<WebIDBKey>(parent_, thread_id, response_id));
idb_index->getKey(key, callbacks.release(), *idb_transaction, *ec);
}
@@ -700,6 +714,7 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames(
void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet(
int idb_object_store_id,
+ int32 thread_id,
int32 response_id,
const IndexedDBKey& key,
int32 transaction_id,
@@ -714,7 +729,8 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet(
*ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
- new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id));
+ new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
+ response_id));
idb_object_store->get(key, callbacks.release(), *idb_transaction, *ec);
}
@@ -731,7 +747,8 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut(
*ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
- new IndexedDBCallbacks<WebIDBKey>(parent_, params.response_id));
+ new IndexedDBCallbacks<WebIDBKey>(parent_, params.thread_id,
+ params.response_id));
idb_object_store->put(params.serialized_value, params.key, params.put_mode,
callbacks.release(), *idb_transaction, *ec);
if (*ec)
@@ -744,6 +761,7 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut(
void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete(
int idb_object_store_id,
+ int32 thread_id,
int32 response_id,
const IndexedDBKey& key,
int32 transaction_id,
@@ -758,13 +776,15 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDelete(
*ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
- new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id));
+ new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
+ response_id));
idb_object_store->deleteFunction(
key, callbacks.release(), *idb_transaction, *ec);
}
void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnClear(
int idb_object_store_id,
+ int32 thread_id,
int32 response_id,
int32 transaction_id,
WebKit::WebExceptionCode* ec) {
@@ -778,7 +798,8 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnClear(
*ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
- new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id));
+ new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
+ response_id));
idb_object_store->clear(callbacks.release(), *idb_transaction, *ec);
}
@@ -852,7 +873,8 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnOpenCursor(
*ec = 0;
scoped_ptr<WebIDBCallbacks> callbacks(
- new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id, -1));
+ new IndexedDBCallbacks<WebIDBCursor>(parent_, params.thread_id,
+ params.response_id, -1));
idb_object_store->openCursor(
WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
params.upper_open),
@@ -939,6 +961,7 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnValue(
void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate(
int32 cursor_id,
+ int32 thread_id,
int32 response_id,
const content::SerializedScriptValue& value,
WebKit::WebExceptionCode* ec) {
@@ -949,11 +972,13 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate(
*ec = 0;
idb_cursor->update(
- value, new IndexedDBCallbacks<WebIDBKey>(parent_, response_id), *ec);
+ value, new IndexedDBCallbacks<WebIDBKey>(parent_, thread_id, response_id),
+ *ec);
}
void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue(
int32 cursor_id,
+ int32 thread_id,
int32 response_id,
const IndexedDBKey& key,
WebKit::WebExceptionCode* ec) {
@@ -964,12 +989,13 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue(
*ec = 0;
idb_cursor->continueFunction(
- key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id,
+ key, new IndexedDBCallbacks<WebIDBCursor>(parent_, thread_id, response_id,
cursor_id), *ec);
}
void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch(
int32 cursor_id,
+ int32 thread_id,
int32 response_id,
int n,
WebKit::WebExceptionCode* ec) {
@@ -980,7 +1006,7 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetch(
*ec = 0;
idb_cursor->prefetchContinue(
- n, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id,
+ n, new IndexedDBCallbacks<WebIDBCursor>(parent_, thread_id, response_id,
cursor_id), *ec);
}
@@ -996,6 +1022,7 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrefetchReset(
void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete(
int32 cursor_id,
+ int32 thread_id,
int32 response_id,
WebKit::WebExceptionCode* ec) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
@@ -1005,7 +1032,8 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete(
*ec = 0;
idb_cursor->deleteFunction(
- new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, response_id), *ec);
+ new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
+ response_id), *ec);
}
void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed(
diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.h b/content/browser/in_process_webkit/indexed_db_dispatcher_host.h
index 88bff96..5f49f6e 100644
--- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.h
+++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.h
@@ -60,10 +60,14 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
// The various IndexedDBCallbacks children call these methods to add the
// results into the applicable map. See below for more details.
int32 Add(WebKit::WebIDBCursor* idb_cursor);
- int32 Add(WebKit::WebIDBDatabase* idb_database, const GURL& origin_url);
+ int32 Add(WebKit::WebIDBDatabase* idb_database,
+ int32 thread_id,
+ const GURL& origin_url);
int32 Add(WebKit::WebIDBIndex* idb_index);
int32 Add(WebKit::WebIDBObjectStore* idb_object_store);
- int32 Add(WebKit::WebIDBTransaction* idb_transaction, const GURL& origin_url);
+ int32 Add(WebKit::WebIDBTransaction* idb_transaction,
+ int32 thread_id,
+ const GURL& origin_url);
int32 Add(WebKit::WebDOMStringList* domStringList);
WebKit::WebIDBCursor* GetCursorFromId(int32 cursor_id);
@@ -118,15 +122,17 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
int32 transaction_id,
WebKit::WebExceptionCode* ec);
void OnSetVersion(int32 idb_database_id,
+ int32 thread_id,
int32 response_id,
const string16& version,
WebKit::WebExceptionCode* ec);
- void OnTransaction(int32 idb_database_id,
+ void OnTransaction(int32 thread_id,
+ int32 idb_database_id,
const std::vector<string16>& names,
int32 mode,
int32* idb_transaction_id,
WebKit::WebExceptionCode* ec);
- void OnOpen(int32 idb_database_id, int32 response_id);
+ void OnOpen(int32 idb_database_id, int32 thread_id, int32 response_id);
void OnClose(int32 idb_database_id);
void OnDestroyed(int32 idb_database_id);
@@ -153,11 +159,13 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
void OnOpenKeyCursor(const IndexedDBHostMsg_IndexOpenCursor_Params& params,
WebKit::WebExceptionCode* ec);
void OnGetObject(int idb_index_id,
+ int32 thread_id,
int32 response_id,
const IndexedDBKey& key,
int32 transaction_id,
WebKit::WebExceptionCode* ec);
void OnGetKey(int idb_index_id,
+ int32 thread_id,
int32 response_id,
const IndexedDBKey& key,
int32 transaction_id,
@@ -181,6 +189,7 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
void OnIndexNames(int32 idb_object_store_id,
std::vector<string16>* index_names);
void OnGet(int idb_object_store_id,
+ int32 thread_id,
int32 response_id,
const IndexedDBKey& key,
int32 transaction_id,
@@ -188,11 +197,13 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
void OnPut(const IndexedDBHostMsg_ObjectStorePut_Params& params,
WebKit::WebExceptionCode* ec);
void OnDelete(int idb_object_store_id,
+ int32 thread_id,
int32 response_id,
const IndexedDBKey& key,
int32 transaction_id,
WebKit::WebExceptionCode* ec);
void OnClear(int idb_object_store_id,
+ int32 thread_id,
int32 response_id,
int32 transaction_id,
WebKit::WebExceptionCode* ec);
@@ -231,20 +242,24 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
void OnValue(int32 idb_object_store_id,
content::SerializedScriptValue* script_value);
void OnUpdate(int32 idb_object_store_id,
+ int32 thread_id,
int32 response_id,
const content::SerializedScriptValue& value,
WebKit::WebExceptionCode* ec);
void OnContinue(int32 idb_object_store_id,
+ int32 thread_id,
int32 response_id,
const IndexedDBKey& key,
WebKit::WebExceptionCode* ec);
void OnPrefetch(int32 idb_cursor_id,
+ int32 thread_id,
int32 response_id,
int n,
WebKit::WebExceptionCode* ec);
void OnPrefetchReset(int32 idb_cursor_id, int used_prefetches,
int unused_prefetches);
void OnDelete(int32 idb_object_store_id,
+ int32 thread_id,
int32 response_id,
WebKit::WebExceptionCode* ec);
void OnDestroyed(int32 idb_cursor_id);
diff --git a/content/browser/in_process_webkit/indexed_db_transaction_callbacks.cc b/content/browser/in_process_webkit/indexed_db_transaction_callbacks.cc
index 7d5bdc5..000dc81 100644
--- a/content/browser/in_process_webkit/indexed_db_transaction_callbacks.cc
+++ b/content/browser/in_process_webkit/indexed_db_transaction_callbacks.cc
@@ -9,8 +9,10 @@
IndexedDBTransactionCallbacks::IndexedDBTransactionCallbacks(
IndexedDBDispatcherHost* dispatcher_host,
+ int thread_id,
int transaction_id)
: dispatcher_host_(dispatcher_host),
+ thread_id_(thread_id),
transaction_id_(transaction_id) {
}
@@ -19,11 +21,12 @@ IndexedDBTransactionCallbacks::~IndexedDBTransactionCallbacks() {
void IndexedDBTransactionCallbacks::onAbort() {
dispatcher_host_->Send(
- new IndexedDBMsg_TransactionCallbacksAbort(transaction_id_));
+ new IndexedDBMsg_TransactionCallbacksAbort(thread_id_, transaction_id_));
}
void IndexedDBTransactionCallbacks::onComplete() {
dispatcher_host_->TransactionComplete(transaction_id_);
dispatcher_host_->Send(
- new IndexedDBMsg_TransactionCallbacksComplete(transaction_id_));
+ new IndexedDBMsg_TransactionCallbacksComplete(thread_id_,
+ transaction_id_));
}
diff --git a/content/browser/in_process_webkit/indexed_db_transaction_callbacks.h b/content/browser/in_process_webkit/indexed_db_transaction_callbacks.h
index 60cbfff6..9c424b0 100644
--- a/content/browser/in_process_webkit/indexed_db_transaction_callbacks.h
+++ b/content/browser/in_process_webkit/indexed_db_transaction_callbacks.h
@@ -15,6 +15,7 @@ class IndexedDBTransactionCallbacks
: public WebKit::WebIDBTransactionCallbacks {
public:
IndexedDBTransactionCallbacks(IndexedDBDispatcherHost* dispatcher_host,
+ int thread_id,
int transaction_id);
virtual ~IndexedDBTransactionCallbacks();
@@ -24,6 +25,7 @@ class IndexedDBTransactionCallbacks
private:
scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_;
+ int thread_id_;
int transaction_id_;
};
diff --git a/content/common/indexed_db_messages.h b/content/common/indexed_db_messages.h
index 07784f3..2a4cf2d 100644
--- a/content/common/indexed_db_messages.h
+++ b/content/common/indexed_db_messages.h
@@ -22,7 +22,8 @@ IPC_ENUM_TRAITS(WebKit::WebIDBObjectStore::PutMode)
// Used to enumerate indexed databases.
IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryGetDatabaseNames_Params)
- // The response should have this id.
+ // The response should have these ids.
+ IPC_STRUCT_MEMBER(int32, thread_id)
IPC_STRUCT_MEMBER(int32, response_id)
// The origin doing the initiating.
IPC_STRUCT_MEMBER(string16, origin)
@@ -30,7 +31,8 @@ IPC_STRUCT_END()
// Used to open an indexed database.
IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryOpen_Params)
- // The response should have this id.
+ // The response should have these ids.
+ IPC_STRUCT_MEMBER(int32, thread_id)
IPC_STRUCT_MEMBER(int32, response_id)
// The origin doing the initiating.
IPC_STRUCT_MEMBER(string16, origin)
@@ -40,7 +42,8 @@ IPC_STRUCT_END()
// Used to delete an indexed database.
IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryDeleteDatabase_Params)
- // The response should have this id.
+ // The response should have these ids.
+ IPC_STRUCT_MEMBER(int32, thread_id)
IPC_STRUCT_MEMBER(int32, response_id)
// The origin doing the initiating.
IPC_STRUCT_MEMBER(string16, origin)
@@ -64,7 +67,8 @@ IPC_STRUCT_END()
// Used to open both cursors and object cursors in IndexedDB.
IPC_STRUCT_BEGIN(IndexedDBHostMsg_IndexOpenCursor_Params)
- // The response should have this id.
+ // The response should have these ids.
+ IPC_STRUCT_MEMBER(int32, thread_id)
IPC_STRUCT_MEMBER(int32, response_id)
// The serialized lower key.
IPC_STRUCT_MEMBER(IndexedDBKey, lower_key)
@@ -87,6 +91,7 @@ IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStorePut_Params)
// The object store's id.
IPC_STRUCT_MEMBER(int32, idb_object_store_id)
// The id any response should contain.
+ IPC_STRUCT_MEMBER(int32, thread_id)
IPC_STRUCT_MEMBER(int32, response_id)
// The value to set.
IPC_STRUCT_MEMBER(content::SerializedScriptValue, serialized_value)
@@ -116,7 +121,8 @@ IPC_STRUCT_END()
// Used to open an IndexedDB cursor.
IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStoreOpenCursor_Params)
- // The response should have this id.
+ // The response should have these ids.
+ IPC_STRUCT_MEMBER(int32, thread_id)
IPC_STRUCT_MEMBER(int32, response_id)
// The serialized lower key.
IPC_STRUCT_MEMBER(IndexedDBKey, lower_key)
@@ -134,56 +140,89 @@ IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStoreOpenCursor_Params)
IPC_STRUCT_MEMBER(int, transaction_id)
IPC_STRUCT_END()
+IPC_STRUCT_BEGIN(IndexedDBMsg_CallbacksSuccessIDBCursor_Params)
+ IPC_STRUCT_MEMBER(int32, thread_id)
+ IPC_STRUCT_MEMBER(int32, response_id)
+ IPC_STRUCT_MEMBER(int32, cursor_id)
+ IPC_STRUCT_MEMBER(IndexedDBKey, key)
+ IPC_STRUCT_MEMBER(IndexedDBKey, primary_key)
+ IPC_STRUCT_MEMBER(content::SerializedScriptValue, serialized_value)
+IPC_STRUCT_END()
+
+IPC_STRUCT_BEGIN(IndexedDBMsg_CallbacksSuccessCursorContinue_Params)
+ IPC_STRUCT_MEMBER(int32, thread_id)
+ IPC_STRUCT_MEMBER(int32, response_id)
+ IPC_STRUCT_MEMBER(int32, cursor_id)
+ IPC_STRUCT_MEMBER(IndexedDBKey, key)
+ IPC_STRUCT_MEMBER(IndexedDBKey, primary_key)
+ IPC_STRUCT_MEMBER(content::SerializedScriptValue, serialized_value)
+IPC_STRUCT_END()
+
+IPC_STRUCT_BEGIN(IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params)
+ IPC_STRUCT_MEMBER(int32, thread_id)
+ IPC_STRUCT_MEMBER(int32, response_id)
+ IPC_STRUCT_MEMBER(int32, cursor_id)
+ IPC_STRUCT_MEMBER(std::vector<IndexedDBKey>, keys)
+ IPC_STRUCT_MEMBER(std::vector<IndexedDBKey>, primary_keys)
+ IPC_STRUCT_MEMBER(std::vector<content::SerializedScriptValue>, values)
+IPC_STRUCT_END()
+
+
// Indexed DB messages sent from the browser to the renderer.
+// The thread_id needs to be the first parameter in these messages. In the IO
+// thread on the renderer/client process, an IDB message filter assumes the
+// thread_id is the first int.
+
// IDBCallback message handlers.
-IPC_MESSAGE_CONTROL5(IndexedDBMsg_CallbacksSuccessIDBCursor,
- int32 /* response_id */,
- int32 /* cursor_id */,
- IndexedDBKey /* key */,
- IndexedDBKey /* primary key */,
- content::SerializedScriptValue /* script_value */)
-IPC_MESSAGE_CONTROL5(IndexedDBMsg_CallbacksSuccessCursorContinue,
- int32 /* response_id */,
- int32 /* cursor_id */,
- IndexedDBKey /* key */,
- IndexedDBKey /* primary key */,
- content::SerializedScriptValue /* script_value */)
-IPC_MESSAGE_CONTROL5(IndexedDBMsg_CallbacksSuccessCursorPrefetch,
- int32 /* response_id */,
- int32 /* cursor_id */,
- std::vector<IndexedDBKey> /* keys */,
- std::vector<IndexedDBKey> /* primary keys */,
- std::vector<content::SerializedScriptValue> /* values */)
-IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBDatabase,
+IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessIDBCursor,
+ IndexedDBMsg_CallbacksSuccessIDBCursor_Params)
+
+IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessCursorContinue,
+ IndexedDBMsg_CallbacksSuccessCursorContinue_Params)
+
+IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessCursorPrefetch,
+ IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params)
+
+IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksSuccessIDBDatabase,
+ int32 /* thread_id */,
int32 /* response_id */,
int32 /* idb_database_id */)
-IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIndexedDBKey,
+IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksSuccessIndexedDBKey,
+ int32 /* thread_id */,
int32 /* response_id */,
IndexedDBKey /* indexed_db_key */)
-IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBTransaction,
+IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksSuccessIDBTransaction,
+ int32 /* thread_id */,
int32 /* response_id */,
int32 /* idb_transaction_id */)
-IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessSerializedScriptValue,
+IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksSuccessSerializedScriptValue,
+ int32 /* thread_id */,
int32 /* response_id */,
content::SerializedScriptValue /* value */)
-IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessStringList,
+IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksSuccessStringList,
+ int32 /* thread_id */,
int32 /* response_id */,
std::vector<string16> /* dom_string_list */)
-IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksError,
+IPC_MESSAGE_CONTROL4(IndexedDBMsg_CallbacksError,
+ int32 /* thread_id */,
int32 /* response_id */,
int /* code */,
string16 /* message */)
-IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksBlocked,
+IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksBlocked,
+ int32 /* thread_id */,
int32 /* response_id */)
// IDBTransactionCallback message handlers.
-IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksAbort,
+IPC_MESSAGE_CONTROL2(IndexedDBMsg_TransactionCallbacksAbort,
+ int32 /* thread_id */,
int32 /* transaction_id */)
-IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksComplete,
+IPC_MESSAGE_CONTROL2(IndexedDBMsg_TransactionCallbacksComplete,
+ int32 /* thread_id */,
int32 /* transaction_id */)
-IPC_MESSAGE_CONTROL2(IndexedDBMsg_DatabaseCallbacksVersionChange,
+IPC_MESSAGE_CONTROL3(IndexedDBMsg_DatabaseCallbacksVersionChange,
+ int32, /* thread_id */
int32, /* database_id */
string16) /* new_version */
@@ -195,22 +234,25 @@ IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorDirection,
int32 /* direction */)
// WebIDBCursor::update() message.
-IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorUpdate,
+IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_CursorUpdate,
int32, /* idb_cursor_id */
+ int32, /* thread_id */
int32, /* response_id */
content::SerializedScriptValue, /* value */
WebKit::WebExceptionCode /* ec */)
// WebIDBCursor::continue() message.
-IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorContinue,
+IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_CursorContinue,
int32, /* idb_cursor_id */
+ int32, /* thread_id */
int32, /* response_id */
IndexedDBKey, /* key */
WebKit::WebExceptionCode /* ec */)
// WebIDBCursor::prefetchContinue() message.
-IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorPrefetch,
+IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_CursorPrefetch,
int32, /* idb_cursor_id */
+ int32, /* thread_id */
int32, /* response_id */
int32, /* n */
WebKit::WebExceptionCode /* ec */)
@@ -222,8 +264,9 @@ IPC_SYNC_MESSAGE_CONTROL3_0(IndexedDBHostMsg_CursorPrefetchReset,
int32 /* used_prefetches */)
// WebIDBCursor::remove() message.
-IPC_SYNC_MESSAGE_CONTROL2_1(IndexedDBHostMsg_CursorDelete,
+IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorDelete,
int32, /* idb_cursor_id */
+ int32, /* thread_id */
int32, /* response_id */
WebKit::WebExceptionCode /* ec */)
@@ -268,8 +311,9 @@ IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseDeleteObjectStore,
WebKit::WebExceptionCode /* ec */)
// WebIDBDatabase::setVersion() message.
-IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseSetVersion,
+IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_DatabaseSetVersion,
int32, /* idb_database_id */
+ int32, /* thread_id */
int32, /* response_id */
string16, /* version */
WebKit::WebExceptionCode /* ec */)
@@ -279,7 +323,8 @@ IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseSetVersion,
// temporary ID and keep a map in the browser process of real
// IDs to temporary IDs. We can then update the transaction
// to its real ID asynchronously.
-IPC_SYNC_MESSAGE_CONTROL3_2(IndexedDBHostMsg_DatabaseTransaction,
+IPC_SYNC_MESSAGE_CONTROL4_2(IndexedDBHostMsg_DatabaseTransaction,
+ int32, /* thread_id */
int32, /* idb_database_id */
std::vector<string16>, /* object_stores */
int32, /* mode */
@@ -287,8 +332,9 @@ IPC_SYNC_MESSAGE_CONTROL3_2(IndexedDBHostMsg_DatabaseTransaction,
WebKit::WebExceptionCode /* ec */)
// WebIDBDatabase::open() message.
-IPC_MESSAGE_CONTROL2(IndexedDBHostMsg_DatabaseOpen,
+IPC_MESSAGE_CONTROL3(IndexedDBHostMsg_DatabaseOpen,
int32, /* idb_database_id */
+ int32 /* thread_id */,
int32 /* response_id */)
// WebIDBDatabase::close() message.
@@ -330,16 +376,18 @@ IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexOpenKeyCursor,
WebKit::WebExceptionCode /* ec */)
// WebIDBIndex::getObject() message.
-IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_IndexGetObject,
+IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_IndexGetObject,
int32, /* idb_index_id */
+ int32, /* thread_id */
int32, /* response_id */
IndexedDBKey, /* key */
int32, /* transaction_id */
WebKit::WebExceptionCode /* ec */)
// WebIDBIndex::getKey() message.
-IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_IndexGetKey,
+IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_IndexGetKey,
int32, /* idb_index_id */
+ int32, /* thread_id */
int32, /* response_id */
IndexedDBKey, /* key */
int32, /* transaction_id */
@@ -365,8 +413,9 @@ IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreIndexNames,
std::vector<string16> /* index_names */)
// WebIDBObjectStore::get() message.
-IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreGet,
+IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_ObjectStoreGet,
int32, /* idb_object_store_id */
+ int32, /* thread_id */
int32, /* response_id */
IndexedDBKey, /* key */
int32, /* transaction_id */
@@ -378,16 +427,18 @@ IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStorePut,
WebKit::WebExceptionCode /* ec */)
// WebIDBObjectStore::delete() message.
-IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreDelete,
+IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_ObjectStoreDelete,
int32, /* idb_object_store_id */
+ int32, /* thread_id */
int32, /* response_id */
IndexedDBKey, /* key */
int32, /* transaction_id */
WebKit::WebExceptionCode /* ec */)
// WebIDBObjectStore::clear() message.
-IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_ObjectStoreClear,
+IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreClear,
int32, /* idb_object_store_id */
+ int32, /* thread_id */
int32, /* response_id */
int32, /* transaction_id */
WebKit::WebExceptionCode /* ec */)
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 67535f9..57d2008 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -76,6 +76,8 @@
'renderer/idle_user_detector.h',
'renderer/indexed_db_dispatcher.cc',
'renderer/indexed_db_dispatcher.h',
+ 'renderer/indexed_db_message_filter.cc',
+ 'renderer/indexed_db_message_filter.h',
'renderer/intents_dispatcher.cc',
'renderer/intents_dispatcher.h',
'renderer/java/java_bridge_channel.cc',
diff --git a/content/renderer/indexed_db_dispatcher.cc b/content/renderer/indexed_db_dispatcher.cc
index 414c1a6..ef66217 100644
--- a/content/renderer/indexed_db_dispatcher.cc
+++ b/content/renderer/indexed_db_dispatcher.cc
@@ -4,6 +4,8 @@
#include "content/renderer/indexed_db_dispatcher.h"
+#include "base/lazy_instance.h"
+#include "base/threading/thread_local.h"
#include "content/common/indexed_db_messages.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/render_view_impl.h"
@@ -12,14 +14,13 @@
#include "content/renderer/renderer_webidbindex_impl.h"
#include "content/renderer/renderer_webidbobjectstore_impl.h"
#include "content/renderer/renderer_webidbtransaction_impl.h"
+#include "ipc/ipc_channel.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
+using base::ThreadLocalPointer;
using WebKit::WebDOMStringList;
using WebKit::WebExceptionCode;
using WebKit::WebFrame;
@@ -30,14 +31,43 @@ using WebKit::WebIDBDatabaseCallbacks;
using WebKit::WebIDBDatabaseError;
using WebKit::WebIDBTransaction;
using WebKit::WebIDBTransactionCallbacks;
+using webkit_glue::WorkerTaskRunner;
+
+static base::LazyInstance<ThreadLocalPointer<IndexedDBDispatcher>,
+ base::LeakyLazyInstanceTraits<ThreadLocalPointer<IndexedDBDispatcher> > >
+ g_idb_dispatcher_tls = LAZY_INSTANCE_INITIALIZER;
+
+namespace {
+
+int32 CurrentWorkerId() {
+ return WorkerTaskRunner::Instance()->CurrentWorkerId();
+}
+
+} // unnamed namespace
IndexedDBDispatcher::IndexedDBDispatcher() {
+ g_idb_dispatcher_tls.Pointer()->Set(this);
}
IndexedDBDispatcher::~IndexedDBDispatcher() {
+ g_idb_dispatcher_tls.Pointer()->Set(NULL);
}
-bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) {
+IndexedDBDispatcher* IndexedDBDispatcher::ThreadSpecificInstance() {
+ if (g_idb_dispatcher_tls.Pointer()->Get())
+ return g_idb_dispatcher_tls.Pointer()->Get();
+
+ IndexedDBDispatcher* dispatcher = new IndexedDBDispatcher;
+ if (WorkerTaskRunner::Instance()->CurrentWorkerId())
+ webkit_glue::WorkerTaskRunner::Instance()->AddStopObserver(dispatcher);
+ return dispatcher;
+}
+
+void IndexedDBDispatcher::OnWorkerRunLoopStopped() {
+ delete this;
+}
+
+void IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg)
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursor,
@@ -64,7 +94,9 @@ bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) {
OnVersionChange)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
- return handled;
+ // If a message gets here, IndexedDBMessageFilter already determined that it
+ // is an IndexedDB message.
+ DCHECK(handled);
}
void IndexedDBDispatcher::Send(IPC::Message* msg) {
@@ -81,7 +113,8 @@ void IndexedDBDispatcher::RequestIDBCursorUpdate(
int32 response_id = pending_callbacks_.Add(callbacks.release());
Send(
- new IndexedDBHostMsg_CursorUpdate(idb_cursor_id, response_id, value, ec));
+ new IndexedDBHostMsg_CursorUpdate(idb_cursor_id, CurrentWorkerId(),
+ response_id, value, ec));
if (*ec)
pending_callbacks_.Remove(response_id);
}
@@ -98,7 +131,8 @@ void IndexedDBDispatcher::RequestIDBCursorContinue(
int32 response_id = pending_callbacks_.Add(callbacks.release());
Send(
- new IndexedDBHostMsg_CursorContinue(idb_cursor_id, response_id, key, ec));
+ new IndexedDBHostMsg_CursorContinue(idb_cursor_id, CurrentWorkerId(),
+ response_id, key, ec));
if (*ec)
pending_callbacks_.Remove(response_id);
}
@@ -111,17 +145,17 @@ void IndexedDBDispatcher::RequestIDBCursorPrefetch(
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
int32 response_id = pending_callbacks_.Add(callbacks.release());
- RenderThreadImpl::current()->Send(
- new IndexedDBHostMsg_CursorPrefetch(idb_cursor_id, response_id, n, ec));
+ Send(new IndexedDBHostMsg_CursorPrefetch(idb_cursor_id, CurrentWorkerId(),
+ response_id, n, ec));
if (*ec)
pending_callbacks_.Remove(response_id);
}
void IndexedDBDispatcher::RequestIDBCursorPrefetchReset(
int used_prefetches, int unused_prefetches, int32 idb_cursor_id) {
- RenderThreadImpl::current()->Send(
- new IndexedDBHostMsg_CursorPrefetchReset(idb_cursor_id, used_prefetches,
- unused_prefetches));
+ Send(new IndexedDBHostMsg_CursorPrefetchReset(idb_cursor_id,
+ used_prefetches,
+ unused_prefetches));
}
void IndexedDBDispatcher::RequestIDBCursorDelete(
@@ -132,7 +166,8 @@ void IndexedDBDispatcher::RequestIDBCursorDelete(
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
int32 response_id = pending_callbacks_.Add(callbacks.release());
- Send(new IndexedDBHostMsg_CursorDelete(idb_cursor_id, response_id, ec));
+ Send(new IndexedDBHostMsg_CursorDelete(idb_cursor_id, CurrentWorkerId(),
+ response_id, ec));
if (*ec)
pending_callbacks_.Remove(response_id);
}
@@ -152,6 +187,7 @@ void IndexedDBDispatcher::RequestIDBFactoryOpen(
return; // We must be shutting down.
IndexedDBHostMsg_FactoryOpen_Params params;
+ params.thread_id = CurrentWorkerId();
params.response_id = pending_callbacks_.Add(callbacks.release());
params.origin = origin;
params.name = name;
@@ -172,6 +208,7 @@ void IndexedDBDispatcher::RequestIDBFactoryGetDatabaseNames(
return; // We must be shutting down.
IndexedDBHostMsg_FactoryGetDatabaseNames_Params params;
+ params.thread_id = CurrentWorkerId();
params.response_id = pending_callbacks_.Add(callbacks.release());
params.origin = origin;
Send(new IndexedDBHostMsg_FactoryGetDatabaseNames(params));
@@ -192,6 +229,7 @@ void IndexedDBDispatcher::RequestIDBFactoryDeleteDatabase(
return; // We must be shutting down.
IndexedDBHostMsg_FactoryDeleteDatabase_Params params;
+ params.thread_id = CurrentWorkerId();
params.response_id = pending_callbacks_.Add(callbacks.release());
params.origin = origin;
params.name = name;
@@ -210,8 +248,10 @@ void IndexedDBDispatcher::RequestIDBDatabaseOpen(
ResetCursorPrefetchCaches();
scoped_ptr<WebIDBDatabaseCallbacks> callbacks(callbacks_ptr);
- int32 response_id = pending_database_callbacks_.Add(callbacks.release());
- Send(new IndexedDBHostMsg_DatabaseOpen(response_id, idb_database_id));
+ DCHECK(!pending_database_callbacks_.Lookup(idb_database_id));
+ pending_database_callbacks_.AddWithID(callbacks.release(), idb_database_id);
+ Send(new IndexedDBHostMsg_DatabaseOpen(idb_database_id, CurrentWorkerId(),
+ idb_database_id));
}
void IndexedDBDispatcher::RequestIDBDatabaseSetVersion(
@@ -223,8 +263,9 @@ void IndexedDBDispatcher::RequestIDBDatabaseSetVersion(
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
int32 response_id = pending_callbacks_.Add(callbacks.release());
- Send(new IndexedDBHostMsg_DatabaseSetVersion(idb_database_id, response_id,
- version, ec));
+ Send(new IndexedDBHostMsg_DatabaseSetVersion(idb_database_id,
+ CurrentWorkerId(),
+ response_id, version, ec));
if (*ec)
pending_callbacks_.Remove(response_id);
}
@@ -239,6 +280,7 @@ void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor(
ResetCursorPrefetchCaches();
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
IndexedDBHostMsg_IndexOpenCursor_Params params;
+ params.thread_id = CurrentWorkerId();
params.response_id = pending_callbacks_.Add(callbacks.release());
params.lower_key.Set(idb_key_range.lower());
params.upper_key.Set(idb_key_range.upper());
@@ -262,6 +304,7 @@ void IndexedDBDispatcher::RequestIDBIndexOpenKeyCursor(
ResetCursorPrefetchCaches();
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
IndexedDBHostMsg_IndexOpenCursor_Params params;
+ params.thread_id = CurrentWorkerId();
params.response_id = pending_callbacks_.Add(callbacks.release());
// TODO(jorlow): We really should just create a Chromium abstraction for
// KeyRange rather than doing it ad-hoc like this.
@@ -286,7 +329,8 @@ void IndexedDBDispatcher::RequestIDBIndexGetObject(
ResetCursorPrefetchCaches();
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
int32 response_id = pending_callbacks_.Add(callbacks.release());
- Send(new IndexedDBHostMsg_IndexGetObject(idb_index_id, response_id, key,
+ Send(new IndexedDBHostMsg_IndexGetObject(idb_index_id, CurrentWorkerId(),
+ response_id, key,
TransactionId(transaction), ec));
if (*ec)
pending_callbacks_.Remove(response_id);
@@ -302,7 +346,7 @@ void IndexedDBDispatcher::RequestIDBIndexGetKey(
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
int32 response_id = pending_callbacks_.Add(callbacks.release());
Send(new IndexedDBHostMsg_IndexGetKey(
- idb_index_id, response_id, key,
+ idb_index_id, CurrentWorkerId(), response_id, key,
TransactionId(transaction), ec));
if (*ec)
pending_callbacks_.Remove(response_id);
@@ -319,7 +363,7 @@ void IndexedDBDispatcher::RequestIDBObjectStoreGet(
int32 response_id = pending_callbacks_.Add(callbacks.release());
Send(new IndexedDBHostMsg_ObjectStoreGet(
- idb_object_store_id, response_id,
+ idb_object_store_id, CurrentWorkerId(), response_id,
key, TransactionId(transaction), ec));
if (*ec)
pending_callbacks_.Remove(response_id);
@@ -336,6 +380,7 @@ void IndexedDBDispatcher::RequestIDBObjectStorePut(
ResetCursorPrefetchCaches();
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
IndexedDBHostMsg_ObjectStorePut_Params params;
+ params.thread_id = CurrentWorkerId();
params.idb_object_store_id = idb_object_store_id;
params.response_id = pending_callbacks_.Add(callbacks.release());
params.serialized_value = value;
@@ -358,7 +403,8 @@ void IndexedDBDispatcher::RequestIDBObjectStoreDelete(
int32 response_id = pending_callbacks_.Add(callbacks.release());
Send(new IndexedDBHostMsg_ObjectStoreDelete(
- idb_object_store_id, response_id, key, TransactionId(transaction), ec));
+ idb_object_store_id, CurrentWorkerId(), response_id, key,
+ TransactionId(transaction), ec));
if (*ec)
pending_callbacks_.Remove(response_id);
}
@@ -373,7 +419,8 @@ void IndexedDBDispatcher::RequestIDBObjectStoreClear(
int32 response_id = pending_callbacks_.Add(callbacks.release());
Send(new IndexedDBHostMsg_ObjectStoreClear(
- idb_object_store_id, response_id, TransactionId(transaction), ec));
+ idb_object_store_id, CurrentWorkerId(), response_id,
+ TransactionId(transaction), ec));
if (*ec)
pending_callbacks_.Remove(response_id);
}
@@ -388,6 +435,7 @@ void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor(
ResetCursorPrefetchCaches();
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
IndexedDBHostMsg_ObjectStoreOpenCursor_Params params;
+ params.thread_id = CurrentWorkerId();
params.response_id = pending_callbacks_.Add(callbacks.release());
params.lower_key.Set(idb_key_range.lower());
params.upper_key.Set(idb_key_range.upper());
@@ -418,8 +466,10 @@ int32 IndexedDBDispatcher::TransactionId(
return impl->id();
}
-void IndexedDBDispatcher::OnSuccessIDBDatabase(int32 response_id,
+void IndexedDBDispatcher::OnSuccessIDBDatabase(int32 thread_id,
+ int32 response_id,
int32 object_id) {
+ DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
if (!callbacks)
return;
@@ -427,8 +477,10 @@ void IndexedDBDispatcher::OnSuccessIDBDatabase(int32 response_id,
pending_callbacks_.Remove(response_id);
}
-void IndexedDBDispatcher::OnSuccessIndexedDBKey(int32 response_id,
+void IndexedDBDispatcher::OnSuccessIndexedDBKey(int32 thread_id,
+ int32 response_id,
const IndexedDBKey& key) {
+ DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
if (!callbacks)
return;
@@ -436,8 +488,10 @@ void IndexedDBDispatcher::OnSuccessIndexedDBKey(int32 response_id,
pending_callbacks_.Remove(response_id);
}
-void IndexedDBDispatcher::OnSuccessIDBTransaction(int32 response_id,
+void IndexedDBDispatcher::OnSuccessIDBTransaction(int32 thread_id,
+ int32 response_id,
int32 object_id) {
+ DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
if (!callbacks)
return;
@@ -446,7 +500,8 @@ void IndexedDBDispatcher::OnSuccessIDBTransaction(int32 response_id,
}
void IndexedDBDispatcher::OnSuccessStringList(
- int32 response_id, const std::vector<string16>& value) {
+ int32 thread_id, int32 response_id, const std::vector<string16>& value) {
+ DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
if (!callbacks)
return;
@@ -459,7 +514,9 @@ void IndexedDBDispatcher::OnSuccessStringList(
}
void IndexedDBDispatcher::OnSuccessSerializedScriptValue(
- int32 response_id, const content::SerializedScriptValue& value) {
+ int32 thread_id, int32 response_id,
+ const content::SerializedScriptValue& value) {
+ DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
if (!callbacks)
return;
@@ -467,11 +524,17 @@ void IndexedDBDispatcher::OnSuccessSerializedScriptValue(
pending_callbacks_.Remove(response_id);
}
-void IndexedDBDispatcher::OnSuccessOpenCursor(int32 repsonse_id,
- int32 object_id, const IndexedDBKey& key, const IndexedDBKey& primary_key,
- const content::SerializedScriptValue& value) {
+void IndexedDBDispatcher::OnSuccessOpenCursor(
+ const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) {
+ DCHECK_EQ(p.thread_id, CurrentWorkerId());
+ int32 response_id = p.response_id;
+ int32 object_id = p.cursor_id;
+ const IndexedDBKey& key = p.key;
+ const IndexedDBKey& primary_key = p.primary_key;
+ const content::SerializedScriptValue& value = p.serialized_value;
+
WebIDBCallbacks* callbacks =
- pending_callbacks_.Lookup(repsonse_id);
+ pending_callbacks_.Lookup(response_id);
if (!callbacks)
return;
@@ -480,15 +543,18 @@ void IndexedDBDispatcher::OnSuccessOpenCursor(int32 repsonse_id,
cursor->SetKeyAndValue(key, primary_key, value);
callbacks->onSuccess(cursor);
- pending_callbacks_.Remove(repsonse_id);
+ pending_callbacks_.Remove(response_id);
}
void IndexedDBDispatcher::OnSuccessCursorContinue(
- int32 response_id,
- int32 cursor_id,
- const IndexedDBKey& key,
- const IndexedDBKey& primary_key,
- const content::SerializedScriptValue& value) {
+ const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) {
+ DCHECK_EQ(p.thread_id, CurrentWorkerId());
+ int32 response_id = p.response_id;
+ int32 cursor_id = p.cursor_id;
+ const IndexedDBKey& key = p.key;
+ const IndexedDBKey& primary_key = p.primary_key;
+ const content::SerializedScriptValue& value = p.serialized_value;
+
RendererWebIDBCursorImpl* cursor = cursors_[cursor_id];
DCHECK(cursor);
cursor->SetKeyAndValue(key, primary_key, value);
@@ -502,11 +568,13 @@ void IndexedDBDispatcher::OnSuccessCursorContinue(
}
void IndexedDBDispatcher::OnSuccessCursorPrefetch(
- int32 response_id,
- int32 cursor_id,
- const std::vector<IndexedDBKey>& keys,
- const std::vector<IndexedDBKey>& primary_keys,
- const std::vector<content::SerializedScriptValue>& values) {
+ const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) {
+ DCHECK_EQ(p.thread_id, CurrentWorkerId());
+ int32 response_id = p.response_id;
+ int32 cursor_id = p.cursor_id;
+ const std::vector<IndexedDBKey>& keys = p.keys;
+ const std::vector<IndexedDBKey>& primary_keys = p.primary_keys;
+ const std::vector<content::SerializedScriptValue>& values = p.values;
RendererWebIDBCursorImpl* cursor = cursors_[cursor_id];
DCHECK(cursor);
cursor->SetPrefetchData(keys, primary_keys, values);
@@ -516,13 +584,15 @@ void IndexedDBDispatcher::OnSuccessCursorPrefetch(
pending_callbacks_.Remove(response_id);
}
-void IndexedDBDispatcher::OnBlocked(int32 response_id) {
+void IndexedDBDispatcher::OnBlocked(int32 thread_id, int32 response_id) {
+ DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
callbacks->onBlocked();
}
-void IndexedDBDispatcher::OnError(int32 response_id, int code,
+void IndexedDBDispatcher::OnError(int32 thread_id, int32 response_id, int code,
const string16& message) {
+ DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
if (!callbacks)
return;
@@ -530,7 +600,8 @@ void IndexedDBDispatcher::OnError(int32 response_id, int code,
pending_callbacks_.Remove(response_id);
}
-void IndexedDBDispatcher::OnAbort(int32 transaction_id) {
+void IndexedDBDispatcher::OnAbort(int32 thread_id, int32 transaction_id) {
+ DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBTransactionCallbacks* callbacks =
pending_transaction_callbacks_.Lookup(transaction_id);
if (!callbacks)
@@ -539,7 +610,8 @@ void IndexedDBDispatcher::OnAbort(int32 transaction_id) {
pending_transaction_callbacks_.Remove(transaction_id);
}
-void IndexedDBDispatcher::OnComplete(int32 transaction_id) {
+void IndexedDBDispatcher::OnComplete(int32 thread_id, int32 transaction_id) {
+ DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBTransactionCallbacks* callbacks =
pending_transaction_callbacks_.Lookup(transaction_id);
if (!callbacks)
@@ -548,8 +620,10 @@ void IndexedDBDispatcher::OnComplete(int32 transaction_id) {
pending_transaction_callbacks_.Remove(transaction_id);
}
-void IndexedDBDispatcher::OnVersionChange(int32 database_id,
+void IndexedDBDispatcher::OnVersionChange(int32 thread_id,
+ int32 database_id,
const string16& newVersion) {
+ DCHECK_EQ(thread_id, CurrentWorkerId());
WebIDBDatabaseCallbacks* callbacks =
pending_database_callbacks_.Lookup(database_id);
// callbacks would be NULL if a versionchange event is received after close
diff --git a/content/renderer/indexed_db_dispatcher.h b/content/renderer/indexed_db_dispatcher.h
index 6f7deef..dacd865 100644
--- a/content/renderer/indexed_db_dispatcher.h
+++ b/content/renderer/indexed_db_dispatcher.h
@@ -11,16 +11,24 @@
#include "base/id_map.h"
#include "base/nullable_string16.h"
-#include "ipc/ipc_channel.h"
#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/WebIDBDatabaseCallbacks.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCallbacks.h"
+#include "webkit/glue/worker_task_runner.h"
class IndexedDBKey;
+struct IndexedDBMsg_CallbacksSuccessCursorContinue_Params;
+struct IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params;
+struct IndexedDBMsg_CallbacksSuccessIDBCursor_Params;
class RendererWebIDBCursorImpl;
+namespace IPC {
+class Message;
+}
+
namespace WebKit {
class WebFrame;
class WebIDBKeyRange;
@@ -31,14 +39,17 @@ namespace content {
class SerializedScriptValue;
}
-// Handle the indexed db related communication for this entire renderer.
-class IndexedDBDispatcher : public IPC::Channel::Listener {
+// Handle the indexed db related communication for this context thread - the
+// main thread and each worker thread have their own copies.
+class IndexedDBDispatcher : public webkit_glue::WorkerTaskRunner::Observer {
public:
- IndexedDBDispatcher();
virtual ~IndexedDBDispatcher();
+ static IndexedDBDispatcher* ThreadSpecificInstance();
- // IPC::Channel::Listener implementation.
- virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
+ // webkit_glue::WorkerTaskRunner::Observer implementation.
+ virtual void OnWorkerRunLoopStopped() OVERRIDE;
+
+ void OnMessageReceived(const IPC::Message& msg);
void Send(IPC::Message* msg);
void RequestIDBFactoryGetDatabaseNames(
@@ -169,36 +180,41 @@ class IndexedDBDispatcher : public IPC::Channel::Listener {
static int32 TransactionId(const WebKit::WebIDBTransaction& transaction);
private:
+ IndexedDBDispatcher();
// IDBCallback message handlers.
void OnSuccessNull(int32 response_id);
- void OnSuccessIDBDatabase(int32 response_id, int32 object_id);
- void OnSuccessIndexedDBKey(int32 response_id, const IndexedDBKey& key);
- void OnSuccessIDBTransaction(int32 response_id, int32 object_id);
- void OnSuccessOpenCursor(int32 response_id, int32 object_id,
- const IndexedDBKey& key,
- const IndexedDBKey& primary_key,
- const content::SerializedScriptValue& value);
- void OnSuccessCursorContinue(int32 response_id,
- int32 cursor_id,
- const IndexedDBKey& key,
- const IndexedDBKey& primary_key,
- const content::SerializedScriptValue& value);
+ void OnSuccessIDBDatabase(int32 thread_id,
+ int32 response_id,
+ int32 object_id);
+ void OnSuccessIndexedDBKey(int32 thread_id,
+ int32 response_id,
+ const IndexedDBKey& key);
+ void OnSuccessIDBTransaction(int32 thread_id,
+ int32 response_id,
+ int32 object_id);
+ void OnSuccessOpenCursor(
+ const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p);
+ void OnSuccessCursorContinue(
+ const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p);
void OnSuccessCursorPrefetch(
- int32 response_id,
- int32 cursor_id,
- const std::vector<IndexedDBKey>& keys,
- const std::vector<IndexedDBKey>& primary_keys,
- const std::vector<content::SerializedScriptValue>& values);
- void OnSuccessStringList(int32 response_id,
+ const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p);
+ void OnSuccessStringList(int32 thread_id,
+ int32 response_id,
const std::vector<string16>& value);
void OnSuccessSerializedScriptValue(
+ int32 thread_id,
int32 response_id,
const content::SerializedScriptValue& value);
- void OnError(int32 response_id, int code, const string16& message);
- void OnBlocked(int32 response_id);
- void OnAbort(int32 transaction_id);
- void OnComplete(int32 transaction_id);
- void OnVersionChange(int32 database_id, const string16& newVersion);
+ void OnError(int32 thread_id,
+ int32 response_id,
+ int code,
+ const string16& message);
+ void OnBlocked(int32 thread_id, int32 response_id);
+ void OnAbort(int32 thread_id, int32 transaction_id);
+ void OnComplete(int32 thread_id, int32 transaction_id);
+ void OnVersionChange(int32 thread_id,
+ int32 database_id,
+ const string16& newVersion);
// Reset cursor prefetch caches for all cursors except exception_cursor_id.
void ResetCursorPrefetchCaches(int32 exception_cursor_id = -1);
diff --git a/content/renderer/indexed_db_message_filter.cc b/content/renderer/indexed_db_message_filter.cc
new file mode 100644
index 0000000..c6dac1a0
--- /dev/null
+++ b/content/renderer/indexed_db_message_filter.cc
@@ -0,0 +1,37 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/indexed_db_message_filter.h"
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "content/common/indexed_db_messages.h"
+#include "content/renderer/indexed_db_dispatcher.h"
+#include "webkit/glue/worker_task_runner.h"
+
+using webkit_glue::WorkerTaskRunner;
+
+IndexedDBMessageFilter::IndexedDBMessageFilter() :
+ main_thread_loop_proxy_(base::MessageLoopProxy::current()) {
+}
+
+IndexedDBMessageFilter::~IndexedDBMessageFilter() {
+}
+
+bool IndexedDBMessageFilter::OnMessageReceived(const IPC::Message& msg) {
+ if (IPC_MESSAGE_CLASS(msg) != IndexedDBMsgStart)
+ return false;
+ int thread_id = IPC::MessageIterator(msg).NextInt();
+ base::Closure closure = base::Bind(
+ &IndexedDBMessageFilter::DispatchMessage, this, msg);
+ if (thread_id)
+ WorkerTaskRunner::Instance()->PostTask(thread_id, closure);
+ else
+ main_thread_loop_proxy_->PostTask(FROM_HERE, closure);
+ return true;
+}
+
+void IndexedDBMessageFilter::DispatchMessage(const IPC::Message& msg) {
+ IndexedDBDispatcher::ThreadSpecificInstance()->OnMessageReceived(msg);
+}
diff --git a/content/renderer/indexed_db_message_filter.h b/content/renderer/indexed_db_message_filter.h
new file mode 100644
index 0000000..2302c66
--- /dev/null
+++ b/content/renderer/indexed_db_message_filter.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_INDEXED_DB_MESSAGE_FILTER_H_
+#define CONTENT_RENDERER_INDEXED_DB_MESSAGE_FILTER_H_
+#pragma once
+
+#include "ipc/ipc_channel_proxy.h"
+
+class IndexedDBDispatcher;
+
+class IndexedDBMessageFilter : public IPC::ChannelProxy::MessageFilter {
+ public:
+ IndexedDBMessageFilter();
+ virtual ~IndexedDBMessageFilter();
+
+ // IPC::Channel::Listener implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
+
+ private:
+ void DispatchMessage(const IPC::Message& msg);
+ scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_;
+
+ DISALLOW_COPY_AND_ASSIGN(IndexedDBMessageFilter);
+};
+
+#endif // CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index ad67e74..9f455bd 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -43,6 +43,7 @@
#include "content/renderer/gpu/compositor_thread.h"
#include "content/renderer/gpu/gpu_channel_host.h"
#include "content/renderer/indexed_db_dispatcher.h"
+#include "content/renderer/indexed_db_message_filter.h"
#include "content/renderer/media/audio_input_message_filter.h"
#include "content/renderer/media/audio_message_filter.h"
#include "content/renderer/media/video_capture_impl_manager.h"
@@ -198,7 +199,8 @@ void RenderThreadImpl::Init() {
task_factory_.reset(new ScopedRunnableMethodFactory<RenderThreadImpl>(this));
appcache_dispatcher_.reset(new AppCacheDispatcher(Get()));
- indexed_db_dispatcher_.reset(new IndexedDBDispatcher());
+ main_thread_indexed_db_dispatcher_.reset(
+ IndexedDBDispatcher::ThreadSpecificInstance());
db_message_filter_ = new DBMessageFilter();
AddFilter(db_message_filter_.get());
@@ -215,6 +217,8 @@ void RenderThreadImpl::Init() {
devtools_agent_message_filter_ = new DevToolsAgentFilter();
AddFilter(devtools_agent_message_filter_.get());
+ AddFilter(new IndexedDBMessageFilter);
+
content::GetContentClient()->renderer()->RenderThreadStarted();
TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, "");
@@ -708,8 +712,6 @@ bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
// Some messages are handled by delegates.
if (appcache_dispatcher_->OnMessageReceived(msg))
return true;
- if (indexed_db_dispatcher_->OnMessageReceived(msg))
- return true;
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(RenderThreadImpl, msg)
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 683bc6b..1a4b4ee 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -134,10 +134,6 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
return appcache_dispatcher_.get();
}
- IndexedDBDispatcher* indexed_db_dispatcher() const {
- return indexed_db_dispatcher_.get();
- }
-
AudioInputMessageFilter* audio_input_message_filter() {
return audio_input_message_filter_.get();
}
@@ -193,7 +189,7 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
// These objects live solely on the render thread.
scoped_ptr<ScopedRunnableMethodFactory<RenderThreadImpl> > task_factory_;
scoped_ptr<AppCacheDispatcher> appcache_dispatcher_;
- scoped_ptr<IndexedDBDispatcher> indexed_db_dispatcher_;
+ scoped_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_;
scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_;
scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_;
diff --git a/content/renderer/renderer_webidbcursor_impl.cc b/content/renderer/renderer_webidbcursor_impl.cc
index 58113ad..e5e0f29 100644
--- a/content/renderer/renderer_webidbcursor_impl.cc
+++ b/content/renderer/renderer_webidbcursor_impl.cc
@@ -29,7 +29,7 @@ RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() {
ChildThread::current()->Send(new IndexedDBHostMsg_CursorDestroyed(
idb_cursor_id_));
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->CursorDestroyed(idb_cursor_id_);
}
@@ -56,7 +56,7 @@ void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value,
WebIDBCallbacks* callbacks,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBCursorUpdate(
content::SerializedScriptValue(value), callbacks, idb_cursor_id_, &ec);
}
@@ -65,7 +65,7 @@ void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key,
WebIDBCallbacks* callbacks,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
if (key.type() == WebIDBKey::InvalidType) {
// No key, so this would qualify for a prefetch.
@@ -101,7 +101,7 @@ void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key,
void RendererWebIDBCursorImpl::deleteFunction(WebIDBCallbacks* callbacks,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec);
}
@@ -169,7 +169,7 @@ void RendererWebIDBCursorImpl::ResetPrefetchCache() {
}
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBCursorPrefetchReset(used_prefetches_,
prefetch_keys_.size(),
idb_cursor_id_);
diff --git a/content/renderer/renderer_webidbdatabase_impl.cc b/content/renderer/renderer_webidbdatabase_impl.cc
index 79fc28b..90eea27 100644
--- a/content/renderer/renderer_webidbdatabase_impl.cc
+++ b/content/renderer/renderer_webidbdatabase_impl.cc
@@ -11,6 +11,7 @@
#include "content/renderer/renderer_webidbtransaction_impl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
+#include "webkit/glue/worker_task_runner.h"
using WebKit::WebDOMStringList;
using WebKit::WebExceptionCode;
@@ -20,6 +21,7 @@ using WebKit::WebIDBDatabaseCallbacks;
using WebKit::WebIDBTransaction;
using WebKit::WebString;
using WebKit::WebVector;
+using webkit_glue::WorkerTaskRunner;
RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 idb_database_id)
: idb_database_id_(idb_database_id) {
@@ -97,7 +99,7 @@ void RendererWebIDBDatabaseImpl::setVersion(
WebIDBCallbacks* callbacks,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBDatabaseSetVersion(
version, callbacks, idb_database_id_, &ec);
}
@@ -112,10 +114,9 @@ WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction(
object_stores.push_back(names.item(i));
int transaction_id;
- ChildThread::current()->Send(
- new IndexedDBHostMsg_DatabaseTransaction(
- idb_database_id_, object_stores, mode,
- &transaction_id, &ec));
+ ChildThread::current()->Send(new IndexedDBHostMsg_DatabaseTransaction(
+ WorkerTaskRunner::Instance()->CurrentWorkerId(),
+ idb_database_id_, object_stores, mode, &transaction_id, &ec));
if (!transaction_id)
return NULL;
return new RendererWebIDBTransactionImpl(transaction_id);
@@ -123,12 +124,13 @@ WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction(
void RendererWebIDBDatabaseImpl::close() {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBDatabaseClose(idb_database_id_);
}
void RendererWebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
+ DCHECK(dispatcher);
dispatcher->RequestIDBDatabaseOpen(callbacks, idb_database_id_);
}
diff --git a/content/renderer/renderer_webidbfactory_impl.cc b/content/renderer/renderer_webidbfactory_impl.cc
index b84cf29..bd13b6c 100644
--- a/content/renderer/renderer_webidbfactory_impl.cc
+++ b/content/renderer/renderer_webidbfactory_impl.cc
@@ -28,7 +28,7 @@ void RendererWebIDBFactoryImpl::getDatabaseNames(
WebFrame* web_frame,
const WebString& data_dir_unused) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBFactoryGetDatabaseNames(
callbacks, origin.databaseIdentifier(), web_frame);
}
@@ -42,7 +42,7 @@ void RendererWebIDBFactoryImpl::open(
// Don't send the data_dir. We know what we want on the Browser side of
// things.
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBFactoryOpen(
name, callbacks, origin.databaseIdentifier(), web_frame);
}
@@ -56,7 +56,7 @@ void RendererWebIDBFactoryImpl::deleteDatabase(
// Don't send the data_dir. We know what we want on the Browser side of
// things.
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBFactoryDeleteDatabase(
name, callbacks, origin.databaseIdentifier(), web_frame);
}
diff --git a/content/renderer/renderer_webidbindex_impl.cc b/content/renderer/renderer_webidbindex_impl.cc
index 89b5255..7260408 100644
--- a/content/renderer/renderer_webidbindex_impl.cc
+++ b/content/renderer/renderer_webidbindex_impl.cc
@@ -64,7 +64,7 @@ void RendererWebIDBIndexImpl::openObjectCursor(
const WebKit::WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBIndexOpenObjectCursor(
range, direction, callbacks, idb_index_id_, transaction, &ec);
}
@@ -76,7 +76,7 @@ void RendererWebIDBIndexImpl::openKeyCursor(
const WebKit::WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBIndexOpenKeyCursor(
range, direction, callbacks, idb_index_id_, transaction, &ec);
}
@@ -87,7 +87,7 @@ void RendererWebIDBIndexImpl::getObject(
const WebKit::WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBIndexGetObject(
IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec);
}
@@ -98,7 +98,7 @@ void RendererWebIDBIndexImpl::getKey(
const WebKit::WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBIndexGetKey(
IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec);
}
diff --git a/content/renderer/renderer_webidbobjectstore_impl.cc b/content/renderer/renderer_webidbobjectstore_impl.cc
index 734314b..04fe1cb 100644
--- a/content/renderer/renderer_webidbobjectstore_impl.cc
+++ b/content/renderer/renderer_webidbobjectstore_impl.cc
@@ -75,7 +75,7 @@ void RendererWebIDBObjectStoreImpl::get(
const WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBObjectStoreGet(
IndexedDBKey(key), callbacks, idb_object_store_id_, transaction, &ec);
}
@@ -88,7 +88,7 @@ void RendererWebIDBObjectStoreImpl::put(
const WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBObjectStorePut(
content::SerializedScriptValue(value), IndexedDBKey(key), put_mode,
callbacks, idb_object_store_id_, transaction, &ec);
@@ -100,7 +100,7 @@ void RendererWebIDBObjectStoreImpl::deleteFunction(
const WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBObjectStoreDelete(
IndexedDBKey(key), callbacks, idb_object_store_id_, transaction, &ec);
}
@@ -110,7 +110,7 @@ void RendererWebIDBObjectStoreImpl::clear(
const WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBObjectStoreClear(
callbacks, idb_object_store_id_, transaction, &ec);
}
@@ -166,7 +166,7 @@ void RendererWebIDBObjectStoreImpl::openCursor(
const WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RequestIDBObjectStoreOpenCursor(
idb_key_range, direction, callbacks, idb_object_store_id_,
transaction, &ec);
diff --git a/content/renderer/renderer_webidbtransaction_impl.cc b/content/renderer/renderer_webidbtransaction_impl.cc
index 1d49c8d..a7d2814 100644
--- a/content/renderer/renderer_webidbtransaction_impl.cc
+++ b/content/renderer/renderer_webidbtransaction_impl.cc
@@ -68,7 +68,7 @@ void RendererWebIDBTransactionImpl::setCallbacks(
WebIDBTransactionCallbacks* callbacks)
{
IndexedDBDispatcher* dispatcher =
- RenderThreadImpl::current()->indexed_db_dispatcher();
+ IndexedDBDispatcher::ThreadSpecificInstance();
dispatcher->RegisterWebIDBTransactionCallbacks(callbacks,
idb_transaction_id_);
}