Commit e65c2ff2 authored by rkaplow's avatar rkaplow Committed by Commit bot

Add some tracing for Profiles and Extensions.

This is from investigation on PreMainMessageLoopRunImpl

BUG=454789

Review URL: https://codereview.chromium.org/928633002

Cr-Commit-Position: refs/heads/master@{#316391}
parent 86aa53c3
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/search/hotword_service.h" #include "chrome/browser/search/hotword_service.h"
#include "chrome/browser/search/hotword_service_factory.h" #include "chrome/browser/search/hotword_service_factory.h"
...@@ -126,6 +127,7 @@ ComponentLoader::~ComponentLoader() { ...@@ -126,6 +127,7 @@ ComponentLoader::~ComponentLoader() {
} }
void ComponentLoader::LoadAll() { void ComponentLoader::LoadAll() {
TRACE_EVENT0("browser,startup", "ComponentLoader::LoadAll");
const base::TimeTicks start_time = base::TimeTicks::Now(); const base::TimeTicks start_time = base::TimeTicks::Now();
for (RegisteredComponentExtensions::iterator it = for (RegisteredComponentExtensions::iterator it =
component_extensions_.begin(); component_extensions_.begin();
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "base/threading/sequenced_worker_pool.h" #include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/content_settings_internal_extension_provider.h" #include "chrome/browser/content_settings/content_settings_internal_extension_provider.h"
...@@ -384,7 +385,7 @@ const Extension* ExtensionService::GetExtensionById( ...@@ -384,7 +385,7 @@ const Extension* ExtensionService::GetExtensionById(
void ExtensionService::Init() { void ExtensionService::Init() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
TRACE_EVENT0("browser,startup", "ExtensionService::Init");
base::Time begin_time = base::Time::Now(); base::Time begin_time = base::Time::Now();
DCHECK(!is_ready()); // Can't redo init. DCHECK(!is_ready()); // Can't redo init.
...@@ -2048,6 +2049,7 @@ const Extension* ExtensionService::GetPendingExtensionUpdate( ...@@ -2048,6 +2049,7 @@ const Extension* ExtensionService::GetPendingExtensionUpdate(
void ExtensionService::RegisterContentSettings( void ExtensionService::RegisterContentSettings(
HostContentSettingsMap* host_content_settings_map) { HostContentSettingsMap* host_content_settings_map) {
TRACE_EVENT0("browser,startup", "ExtensionService::RegisterContentSettings");
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
host_content_settings_map->RegisterProvider( host_content_settings_map->RegisterProvider(
HostContentSettingsMap::INTERNAL_EXTENSION_PROVIDER, HostContentSettingsMap::INTERNAL_EXTENSION_PROVIDER,
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/strings/string_tokenizer.h" #include "base/strings/string_tokenizer.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/trace_event/trace_event.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings.h" #include "chrome/browser/content_settings/cookie_settings.h"
#include "chrome/browser/extensions/component_loader.h" #include "chrome/browser/extensions/component_loader.h"
...@@ -294,6 +295,7 @@ class ContentVerifierDelegateImpl : public ContentVerifierDelegate { ...@@ -294,6 +295,7 @@ class ContentVerifierDelegateImpl : public ContentVerifierDelegate {
} // namespace } // namespace
void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) {
TRACE_EVENT0("browser,startup", "ExtensionSystemImpl::Shared::Init");
const base::CommandLine* command_line = const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess(); base::CommandLine::ForCurrentProcess();
...@@ -486,6 +488,7 @@ void ExtensionSystemImpl::Shutdown() { ...@@ -486,6 +488,7 @@ void ExtensionSystemImpl::Shutdown() {
} }
void ExtensionSystemImpl::InitForRegularProfile(bool extensions_enabled) { void ExtensionSystemImpl::InitForRegularProfile(bool extensions_enabled) {
TRACE_EVENT0("browser,startup", "ExtensionSystemImpl::InitForRegularProfile");
DCHECK(!profile_->IsOffTheRecord()); DCHECK(!profile_->IsOffTheRecord());
if (shared_user_script_master() || extension_service()) if (shared_user_script_master() || extension_service())
return; // Already initialized. return; // Already initialized.
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "base/trace_event/trace_event.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_action_manager.h" #include "chrome/browser/extensions/extension_action_manager.h"
...@@ -228,6 +229,7 @@ void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) { ...@@ -228,6 +229,7 @@ void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) {
} }
void InstalledLoader::LoadAllExtensions() { void InstalledLoader::LoadAllExtensions() {
TRACE_EVENT0("browser,startup", "InstalledLoader::LoadAllExtensions");
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
base::TimeTicks start_time = base::TimeTicks::Now(); base::TimeTicks start_time = base::TimeTicks::Now();
......
...@@ -561,6 +561,7 @@ std::vector<Profile*> ProfileManager::GetLoadedProfiles() const { ...@@ -561,6 +561,7 @@ std::vector<Profile*> ProfileManager::GetLoadedProfiles() const {
} }
Profile* ProfileManager::GetProfileByPath(const base::FilePath& path) const { Profile* ProfileManager::GetProfileByPath(const base::FilePath& path) const {
TRACE_EVENT0("browser", "ProfileManager::GetProfileByPath");
ProfileInfo* profile_info = GetProfileInfoByPath(path); ProfileInfo* profile_info = GetProfileInfoByPath(path);
return profile_info ? profile_info->profile.get() : NULL; return profile_info ? profile_info->profile.get() : NULL;
} }
...@@ -626,6 +627,7 @@ base::FilePath ProfileManager::GenerateNextProfileDirectoryPath() { ...@@ -626,6 +627,7 @@ base::FilePath ProfileManager::GenerateNextProfileDirectoryPath() {
} }
ProfileInfoCache& ProfileManager::GetProfileInfoCache() { ProfileInfoCache& ProfileManager::GetProfileInfoCache() {
TRACE_EVENT0("browser", "ProfileManager::GetProfileInfoCache");
if (!profile_info_cache_) { if (!profile_info_cache_) {
profile_info_cache_.reset(new ProfileInfoCache( profile_info_cache_.reset(new ProfileInfoCache(
g_browser_process->local_state(), user_data_dir_)); g_browser_process->local_state(), user_data_dir_));
...@@ -764,6 +766,7 @@ void ProfileManager::AutoloadProfiles() { ...@@ -764,6 +766,7 @@ void ProfileManager::AutoloadProfiles() {
} }
void ProfileManager::InitProfileUserPrefs(Profile* profile) { void ProfileManager::InitProfileUserPrefs(Profile* profile) {
TRACE_EVENT0("browser", "ProfileManager::InitProfileUserPrefs");
ProfileInfoCache& cache = GetProfileInfoCache(); ProfileInfoCache& cache = GetProfileInfoCache();
if (profile->GetPath().DirName() != cache.GetUserDataDir()) if (profile->GetPath().DirName() != cache.GetUserDataDir())
...@@ -1000,6 +1003,7 @@ void ProfileManager::OnProfileCreated(Profile* profile, ...@@ -1000,6 +1003,7 @@ void ProfileManager::OnProfileCreated(Profile* profile,
} }
void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) { void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) {
TRACE_EVENT0("browser", "ProfileManager::DoFinalInit");
DoFinalInitForServices(profile, go_off_the_record); DoFinalInitForServices(profile, go_off_the_record);
AddProfileToCache(profile); AddProfileToCache(profile);
DoFinalInitLogging(profile); DoFinalInitLogging(profile);
...@@ -1013,6 +1017,7 @@ void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) { ...@@ -1013,6 +1017,7 @@ void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) {
void ProfileManager::DoFinalInitForServices(Profile* profile, void ProfileManager::DoFinalInitForServices(Profile* profile,
bool go_off_the_record) { bool go_off_the_record) {
TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices");
#if defined(ENABLE_EXTENSIONS) #if defined(ENABLE_EXTENSIONS)
ProfileInfoCache& cache = GetProfileInfoCache(); ProfileInfoCache& cache = GetProfileInfoCache();
extensions::ExtensionSystem::Get(profile)->InitForRegularProfile( extensions::ExtensionSystem::Get(profile)->InitForRegularProfile(
...@@ -1055,6 +1060,7 @@ void ProfileManager::DoFinalInitForServices(Profile* profile, ...@@ -1055,6 +1060,7 @@ void ProfileManager::DoFinalInitForServices(Profile* profile,
} }
void ProfileManager::DoFinalInitLogging(Profile* profile) { void ProfileManager::DoFinalInitLogging(Profile* profile) {
TRACE_EVENT0("browser", "ProfileManager::DoFinalInitLogging");
// Count number of extensions in this profile. // Count number of extensions in this profile.
int enabled_app_count = -1; int enabled_app_count = -1;
#if defined(ENABLE_EXTENSIONS) #if defined(ENABLE_EXTENSIONS)
...@@ -1069,6 +1075,7 @@ void ProfileManager::DoFinalInitLogging(Profile* profile) { ...@@ -1069,6 +1075,7 @@ void ProfileManager::DoFinalInitLogging(Profile* profile) {
} }
Profile* ProfileManager::CreateProfileHelper(const base::FilePath& path) { Profile* ProfileManager::CreateProfileHelper(const base::FilePath& path) {
TRACE_EVENT0("browser", "ProfileManager::CreateProfileHelper");
return Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); return Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS);
} }
...@@ -1117,6 +1124,7 @@ Profile* ProfileManager::GetActiveUserOrOffTheRecordProfileFromPath( ...@@ -1117,6 +1124,7 @@ Profile* ProfileManager::GetActiveUserOrOffTheRecordProfileFromPath(
} }
bool ProfileManager::AddProfile(Profile* profile) { bool ProfileManager::AddProfile(Profile* profile) {
TRACE_EVENT0("browser", "ProfileManager::AddProfile");
DCHECK(profile); DCHECK(profile);
// Make sure that we're not loading a profile with the same ID as a profile // Make sure that we're not loading a profile with the same ID as a profile
...@@ -1182,6 +1190,7 @@ void ProfileManager::FinishDeletingProfile(const base::FilePath& profile_dir) { ...@@ -1182,6 +1190,7 @@ void ProfileManager::FinishDeletingProfile(const base::FilePath& profile_dir) {
ProfileManager::ProfileInfo* ProfileManager::RegisterProfile( ProfileManager::ProfileInfo* ProfileManager::RegisterProfile(
Profile* profile, Profile* profile,
bool created) { bool created) {
TRACE_EVENT0("browser", "ProfileManager::RegisterProfile");
ProfileInfo* info = new ProfileInfo(profile, created); ProfileInfo* info = new ProfileInfo(profile, created);
profiles_info_.insert( profiles_info_.insert(
std::make_pair(profile->GetPath(), linked_ptr<ProfileInfo>(info))); std::make_pair(profile->GetPath(), linked_ptr<ProfileInfo>(info)));
...@@ -1195,6 +1204,7 @@ ProfileManager::ProfileInfo* ProfileManager::GetProfileInfoByPath( ...@@ -1195,6 +1204,7 @@ ProfileManager::ProfileInfo* ProfileManager::GetProfileInfoByPath(
} }
void ProfileManager::AddProfileToCache(Profile* profile) { void ProfileManager::AddProfileToCache(Profile* profile) {
TRACE_EVENT0("browser", "ProfileManager::AddProfileToCache");
if (profile->IsGuestSession() || profile->IsSystemProfile()) if (profile->IsGuestSession() || profile->IsSystemProfile())
return; return;
ProfileInfoCache& cache = GetProfileInfoCache(); ProfileInfoCache& cache = GetProfileInfoCache();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment