Commit 5e6276e1 authored by Peter Qiu's avatar Peter Qiu Committed by Commit Bot

[Chromecast] Setup home directory before creating PrefService

PrefService requires home directory to be setup before the
underlying pref store (JsonPrefStore) can be initialized
properly.

Now that the creation of PrefService is moved from
CastBrowserMainParts::PreCreateThreads
to CastMainDelegate::PostEarlyInitialization, we need
to do the same for home directory creation as well.

Bug: internal b/119800555
Test: Test locally on a cast build
Change-Id: I513680c3b30dbd0c9cc862d87604376e502be763
Reviewed-on: https://chromium-review.googlesource.com/c/1352038Reviewed-by: default avatarSean Topping <seantopping@chromium.org>
Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Reviewed-by: default avatarSimeon Anfinrud <sanfin@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611540}
parent 6c71a7c7
...@@ -204,6 +204,14 @@ bool CastMainDelegate::ShouldCreateFeatureList() { ...@@ -204,6 +204,14 @@ bool CastMainDelegate::ShouldCreateFeatureList() {
void CastMainDelegate::PostEarlyInitialization(bool is_running_tests) { void CastMainDelegate::PostEarlyInitialization(bool is_running_tests) {
DCHECK(cast_feature_list_creator_); DCHECK(cast_feature_list_creator_);
#if !defined(OS_ANDROID)
// PrefService requires home directory to be created before the pref
// store can be initialized properly.
base::FilePath home_dir;
CHECK(base::PathService::Get(DIR_CAST_HOME, &home_dir));
CHECK(base::CreateDirectory(home_dir));
#endif // !defined(OS_ANDROID)
// The |FieldTrialList| is a dependency of the feature list. // The |FieldTrialList| is a dependency of the feature list.
field_trial_list_ = std::make_unique<base::FieldTrialList>(nullptr); field_trial_list_ = std::make_unique<base::FieldTrialList>(nullptr);
......
...@@ -421,11 +421,6 @@ int CastBrowserMainParts::PreCreateThreads() { ...@@ -421,11 +421,6 @@ int CastBrowserMainParts::PreCreateThreads() {
crash_reporter::ChildExitObserver::GetInstance()->RegisterClient( crash_reporter::ChildExitObserver::GetInstance()->RegisterClient(
std::make_unique<crash_reporter::ChildProcessCrashObserver>( std::make_unique<crash_reporter::ChildProcessCrashObserver>(
crash_dumps_dir, kAndroidMinidumpDescriptor)); crash_dumps_dir, kAndroidMinidumpDescriptor));
#else
base::FilePath home_dir;
CHECK(base::PathService::Get(DIR_CAST_HOME, &home_dir));
if (!base::CreateDirectory(home_dir))
return 1;
#endif #endif
cast_browser_process_->SetPrefService( cast_browser_process_->SetPrefService(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment