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

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 11027070: Moved JsonPrefStore to use SequencedWorkerPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
« no previous file with comments | « chrome/browser/prefs/pref_service_unittest.cc ('k') | chrome/browser/sync/credential_cache_service_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 98cd169196aabbd48c1a770d63a16a5441d6c810..fa94dd8edf8cd9ef3c61189ea7ff4ad9d7fc5359 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -16,6 +16,7 @@
#include "base/string_tokenizer.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "base/utf_string_conversions.h"
#include "base/version.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
@@ -210,10 +211,17 @@ Profile* Profile::CreateProfile(const FilePath& path,
CreateMode create_mode) {
if (create_mode == CREATE_MODE_ASYNCHRONOUS) {
DCHECK(delegate);
- // This is safe while all file operations are done on the FILE thread.
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&CreateDirectoryNoResult, path));
+ // We need to make sure that profile directory is created on the same
+ // blocking pool where we will run all its important file serialization
+ // tasks (i.e. JsonPrefStore).
+ scoped_refptr<base::SequencedTaskRunner> task_runner =
+ BrowserThread::GetBlockingPool()->
+ GetSequencedTaskRunnerWithShutdownBehavior(
+ BrowserThread::GetBlockingPool()->GetNamedSequenceToken(
+ path.AsUTF8Unsafe()),
willchan no longer on Chromium 2012/10/11 23:19:31 The only thing that makes me feel nervous about th
zel 2012/10/12 23:15:32 I have isolated SequencedTaskRunner and shared it
+ base::SequencedWorkerPool::BLOCK_SHUTDOWN);
+ task_runner->PostTask(FROM_HERE,
+ base::Bind(&CreateDirectoryNoResult, path));
} else if (create_mode == CREATE_MODE_SYNCHRONOUS) {
if (!file_util::PathExists(path)) {
// TODO(tc): http://b/1094718 Bad things happen if we can't write to the
« no previous file with comments | « chrome/browser/prefs/pref_service_unittest.cc ('k') | chrome/browser/sync/credential_cache_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698