Index: chrome/browser/profiles/profile_manager.cc |
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc |
index 716adf8e208510dba59be5adee534fec0da59a1c..76ccba1fce2453b362c8b08cdbe9afb8cff8b516 100644 |
--- a/chrome/browser/profiles/profile_manager.cc |
+++ b/chrome/browser/profiles/profile_manager.cc |
@@ -38,6 +38,7 @@ |
#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/signin/account_fetcher_service_factory.h" |
#include "chrome/browser/signin/account_reconcilor_factory.h" |
@@ -1055,6 +1056,14 @@ void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) { |
chrome::NOTIFICATION_PROFILE_ADDED, |
content::Source<Profile>(profile), |
content::NotificationService::NoDetails()); |
+ |
+ // 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::StoreProfileStatisticsToCache(profile); |
+ } |
} |
void ProfileManager::DoFinalInitForServices(Profile* profile, |
@@ -1461,6 +1470,9 @@ void ProfileManager::BrowserListObserver::OnBrowserRemoved( |
return; |
} |
+ // Store statistics into ProfileInfoCache. |
+ profiles::StoreProfileStatisticsToCache(profile); |
+ |
// If the last browser of a profile that is scheduled for deletion is closed |
// do that now. |
base::FilePath path = profile->GetPath(); |