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

Unified Diff: chrome/browser/ui/app_list/app_list_service.cc

Issue 68173019: Remove static initializer from AppListView::SetNextPaintCallback(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bugs Created 7 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 side-by-side diff with in-line comments
Download patch
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 7d686ef3b20be9485802ce1389a1d37b86b14d63..5c15a85ee53da764c6b7e0c5a4b04be7dbe19b6e 100644
--- a/chrome/browser/ui/app_list/app_list_service.cc
+++ b/chrome/browser/ui/app_list/app_list_service.cc
@@ -50,10 +50,24 @@ StartupType GetStartupType(const CommandLine& command_line) {
return COLD_START;
}
-void RecordFirstPaintTiming(StartupType startup_type,
- const base::Time& start_time) {
+// The time the process that caused the app list to be shown started. This isn't
+// necessarily the currently executing process as we may be processing a command
+// line given to a short-lived Chrome instance.
+int64 g_original_process_start_time;
+
+// The type of startup the the current app list show has gone through.
+StartupType g_app_show_startup_type;
+
+void RecordStartupInfo(StartupType startup_type, const base::Time& start_time) {
+ g_original_process_start_time = start_time.ToInternalValue();
+ g_app_show_startup_type = startup_type;
+}
+
+void RecordFirstPaintTiming() {
+ base::Time start_time(
+ base::Time::FromInternalValue(g_original_process_start_time));
base::TimeDelta elapsed = base::Time::Now() - start_time;
- switch (startup_type) {
+ switch (g_app_show_startup_type) {
case COLD_START:
UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintColdStart", elapsed);
break;
@@ -110,6 +124,7 @@ void AppListService::RecordShowTimings(const CommandLine& command_line) {
break;
}
+ RecordStartupInfo(startup, start_time);
Get(chrome::HOST_DESKTOP_TYPE_NATIVE)->SetAppListNextPaintCallback(
- base::Bind(RecordFirstPaintTiming, startup, start_time));
+ RecordFirstPaintTiming);
}

Powered by Google App Engine
This is Rietveld 408576698