Skip to content

Commit

Permalink
[Merge M100] [crash] Never try to initialize SessionService before pr…
Browse files Browse the repository at this point in the history
…ofile prefs are loaded

Diagnosis @ crbug.com/1300724#c4

(cherry picked from commit e92e082)

Fixed: 1300724
Change-Id: I074f9c63cd2325731612140e53ba0390707b0a57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3510667
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#978864}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3550760
Cr-Commit-Position: refs/branch-heads/4896@{#866}
Cr-Branched-From: 1f63ff4-refs/heads/main@{#972766}
  • Loading branch information
Gabriel Charette authored and Chromium LUCI CQ committed Mar 25, 2022
1 parent f531ed0 commit 90f79ad
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions chrome/browser/profiles/profile_impl.cc
Expand Up @@ -459,12 +459,6 @@ ProfileImpl::ProfileImpl(
}
#endif

#if BUILDFLAG(ENABLE_SESSION_SERVICE)
create_session_service_timer_.Start(
FROM_HERE, kCreateSessionServiceDelay, this,
&ProfileImpl::EnsureSessionServiceCreated);
#endif

if (path == ProfileManager::GetGuestProfilePath()) {
profile_metrics::SetBrowserProfileType(
this, profile_metrics::BrowserProfileType::kGuest);
Expand Down Expand Up @@ -1148,6 +1142,15 @@ void ProfileImpl::OnPrefsLoaded(CreateMode create_mode, bool success) {
#else
OnLocaleReady(create_mode);
#endif

#if BUILDFLAG(ENABLE_SESSION_SERVICE)
// SessionService depends on Profile::GetPrefs() and therefore shouldn't be
// forced initialized before prefs are loaded. Starting this Timer before
// that point resulted in a racy use-before-initialized in the past.
create_session_service_timer_.Start(
FROM_HERE, kCreateSessionServiceDelay, this,
&ProfileImpl::EnsureSessionServiceCreated);
#endif
}

bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) {
Expand Down

0 comments on commit 90f79ad

Please sign in to comment.