Skip to content

Commit

Permalink
Fixed redundant creation of Default profile
Browse files Browse the repository at this point in the history
  • Loading branch information
spylogsster committed Jun 23, 2022
1 parent 542ffc5 commit a2bbb20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions browser/brave_stats/brave_stats_updater.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ BraveStatsUpdater::BraveStatsUpdater(PrefService* pref_service)
BraveStatsUpdater::~BraveStatsUpdater() {}

void BraveStatsUpdater::OnProfileAdded(Profile* profile) {
if (profile == ProfileManager::GetPrimaryUserProfile()) {
if (profile == ProfileManager::GetLastUsedProfile()) {
g_browser_process->profile_manager()->RemoveObserver(this);
Start();
}
Expand Down Expand Up @@ -190,7 +190,8 @@ PrefService* BraveStatsUpdater::GetProfilePrefs() {
if (testing_profile_prefs_ != nullptr) {
return testing_profile_prefs_;
}
return ProfileManager::GetPrimaryUserProfile()->GetPrefs();

return ProfileManager::GetLastUsedProfile()->GetPrefs();
}

// static
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ BraveReferralsService::BraveReferralsService(PrefService* pref_service,
BraveReferralsService::~BraveReferralsService() {}

void BraveReferralsService::OnProfileAdded(Profile* profile) {
if (profile == ProfileManager::GetPrimaryUserProfile()) {
if (profile == ProfileManager::GetLastUsedProfile()) {
g_browser_process->profile_manager()->RemoveObserver(this);
Start();
}
Expand Down

0 comments on commit a2bbb20

Please sign in to comment.