fix assertion caused by PrefServiceFactory::Create

This commit is contained in:
Cheng Zhao
2018-07-10 17:14:50 +09:00
parent fcf4c9cef1
commit 1ebb8975a8

View File

@@ -100,14 +100,12 @@ BrowserContext::~BrowserContext() {
}
void BrowserContext::InitPrefs() {
base::ThreadRestrictions::ScopedAllowIO allow_io;
auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences"));
PrefServiceFactory prefs_factory;
scoped_refptr<JsonPrefStore> pref_store =
base::MakeRefCounted<JsonPrefStore>(prefs_path);
{
base::ThreadRestrictions::ScopedAllowIO allow_io;
pref_store->ReadPrefs(); // Synchronous.
}
pref_store->ReadPrefs(); // Synchronous.
prefs_factory.set_user_prefs(pref_store);
auto registry = make_scoped_refptr(new PrefRegistrySimple);