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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/app_list/app_list_service.h" 5 #include "chrome/browser/ui/app_list/app_list_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 StartupType GetStartupType(const CommandLine& command_line) { 43 StartupType GetStartupType(const CommandLine& command_line) {
44 // The presence of kOriginalProcessStartTime implies that another process 44 // The presence of kOriginalProcessStartTime implies that another process
45 // has sent us its command line to handle, ie: we are already running. 45 // has sent us its command line to handle, ie: we are already running.
46 if (command_line.HasSwitch(switches::kOriginalProcessStartTime)) { 46 if (command_line.HasSwitch(switches::kOriginalProcessStartTime)) {
47 return command_line.HasSwitch(switches::kFastStart) ? 47 return command_line.HasSwitch(switches::kFastStart) ?
48 WARM_START_FAST : WARM_START; 48 WARM_START_FAST : WARM_START;
49 } 49 }
50 return COLD_START; 50 return COLD_START;
51 } 51 }
52 52
53 void RecordFirstPaintTiming(StartupType startup_type, 53 int64 g_startup_time;
54 const base::Time& start_time) { 54 StartupType g_startup_type;
55
56 void RecordStartupInfo(StartupType startup_type, const base::Time& start_time) {
benwells 2013/11/15 02:13:59 What calls this?
koz (OOO until 15th September) 2013/11/17 23:16:19 Oops, it's meant to be called below when we set th
57 g_startup_time = start_time.ToInternalValue();
58 g_startup_type = startup_type;
59 }
60
61 void RecordFirstPaintTiming() {
62 base::Time start_time(base::Time::FromInternalValue(g_startup_type));
55 base::TimeDelta elapsed = base::Time::Now() - start_time; 63 base::TimeDelta elapsed = base::Time::Now() - start_time;
56 switch (startup_type) { 64 switch (g_startup_type) {
57 case COLD_START: 65 case COLD_START:
58 UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintColdStart", elapsed); 66 UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintColdStart", elapsed);
59 break; 67 break;
60 case WARM_START: 68 case WARM_START:
61 UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintWarmStart", elapsed); 69 UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintWarmStart", elapsed);
62 break; 70 break;
63 case WARM_START_FAST: 71 case WARM_START_FAST:
64 UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintWarmStartFast", 72 UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintWarmStartFast",
65 elapsed); 73 elapsed);
66 break; 74 break;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 break; 112 break;
105 case WARM_START: 113 case WARM_START:
106 UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStart", elapsed); 114 UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStart", elapsed);
107 break; 115 break;
108 case WARM_START_FAST: 116 case WARM_START_FAST:
109 UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStartFast", elapsed); 117 UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStartFast", elapsed);
110 break; 118 break;
111 } 119 }
112 120
113 Get(chrome::HOST_DESKTOP_TYPE_NATIVE)->SetAppListNextPaintCallback( 121 Get(chrome::HOST_DESKTOP_TYPE_NATIVE)->SetAppListNextPaintCallback(
114 base::Bind(RecordFirstPaintTiming, startup, start_time)); 122 RecordFirstPaintTiming);
115 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698