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

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

Issue 2930183002: Let IndexedDBContextImpl create its own task runner (Closed)
Patch Set: Actually compile Created 3 years, 5 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/indexed_db/indexed_db_dispatcher_host.cc
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.cc b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
index fb4f1dfadfae44033fda7718779e7d3d630bc74e..fb4702936f39259e114cec6669857469874fc684 100644
--- a/content/browser/indexed_db/indexed_db_dispatcher_host.cc
+++ b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
@@ -75,21 +75,16 @@ IndexedDBDispatcherHost::IndexedDBDispatcherHost(
scoped_refptr<ChromeBlobStorageContext> blob_storage_context)
: indexed_db_context_(std::move(indexed_db_context)),
blob_storage_context_(std::move(blob_storage_context)),
- idb_runner_(indexed_db_context_->TaskRunner()),
ipc_process_id_(ipc_process_id),
+ idb_helper_(new IDBSequenceHelper(ipc_process_id_,
+ std::move(request_context_getter),
+ indexed_db_context_)),
weak_factory_(this) {
- // Can be null in unittests.
- idb_helper_ = idb_runner_
- ? new IDBSequenceHelper(ipc_process_id_,
- std::move(request_context_getter),
- indexed_db_context_)
- : nullptr;
DCHECK(indexed_db_context_.get());
}
IndexedDBDispatcherHost::~IndexedDBDispatcherHost() {
- if (idb_helper_)
- idb_runner_->DeleteSoon(FROM_HERE, idb_helper_);
+ IDBTaskRunner()->DeleteSoon(FROM_HERE, idb_helper_);
}
void IndexedDBDispatcherHost::AddBinding(
@@ -173,8 +168,8 @@ void IndexedDBDispatcherHost::GetDatabaseNames(
}
scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks(
- this->AsWeakPtr(), origin, std::move(callbacks_info), idb_runner_));
- idb_runner_->PostTask(
+ this->AsWeakPtr(), origin, std::move(callbacks_info), IDBTaskRunner()));
+ IDBTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(&IDBSequenceHelper::GetDatabaseNamesOnIDBThread,
base::Unretained(idb_helper_),
base::Passed(&callbacks), origin));
@@ -196,11 +191,11 @@ void IndexedDBDispatcherHost::Open(
}
scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks(
- this->AsWeakPtr(), origin, std::move(callbacks_info), idb_runner_));
+ this->AsWeakPtr(), origin, std::move(callbacks_info), IDBTaskRunner()));
scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks(
new IndexedDBDatabaseCallbacks(indexed_db_context_,
std::move(database_callbacks_info)));
- idb_runner_->PostTask(
+ IDBTaskRunner()->PostTask(
FROM_HERE,
base::BindOnce(&IDBSequenceHelper::OpenOnIDBThread,
base::Unretained(idb_helper_), base::Passed(&callbacks),
@@ -221,8 +216,8 @@ void IndexedDBDispatcherHost::DeleteDatabase(
}
scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks(
- this->AsWeakPtr(), origin, std::move(callbacks_info), idb_runner_));
- idb_runner_->PostTask(
+ this->AsWeakPtr(), origin, std::move(callbacks_info), IDBTaskRunner()));
+ IDBTaskRunner()->PostTask(
FROM_HERE,
base::BindOnce(&IDBSequenceHelper::DeleteDatabaseOnIDBThread,
base::Unretained(idb_helper_), base::Passed(&callbacks),
@@ -235,6 +230,10 @@ void IndexedDBDispatcherHost::InvalidateWeakPtrsAndClearBindings() {
database_bindings_.CloseAllBindings();
}
+base::SequencedTaskRunner* IndexedDBDispatcherHost::IDBTaskRunner() const {
+ return indexed_db_context_->TaskRunner();
+}
+
void IndexedDBDispatcherHost::IDBSequenceHelper::GetDatabaseNamesOnIDBThread(
scoped_refptr<IndexedDBCallbacks> callbacks,
const url::Origin& origin) {

Powered by Google App Engine
This is Rietveld 408576698