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

Unified Diff: content/browser/storage_partition_impl.cc

Issue 1504033007: Move Indexed DB from dedicated thread to task scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timer
Patch Set: Rebased Created 3 years, 6 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/storage_partition_impl.cc
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index dbea3089dcedd5db9aadf7a77f1ca91fa4c4a054..826b2c42346f95cc69b7358a616492153eb151ff 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -15,6 +15,7 @@
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task_scheduler/post_task.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/browsing_data/storage_partition_http_cache_data_remover.h"
@@ -471,16 +472,18 @@ std::unique_ptr<StoragePartitionImpl> StoragePartitionImpl::Create(
in_memory ? base::FilePath() : context->GetPath(),
relative_partition_path, context->GetSpecialStoragePolicy());
+ // TODO(jsbell): Create task runner within IndexedDBContextImpl.
// BrowserMainLoop may not be initialized in unit tests. Tests will
// need to inject their own task runner into the IndexedDBContext.
gab 2017/06/12 15:13:07 This is no longer true, so long as tests have a ba
jsbell 2017/06/12 16:19:02 Yes...
- base::SequencedTaskRunner* idb_task_runner =
+ scoped_refptr<base::SequencedTaskRunner> idb_task_runner =
BrowserThread::CurrentlyOn(BrowserThread::UI) &&
BrowserMainLoop::GetInstance()
- ? BrowserMainLoop::GetInstance()
- ->indexed_db_thread()
- ->task_runner()
- .get()
- : NULL;
+ ? base::CreateSequencedTaskRunnerWithTraits({
+ base::MayBlock(), base::WithBaseSyncPrimitives(),
+ base::TaskPriority::BACKGROUND,
dmurph 2017/06/09 19:15:07 CAn you run the idb perf tests to see what the imp
jsbell 2017/06/09 20:50:30 Thanks for the reminder! Done. Summary: no signif
gab 2017/06/12 15:13:08 What is the IDB thread responsible for? Is none of
jsbell 2017/06/12 16:19:02 It runs asynchronous database requests on behalf o
gab 2017/06/12 16:49:11 If it *can* be user visible then it should use Tas
jsbell 2017/06/12 17:45:31 Okay - went with USER_VISIBLE (The IndexedDB API
gab 2017/06/12 17:59:05 Right, remember that post-mortem, USER_VISIBLE sur
+ base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN,
gab 2017/06/12 15:13:08 Would it be safe to CONTINUE_ON_SHUTDOWN? Or do we
jsbell 2017/06/12 16:19:02 Looking at the docs... CONTINUE has some scary cav
gab 2017/06/12 16:49:11 "from under you" is referring to things that are r
jsbell 2017/06/12 17:45:31 Okay - being "conservative" and going with SKIP; l
gab 2017/06/12 17:59:05 Perfect, that way we can avoid this bigger change
+ })
+ : nullptr;
base::FilePath path = in_memory ? base::FilePath() : partition_path;
partition->indexed_db_context_ =

Powered by Google App Engine
This is Rietveld 408576698