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

Side by Side 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: Added storing to ProfileInfoCache at startup after a non-normal shutdown Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/profile_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 20 matching lines...) Expand all
31 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 31 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
32 #include "chrome/browser/password_manager/password_manager_setting_migrator_serv ice.h" 32 #include "chrome/browser/password_manager/password_manager_setting_migrator_serv ice.h"
33 #include "chrome/browser/password_manager/password_manager_setting_migrator_serv ice_factory.h" 33 #include "chrome/browser/password_manager/password_manager_setting_migrator_serv ice_factory.h"
34 #include "chrome/browser/password_manager/password_store_factory.h" 34 #include "chrome/browser/password_manager/password_store_factory.h"
35 #include "chrome/browser/prefs/incognito_mode_prefs.h" 35 #include "chrome/browser/prefs/incognito_mode_prefs.h"
36 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" 36 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h"
37 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 37 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
38 #include "chrome/browser/profiles/profile_destroyer.h" 38 #include "chrome/browser/profiles/profile_destroyer.h"
39 #include "chrome/browser/profiles/profile_info_cache.h" 39 #include "chrome/browser/profiles/profile_info_cache.h"
40 #include "chrome/browser/profiles/profile_metrics.h" 40 #include "chrome/browser/profiles/profile_metrics.h"
41 #include "chrome/browser/profiles/profile_statistics.h"
41 #include "chrome/browser/profiles/profiles_state.h" 42 #include "chrome/browser/profiles/profiles_state.h"
42 #include "chrome/browser/signin/account_fetcher_service_factory.h" 43 #include "chrome/browser/signin/account_fetcher_service_factory.h"
43 #include "chrome/browser/signin/account_reconcilor_factory.h" 44 #include "chrome/browser/signin/account_reconcilor_factory.h"
44 #include "chrome/browser/signin/account_tracker_service_factory.h" 45 #include "chrome/browser/signin/account_tracker_service_factory.h"
45 #include "chrome/browser/signin/cross_device_promo.h" 46 #include "chrome/browser/signin/cross_device_promo.h"
46 #include "chrome/browser/signin/cross_device_promo_factory.h" 47 #include "chrome/browser/signin/cross_device_promo_factory.h"
47 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" 48 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
48 #include "chrome/browser/signin/signin_manager_factory.h" 49 #include "chrome/browser/signin/signin_manager_factory.h"
49 #include "chrome/browser/sync/profile_sync_service.h" 50 #include "chrome/browser/sync/profile_sync_service.h"
50 #include "chrome/browser/sync/profile_sync_service_factory.h" 51 #include "chrome/browser/sync/profile_sync_service_factory.h"
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 1045
1045 DoFinalInitForServices(profile, go_off_the_record); 1046 DoFinalInitForServices(profile, go_off_the_record);
1046 AddProfileToCache(profile); 1047 AddProfileToCache(profile);
1047 DoFinalInitLogging(profile); 1048 DoFinalInitLogging(profile);
1048 1049
1049 ProfileMetrics::LogNumberOfProfiles(this); 1050 ProfileMetrics::LogNumberOfProfiles(this);
1050 content::NotificationService::current()->Notify( 1051 content::NotificationService::current()->Notify(
1051 chrome::NOTIFICATION_PROFILE_ADDED, 1052 chrome::NOTIFICATION_PROFILE_ADDED,
1052 content::Source<Profile>(profile), 1053 content::Source<Profile>(profile),
1053 content::NotificationService::NoDetails()); 1054 content::NotificationService::NoDetails());
1055
1056 // Record statistics to ProfileInfoCache if not a normal shutdown.
1057 if (!profile->IsGuestSession() && !profile->IsSystemProfile() &&
1058 !profile->IsNewProfile() && !go_off_the_record &&
1059 profile->GetLastSessionExitType() != Profile::EXIT_NORMAL)
1060 profiles::StoreProfileStatisticsToCache(profile);
lwchkg 2015/11/08 15:45:58 This is causing Chromium to crash if the exit type
lwchkg 2015/11/09 21:00:09 Found the reason of crash: attempting to access th
Mike Lerman 2015/11/10 15:45:44 Some of the services you're looking at may be init
lwchkg 2015/11/10 18:11:07 Thanks. I've checked the services, and it looks li
1054 } 1061 }
1055 1062
1056 void ProfileManager::DoFinalInitForServices(Profile* profile, 1063 void ProfileManager::DoFinalInitForServices(Profile* profile,
1057 bool go_off_the_record) { 1064 bool go_off_the_record) {
1058 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices"); 1065 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices");
1059 TRACK_SCOPED_REGION("Startup", "ProfileManager::DoFinalInitForServices"); 1066 TRACK_SCOPED_REGION("Startup", "ProfileManager::DoFinalInitForServices");
1060 1067
1061 #if defined(ENABLE_EXTENSIONS) 1068 #if defined(ENABLE_EXTENSIONS)
1062 ProfileInfoCache& cache = GetProfileInfoCache(); 1069 ProfileInfoCache& cache = GetProfileInfoCache();
1063 1070
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 1449
1443 void ProfileManager::BrowserListObserver::OnBrowserRemoved( 1450 void ProfileManager::BrowserListObserver::OnBrowserRemoved(
1444 Browser* browser) { 1451 Browser* browser) {
1445 Profile* profile = browser->profile(); 1452 Profile* profile = browser->profile();
1446 for (chrome::BrowserIterator it; !it.done(); it.Next()) { 1453 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
1447 if (it->profile()->GetOriginalProfile() == profile->GetOriginalProfile()) 1454 if (it->profile()->GetOriginalProfile() == profile->GetOriginalProfile())
1448 // Not the last window for this profile. 1455 // Not the last window for this profile.
1449 return; 1456 return;
1450 } 1457 }
1451 1458
1459 // Store statistics into ProfileInfoCache.
1460 profiles::StoreProfileStatisticsToCache(profile);
1461
1452 // If the last browser of a profile that is scheduled for deletion is closed 1462 // If the last browser of a profile that is scheduled for deletion is closed
1453 // do that now. 1463 // do that now.
1454 base::FilePath path = profile->GetPath(); 1464 base::FilePath path = profile->GetPath();
1455 if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles) && 1465 if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles) &&
1456 !IsProfileMarkedForDeletion(path)) { 1466 !IsProfileMarkedForDeletion(path)) {
1457 g_browser_process->profile_manager()->ScheduleProfileForDeletion( 1467 g_browser_process->profile_manager()->ScheduleProfileForDeletion(
1458 path, ProfileManager::CreateCallback()); 1468 path, ProfileManager::CreateCallback());
1459 } 1469 }
1460 } 1470 }
1461 1471
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 1511
1502 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1512 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1503 if (!original_callback.is_null()) 1513 if (!original_callback.is_null())
1504 original_callback.Run(loaded_profile, status); 1514 original_callback.Run(loaded_profile, status);
1505 } 1515 }
1506 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 1516 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
1507 1517
1508 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1518 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1509 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1519 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1510 } 1520 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | chrome/browser/profiles/profile_statistics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698