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

Side by Side 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: Make ProfileStatisticsAggregator tasks trackable Created 4 years, 11 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 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 content::NotificationService::current()->Notify( 1064 content::NotificationService::current()->Notify(
1065 chrome::NOTIFICATION_PROFILE_ADDED, 1065 chrome::NOTIFICATION_PROFILE_ADDED,
1066 content::Source<Profile>(profile), 1066 content::Source<Profile>(profile),
1067 content::NotificationService::NoDetails()); 1067 content::NotificationService::NoDetails());
1068 1068
1069 // Record statistics to ProfileInfoCache if statistics were not recorded 1069 // Record statistics to ProfileInfoCache if statistics were not recorded
1070 // during shutdown, i.e. the last shutdown was a system shutdown or a crash. 1070 // during shutdown, i.e. the last shutdown was a system shutdown or a crash.
1071 if (!profile->IsGuestSession() && !profile->IsSystemProfile() && 1071 if (!profile->IsGuestSession() && !profile->IsSystemProfile() &&
1072 !profile->IsNewProfile() && !go_off_the_record && 1072 !profile->IsNewProfile() && !go_off_the_record &&
1073 profile->GetLastSessionExitType() != Profile::EXIT_NORMAL) { 1073 profile->GetLastSessionExitType() != Profile::EXIT_NORMAL) {
1074 profiles::GatherProfileStatistics( 1074 ProfileStatistics::GatherProfileStatistics(
1075 profile, profiles::ProfileStatisticsCallback(), nullptr); 1075 profile, profiles::ProfileStatisticsCallback());
1076 } 1076 }
1077 } 1077 }
1078 1078
1079 void ProfileManager::DoFinalInitForServices(Profile* profile, 1079 void ProfileManager::DoFinalInitForServices(Profile* profile,
1080 bool go_off_the_record) { 1080 bool go_off_the_record) {
1081 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices"); 1081 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices");
1082 TRACK_SCOPED_REGION("Startup", "ProfileManager::DoFinalInitForServices"); 1082 TRACK_SCOPED_REGION("Startup", "ProfileManager::DoFinalInitForServices");
1083 1083
1084 #if defined(ENABLE_EXTENSIONS) 1084 #if defined(ENABLE_EXTENSIONS)
1085 ProfileInfoCache& cache = GetProfileInfoCache(); 1085 ProfileInfoCache& cache = GetProfileInfoCache();
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 if (IsProfileMarkedForDeletion(path)) { 1494 if (IsProfileMarkedForDeletion(path)) {
1495 // Do nothing if the profile is already being deleted. 1495 // Do nothing if the profile is already being deleted.
1496 } else if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) { 1496 } else if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) {
1497 // Delete if the profile is an ephemeral profile. 1497 // Delete if the profile is an ephemeral profile.
1498 g_browser_process->profile_manager()->ScheduleProfileForDeletion( 1498 g_browser_process->profile_manager()->ScheduleProfileForDeletion(
1499 path, ProfileManager::CreateCallback()); 1499 path, ProfileManager::CreateCallback());
1500 } else if (!profile->IsSystemProfile()) { 1500 } else if (!profile->IsSystemProfile()) {
1501 // Gather statistics and store into ProfileInfoCache. For incognito profile 1501 // Gather statistics and store into ProfileInfoCache. For incognito profile
1502 // we gather the statistics of its parent profile instead, because a window 1502 // we gather the statistics of its parent profile instead, because a window
1503 // of the parent profile was open. 1503 // of the parent profile was open.
1504 profiles::GatherProfileStatistics( 1504 ProfileStatistics::GatherProfileStatistics(
1505 original_profile, profiles::ProfileStatisticsCallback(), nullptr); 1505 original_profile, profiles::ProfileStatisticsCallback());
1506 } 1506 }
1507 } 1507 }
1508 1508
1509 void ProfileManager::BrowserListObserver::OnBrowserSetLastActive( 1509 void ProfileManager::BrowserListObserver::OnBrowserSetLastActive(
1510 Browser* browser) { 1510 Browser* browser) {
1511 // If all browsers are being closed (e.g. the user is in the process of 1511 // If all browsers are being closed (e.g. the user is in the process of
1512 // shutting down), this event will be fired after each browser is 1512 // shutting down), this event will be fired after each browser is
1513 // closed. This does not represent a user intention to change the active 1513 // closed. This does not represent a user intention to change the active
1514 // browser so is not handled here. 1514 // browser so is not handled here.
1515 if (profile_manager_->closing_all_browsers_) 1515 if (profile_manager_->closing_all_browsers_)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 1548
1549 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1549 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1550 if (!original_callback.is_null()) 1550 if (!original_callback.is_null())
1551 original_callback.Run(loaded_profile, status); 1551 original_callback.Run(loaded_profile, status);
1552 } 1552 }
1553 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 1553 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
1554 1554
1555 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1555 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1556 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1556 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1557 } 1557 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_statistics.h » ('j') | chrome/browser/profiles/profile_statistics.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698