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

Side by Side Diff: chrome/browser/chrome_browser_main_mac.mm

Issue 10561009: Consolidate RecordBrowserStartupTime() into one location (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix review comments - utilize Time::is_null() Created 8 years, 6 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/chrome_browser_main_mac.h" 5 #include "chrome/browser/chrome_browser_main_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <sys/sysctl.h>
9 #include <sys/time.h>
10 8
11 #include "base/command_line.h" 9 #include "base/command_line.h"
12 #include "base/debug/debugger.h" 10 #include "base/debug/debugger.h"
13 #include "base/file_path.h" 11 #include "base/file_path.h"
14 #include "base/mac/bundle_locations.h" 12 #include "base/mac/bundle_locations.h"
15 #include "base/mac/mac_util.h" 13 #include "base/mac/mac_util.h"
16 #include "base/memory/scoped_nsobject.h" 14 #include "base/memory/scoped_nsobject.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/path_service.h" 15 #include "base/path_service.h"
19 #include "chrome/app/breakpad_mac.h" 16 #include "chrome/app/breakpad_mac.h"
20 #import "chrome/browser/app_controller_mac.h" 17 #import "chrome/browser/app_controller_mac.h"
21 #import "chrome/browser/chrome_browser_application_mac.h" 18 #import "chrome/browser/chrome_browser_application_mac.h"
22 #include "chrome/browser/mac/install_from_dmg.h" 19 #include "chrome/browser/mac/install_from_dmg.h"
23 #include "chrome/browser/mac/keychain_reauthorize.h" 20 #include "chrome/browser/mac/keychain_reauthorize.h"
24 #import "chrome/browser/mac/keystone_glue.h" 21 #import "chrome/browser/mac/keystone_glue.h"
25 #include "chrome/browser/metrics/metrics_service.h" 22 #include "chrome/browser/metrics/metrics_service.h"
26 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
27 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
(...skipping 23 matching lines...) Expand all
51 @"KeychainReauthorizeAtUpdateMay2012"; 48 @"KeychainReauthorizeAtUpdateMay2012";
52 const int kKeychainReauthorizeAtUpdateMaxTries = 3; 49 const int kKeychainReauthorizeAtUpdateMaxTries = 3;
53 50
54 } // namespace 51 } // namespace
55 52
56 void RecordBreakpadStatusUMA(MetricsService* metrics) { 53 void RecordBreakpadStatusUMA(MetricsService* metrics) {
57 metrics->RecordBreakpadRegistration(IsCrashReporterEnabled()); 54 metrics->RecordBreakpadRegistration(IsCrashReporterEnabled());
58 metrics->RecordBreakpadHasDebugger(base::debug::BeingDebugged()); 55 metrics->RecordBreakpadHasDebugger(base::debug::BeingDebugged());
59 } 56 }
60 57
61 void RecordBrowserStartupTime() {
62 int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() };
63 size_t len = 0;
64 if (sysctl(mib, arraysize(mib), NULL, &len, NULL, 0) < 0)
65 return;
66
67 scoped_ptr_malloc<struct kinfo_proc>
68 proc(static_cast<struct kinfo_proc*>(malloc(len)));
69 if (sysctl(mib, arraysize(mib), proc.get(), &len, NULL, 0) < 0)
70 return;
71 base::Time process_creation_time =
72 base::Time::FromTimeVal(proc->kp_proc.p_un.__p_starttime);
73
74 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime",
75 base::Time::Now() - process_creation_time);
76 }
77
78 void WarnAboutMinimumSystemRequirements() { 58 void WarnAboutMinimumSystemRequirements() {
79 // Nothing to check for on Mac right now. 59 // Nothing to check for on Mac right now.
80 } 60 }
81 61
82 // From browser_main_win.h, stubs until we figure out the right thing... 62 // From browser_main_win.h, stubs until we figure out the right thing...
83 63
84 int DoUninstallTasks(bool chrome_still_running) { 64 int DoUninstallTasks(bool chrome_still_running) {
85 return content::RESULT_CODE_NORMAL_EXIT; 65 return content::RESULT_CODE_NORMAL_EXIT;
86 } 66 }
87 67
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Prevent Cocoa from turning command-line arguments into 172 // Prevent Cocoa from turning command-line arguments into
193 // |-application:openFiles:|, since we already handle them directly. 173 // |-application:openFiles:|, since we already handle them directly.
194 [[NSUserDefaults standardUserDefaults] 174 [[NSUserDefaults standardUserDefaults]
195 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; 175 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
196 } 176 }
197 177
198 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { 178 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() {
199 AppController* appController = [NSApp delegate]; 179 AppController* appController = [NSApp delegate];
200 [appController didEndMainMessageLoop]; 180 [appController didEndMainMessageLoop];
201 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698