Chromium Code Reviews| 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 |