Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6547)

Unified Diff: chrome/browser/profiles/profile_manager.cc

Issue 1579433002: Make profile statistics tasks inspectable by tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed ProfileAttributesStorage related functions in profile_statistics.* Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_statistics.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index a5de32353bfd31510a41fb5424bf5be5538b831b..34a3f05c95977be104e5a14482a1d6e63c15a8d2 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -42,7 +42,6 @@
#include "chrome/browser/profiles/profile_destroyer.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_metrics.h"
-#include "chrome/browser/profiles/profile_statistics.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/signin/account_fetcher_service_factory.h"
@@ -123,6 +122,11 @@
#include "components/user_manager/user_manager.h"
#endif
+#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
+#include "chrome/browser/profiles/profile_statistics.h"
+#include "chrome/browser/profiles/profile_statistics_factory.h"
+#endif
+
using base::UserMetricsAction;
using content::BrowserThread;
@@ -1065,14 +1069,16 @@ void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) {
content::Source<Profile>(profile),
content::NotificationService::NoDetails());
+#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
// Record statistics to ProfileInfoCache if statistics were not recorded
// during shutdown, i.e. the last shutdown was a system shutdown or a crash.
if (!profile->IsGuestSession() && !profile->IsSystemProfile() &&
!profile->IsNewProfile() && !go_off_the_record &&
profile->GetLastSessionExitType() != Profile::EXIT_NORMAL) {
- profiles::GatherProfileStatistics(
- profile, profiles::ProfileStatisticsCallback(), nullptr);
+ ProfileStatisticsFactory::GetForProfile(profile)->GatherStatistics(
+ profiles::ProfileStatisticsCallback());
}
+#endif
}
void ProfileManager::DoFinalInitForServices(Profile* profile,
@@ -1504,12 +1510,16 @@ void ProfileManager::BrowserListObserver::OnBrowserRemoved(
// Delete if the profile is an ephemeral profile.
g_browser_process->profile_manager()->ScheduleProfileForDeletion(
path, ProfileManager::CreateCallback());
- } else if (!profile->IsSystemProfile()) {
+ } else {
+#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
// Gather statistics and store into ProfileInfoCache. For incognito profile
// we gather the statistics of its parent profile instead, because a window
// of the parent profile was open.
- profiles::GatherProfileStatistics(
- original_profile, profiles::ProfileStatisticsCallback(), nullptr);
+ if (!profile->IsSystemProfile()) {
+ ProfileStatisticsFactory::GetForProfile(original_profile)->
+ GatherStatistics(profiles::ProfileStatisticsCallback());
+ }
+#endif
}
}
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_statistics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698