Chromium Code Reviews| Index: chrome/browser/ui/app_list/app_list_service.cc |
| diff --git a/chrome/browser/ui/app_list/app_list_service.cc b/chrome/browser/ui/app_list/app_list_service.cc |
| index 3fb43fe204de50c8aa57a98a4220aa4b27c41b93..5d4f42ed9a0b84d7f072fc3977a169ab3dfa5a10 100644 |
| --- a/chrome/browser/ui/app_list/app_list_service.cc |
| +++ b/chrome/browser/ui/app_list/app_list_service.cc |
| @@ -62,6 +62,32 @@ void RecordStartupInfo(StartupType startup_type, const base::Time& start_time) { |
| g_app_show_startup_type = startup_type; |
| } |
| +void RecordFirstPaintTiming(); |
|
msw
2014/07/08 01:05:07
Remove this, reorder RecordStartupTimings after it
tapted
2014/07/08 01:41:32
Done.
|
| + |
| +void RecordStartupTimings(AppListService* service, |
| + const CommandLine& command_line) { |
| + base::Time start_time = GetOriginalProcessStartTime(command_line); |
| + if (start_time.is_null()) |
| + return; |
| + |
| + base::TimeDelta elapsed = base::Time::Now() - start_time; |
| + StartupType startup = GetStartupType(command_line); |
| + switch (startup) { |
| + case COLD_START: |
| + UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListColdStart", elapsed); |
| + break; |
| + case WARM_START: |
| + UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStart", elapsed); |
| + break; |
| + case WARM_START_FAST: |
| + UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStartFast", elapsed); |
| + break; |
| + } |
| + |
| + RecordStartupInfo(startup, start_time); |
|
msw
2014/07/08 01:05:07
nit: inline RecordStartupInfo and maybe use that m
tapted
2014/07/08 01:41:32
Done.
|
| + service->SetAppListNextPaintCallback(RecordFirstPaintTiming); |
| +} |
| + |
| void RecordFirstPaintTiming() { |
| base::Time start_time( |
| base::Time::FromInternalValue(g_original_process_start_time)); |
| @@ -106,26 +132,18 @@ void AppListService::RegisterPrefs(PrefRegistrySimple* registry) { |
| } |
| // static |
| -void AppListService::RecordShowTimings(const CommandLine& command_line) { |
| - base::Time start_time = GetOriginalProcessStartTime(command_line); |
| - if (start_time.is_null()) |
| - return; |
| - |
| - base::TimeDelta elapsed = base::Time::Now() - start_time; |
| - StartupType startup = GetStartupType(command_line); |
| - switch (startup) { |
| - case COLD_START: |
| - UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListColdStart", elapsed); |
| - break; |
| - case WARM_START: |
| - UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStart", elapsed); |
| - break; |
| - case WARM_START_FAST: |
| - UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStartFast", elapsed); |
| - break; |
| - } |
| - |
| - RecordStartupInfo(startup, start_time); |
| - Get(chrome::HOST_DESKTOP_TYPE_NATIVE)->SetAppListNextPaintCallback( |
| - RecordFirstPaintTiming); |
| +bool AppListService::HandleLaunchCommandLine( |
| + const base::CommandLine& command_line, |
| + Profile* launch_profile) { |
| + InitAll(launch_profile); |
| + if (!command_line.HasSwitch(switches::kShowAppList)) |
| + return false; |
| + |
| + // The --show-app-list switch is used for shortcuts on the native desktop. |
| + AppListService* service = |
| + AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); |
|
msw
2014/07/08 01:05:07
nit: can you avoid explicitly qualifying the AppLi
tapted
2014/07/08 01:41:32
Of course! Done.
|
| + DCHECK(service); |
| + RecordStartupTimings(service, command_line); |
| + service->ShowForProfile(launch_profile); |
| + return true; |
| } |