OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_main.h" | 5 #include "chrome/browser/browser_main.h" |
6 #include "chrome/browser/browser_main_win.h" | 6 #include "chrome/browser/browser_main_win.h" |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 | 12 |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/environment.h" | 14 #include "base/environment.h" |
15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/scoped_native_library.h" | 18 #include "base/scoped_native_library.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "base/win/registry.h" // For PreReadExperiment field-trial. | |
20 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
21 #include "base/win/wrapped_window_proc.h" | 22 #include "base/win/wrapped_window_proc.h" |
22 #include "chrome/browser/browser_util_win.h" | 23 #include "chrome/browser/browser_util_win.h" |
23 #include "chrome/browser/first_run/first_run.h" | 24 #include "chrome/browser/first_run/first_run.h" |
24 #include "chrome/browser/metrics/metrics_service.h" | 25 #include "chrome/browser/metrics/metrics_service.h" |
25 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
26 #include "chrome/browser/ui/views/uninstall_view.h" | 27 #include "chrome/browser/ui/views/uninstall_view.h" |
27 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
28 #include "chrome/common/chrome_result_codes.h" | 29 #include "chrome/common/chrome_result_codes.h" |
29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 FILETIME ignore = {}; | 90 FILETIME ignore = {}; |
90 ::GetProcessTimes(::GetCurrentProcess(), &creation_time, &ignore, &ignore, | 91 ::GetProcessTimes(::GetCurrentProcess(), &creation_time, &ignore, &ignore, |
91 &ignore); | 92 &ignore); |
92 | 93 |
93 base::TimeDelta elapsed_from_startup = | 94 base::TimeDelta elapsed_from_startup = |
94 base::Time::Now() - base::Time::FromFileTime(creation_time); | 95 base::Time::Now() - base::Time::FromFileTime(creation_time); |
95 | 96 |
96 // Record the time to present in a histogram. | 97 // Record the time to present in a histogram. |
97 UMA_HISTOGRAM_MEDIUM_TIMES("Startup.BrowserMessageLoopStartTime", | 98 UMA_HISTOGRAM_MEDIUM_TIMES("Startup.BrowserMessageLoopStartTime", |
98 elapsed_from_startup); | 99 elapsed_from_startup); |
100 | |
101 // Create a sub-histogram based on the PreReadExperiment coin-toss. | |
102 base::win::RegKey key(HKEY_CURRENT_USER, L"Software\\Google\\ChromeFrame", | |
Sigurður Ásgeirsson
2011/08/04 13:35:32
ditto: is there a good common place to put this re
chrisha
2011/08/04 14:48:40
I moved the common functionality to a function dec
| |
103 KEY_QUERY_VALUE); | |
104 DWORD pre_read = 1; | |
105 const char* uma_name = "Startup.BrowserMessageLoopStartTime_PreReadEnabled"; | |
106 if (key.Valid()) | |
107 key.ReadValueDW(L"PreReadExperiment", &pre_read); | |
108 if (pre_read == 0) | |
109 uma_name = "Startup.BrowserMessageLoopStartTime_PreReadDisabled"; | |
jar (doing other things)
2011/08/03 21:24:34
personal preference nit: Same comment about refact
chrisha
2011/08/04 14:48:40
Done.
| |
110 UMA_HISTOGRAM_MEDIUM_TIMES(uma_name, elapsed_from_startup); | |
99 } | 111 } |
100 | 112 |
101 int AskForUninstallConfirmation() { | 113 int AskForUninstallConfirmation() { |
102 int ret = content::RESULT_CODE_NORMAL_EXIT; | 114 int ret = content::RESULT_CODE_NORMAL_EXIT; |
103 views::Widget::CreateWindow(new UninstallView(ret))->Show(); | 115 views::Widget::CreateWindow(new UninstallView(ret))->Show(); |
104 views::AcceleratorHandler accelerator_handler; | 116 views::AcceleratorHandler accelerator_handler; |
105 MessageLoopForUI::current()->Run(&accelerator_handler); | 117 MessageLoopForUI::current()->Run(&accelerator_handler); |
106 return ret; | 118 return ret; |
107 } | 119 } |
108 | 120 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 crypto::EnsureNSPRInit(); | 327 crypto::EnsureNSPRInit(); |
316 } | 328 } |
317 } | 329 } |
318 }; | 330 }; |
319 | 331 |
320 // static | 332 // static |
321 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( | 333 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( |
322 const MainFunctionParams& parameters) { | 334 const MainFunctionParams& parameters) { |
323 return new BrowserMainPartsWin(parameters); | 335 return new BrowserMainPartsWin(parameters); |
324 } | 336 } |
OLD | NEW |