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

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

Issue 1428973003: Utilize ProfileInfoCache to support data type counts in profile deletion flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments Created 5 years 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
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();
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_statistics.h » ('j') | chrome/browser/profiles/profile_statistics.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698