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

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: Fix: do not attempt to create statistics of incognito profiles 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..4259ea98870bb083c6d2e1e053fbd9e53c3c2367 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,15 @@ 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::GatherProfileStatistics(
+ profile, profiles::ProfileStatisticsCallback(), nullptr);
+ }
}
void ProfileManager::DoFinalInitForServices(Profile* profile,
@@ -1468,6 +1478,13 @@ void ProfileManager::BrowserListObserver::OnBrowserRemoved(
!IsProfileMarkedForDeletion(path)) {
g_browser_process->profile_manager()->ScheduleProfileForDeletion(
path, ProfileManager::CreateCallback());
+ return;
+ }
+
+ // Otherwise store statistics into ProfileInfoCache.
+ if (!profile->IsOffTheRecord()) {
lwchkg 2015/12/22 13:26:00 Mike said that this function handles incognito pro
Mike Lerman 2015/12/23 20:25:50 This, uh, really should handle incognito (and gues
lwchkg 2015/12/24 07:14:32 Thanks. This is likely a bug behind. Maybe someone
lwchkg 2015/12/29 04:51:43 (1) Investigated the code about the BrowserListObs
+ profiles::GatherProfileStatistics(
+ profile, profiles::ProfileStatisticsCallback(), nullptr);
}
}
« 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