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

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

Issue 2930183002: Let IndexedDBContextImpl create its own task runner (Closed)
Patch Set: rebased 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_context_impl.cc
diff --git a/content/browser/indexed_db/indexed_db_context_impl.cc b/content/browser/indexed_db/indexed_db_context_impl.cc
index c64f52eb195e02490dfc0ef400c7f2d057822ba7..b687171bbc5d028f45954cd4ad76e27bf4f519de 100644
--- a/content/browser/indexed_db/indexed_db_context_impl.cc
+++ b/content/browser/indexed_db/indexed_db_context_impl.cc
@@ -17,6 +17,7 @@
#include "base/sequenced_task_runner.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
@@ -33,8 +34,6 @@
#include "content/public/browser/indexed_db_info.h"
#include "content/public/common/content_switches.h"
#include "storage/browser/database/database_util.h"
-#include "storage/browser/quota/quota_manager_proxy.h"
-#include "storage/browser/quota/special_storage_policy.h"
#include "storage/common/database/database_identifier.h"
#include "ui/base/text/bytes_formatting.h"
#include "url/origin.h"
@@ -108,13 +107,15 @@ void ClearSessionOnlyOrigins(
IndexedDBContextImpl::IndexedDBContextImpl(
const base::FilePath& data_path,
- storage::SpecialStoragePolicy* special_storage_policy,
- storage::QuotaManagerProxy* quota_manager_proxy,
- scoped_refptr<base::SequencedTaskRunner> task_runner)
+ scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy,
+ scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy)
: force_keep_session_state_(false),
special_storage_policy_(special_storage_policy),
quota_manager_proxy_(quota_manager_proxy),
- task_runner_(std::move(task_runner)) {
+ task_runner_(base::CreateSequencedTaskRunnerWithTraits(
+ {base::MayBlock(), base::WithBaseSyncPrimitives(),
+ base::TaskPriority::USER_VISIBLE,
+ base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})) {
IDB_TRACE("init");
if (!data_path.empty())
data_path_ = data_path.Append(kIndexedDBDirectory);
@@ -426,9 +427,13 @@ base::FilePath IndexedDBContextImpl::GetFilePathForTesting(
}
void IndexedDBContextImpl::SetTaskRunnerForTesting(
- base::SequencedTaskRunner* task_runner) {
- DCHECK(!task_runner_.get());
- task_runner_ = task_runner;
+ scoped_refptr<base::SequencedTaskRunner> task_runner) {
+ task_runner_ = std::move(task_runner);
+}
+
+void IndexedDBContextImpl::ResetCachesForTesting() {
+ origin_set_.reset();
+ origin_size_map_.clear();
}
void IndexedDBContextImpl::ConnectionOpened(const Origin& origin,
@@ -559,12 +564,8 @@ std::set<Origin>* IndexedDBContextImpl::GetOriginSet() {
return origin_set_.get();
}
-void IndexedDBContextImpl::ResetCaches() {
- origin_set_.reset();
- origin_size_map_.clear();
-}
-
base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const {
+ DCHECK(task_runner_.get());
return task_runner_.get();
}
« no previous file with comments | « content/browser/indexed_db/indexed_db_context_impl.h ('k') | content/browser/indexed_db/indexed_db_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698