Chromium Code Reviews| 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 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 // TODO(port): several win-only methods have been pulled out of this, but | 158 // TODO(port): several win-only methods have been pulled out of this, but |
| 159 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 159 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
| 160 // other platforms. For now, it's just a stub. This is a serious work in | 160 // other platforms. For now, it's just a stub. This is a serious work in |
| 161 // progress and should not be taken as an indication of a real refactoring. | 161 // progress and should not be taken as an indication of a real refactoring. |
| 162 | 162 |
| 163 #if defined(OS_WIN) | 163 #if defined(OS_WIN) |
| 164 #include <windows.h> | 164 #include <windows.h> |
| 165 #include <commctrl.h> | 165 #include <commctrl.h> |
| 166 #include <shellapi.h> | 166 #include <shellapi.h> |
| 167 | 167 |
| 168 #include "base/win/registry.h" // For PreReadExperiment field-trial. | |
| 168 #include "base/win/scoped_com_initializer.h" | 169 #include "base/win/scoped_com_initializer.h" |
| 169 #include "base/win/windows_version.h" | 170 #include "base/win/windows_version.h" |
| 170 #include "chrome/browser/browser_trial.h" | 171 #include "chrome/browser/browser_trial.h" |
| 171 #include "chrome/browser/browser_util_win.h" | 172 #include "chrome/browser/browser_util_win.h" |
| 172 #include "chrome/browser/first_run/try_chrome_dialog_view.h" | 173 #include "chrome/browser/first_run/try_chrome_dialog_view.h" |
| 173 #include "chrome/browser/first_run/upgrade_util_win.h" | 174 #include "chrome/browser/first_run/upgrade_util_win.h" |
| 174 #include "chrome/browser/net/url_fixer_upper.h" | 175 #include "chrome/browser/net/url_fixer_upper.h" |
| 175 #include "chrome/browser/rlz/rlz.h" | 176 #include "chrome/browser/rlz/rlz.h" |
| 176 #include "chrome/browser/ui/views/user_data_dir_dialog.h" | 177 #include "chrome/browser/ui/views/user_data_dir_dialog.h" |
| 177 #include "chrome/installer/util/helper.h" | 178 #include "chrome/installer/util/helper.h" |
| (...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2019 upgrade_util::SaveLastModifiedTimeOfExe(); | 2020 upgrade_util::SaveLastModifiedTimeOfExe(); |
| 2020 #endif | 2021 #endif |
| 2021 | 2022 |
| 2022 // Record now as the last successful chrome start. | 2023 // Record now as the last successful chrome start. |
| 2023 GoogleUpdateSettings::SetLastRunTime(); | 2024 GoogleUpdateSettings::SetLastRunTime(); |
| 2024 // Call Recycle() here as late as possible, before going into the loop | 2025 // Call Recycle() here as late as possible, before going into the loop |
| 2025 // because Start() will add things to it while creating the main window. | 2026 // because Start() will add things to it while creating the main window. |
| 2026 if (pool) | 2027 if (pool) |
| 2027 pool->Recycle(); | 2028 pool->Recycle(); |
| 2028 | 2029 |
| 2030 base::TimeDelta elapsed_from_browser_open_start = | |
| 2031 base::TimeTicks::Now() - browser_open_start; | |
| 2029 UMA_HISTOGRAM_MEDIUM_TIMES("Startup.BrowserOpenTabs", | 2032 UMA_HISTOGRAM_MEDIUM_TIMES("Startup.BrowserOpenTabs", |
| 2030 base::TimeTicks::Now() - browser_open_start); | 2033 elapsed_from_browser_open_start); |
| 2034 | |
| 2035 #if defined(OS_WIN) | |
| 2036 // On Windows, use the result of the PreReadExperiment coin-toss to | |
| 2037 // output a sub-histogram. | |
| 2038 base::win::RegKey key(HKEY_CURRENT_USER, L"Software\\Google\\ChromeFrame", | |
|
Sigurður Ásgeirsson
2011/08/04 13:35:32
as we discussed, we'd want to test the PreRead key
chrisha
2011/08/04 14:48:40
As we discussed, there's the potential for an impe
| |
| 2039 KEY_QUERY_VALUE); | |
| 2040 DWORD pre_read = 1; | |
| 2041 const char* uma_name = | |
| 2042 "Startup.BrowserOpenTabs_PreReadEnabled"; | |
| 2043 if (key.Valid()) | |
| 2044 key.ReadValueDW(L"PreReadExperiment", &pre_read); | |
| 2045 if (pre_read == 0) | |
| 2046 uma_name = "Startup.BrowserOpenTabs_PreReadDisabled"; | |
|
jar (doing other things)
2011/08/03 21:24:34
personal style nit:
This logic is correct and OK.
chrisha
2011/08/04 14:48:40
Done.
| |
| 2047 UMA_HISTOGRAM_MEDIUM_TIMES(uma_name, elapsed_from_browser_open_start); | |
|
jar (doing other things)
2011/08/03 21:24:34
When performing detailed experiments, I've often f
chrisha
2011/08/04 14:48:40
Done.
| |
| 2048 #endif | |
| 2031 | 2049 |
| 2032 // TODO(mad): Move this call in a proper place on CrOS. | 2050 // TODO(mad): Move this call in a proper place on CrOS. |
| 2033 // http://crosbug.com/17687 | 2051 // http://crosbug.com/17687 |
| 2034 #if !defined(OS_CHROMEOS) | 2052 #if !defined(OS_CHROMEOS) |
| 2035 // If we're running tests (ui_task is non-null), then we don't want to | 2053 // If we're running tests (ui_task is non-null), then we don't want to |
| 2036 // call FetchLanguageListFromTranslateServer | 2054 // call FetchLanguageListFromTranslateServer |
| 2037 if (parameters.ui_task == NULL && translate_manager != NULL) { | 2055 if (parameters.ui_task == NULL && translate_manager != NULL) { |
| 2038 // TODO(willchan): Get rid of this after TranslateManager doesn't use | 2056 // TODO(willchan): Get rid of this after TranslateManager doesn't use |
| 2039 // the default request context. http://crbug.com/89396. | 2057 // the default request context. http://crbug.com/89396. |
| 2040 // This is necessary to force |default_request_context_| to be | 2058 // This is necessary to force |default_request_context_| to be |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2115 #if defined(OS_CHROMEOS) | 2133 #if defined(OS_CHROMEOS) |
| 2116 // To be precise, logout (browser shutdown) is not yet done, but the | 2134 // To be precise, logout (browser shutdown) is not yet done, but the |
| 2117 // remaining work is negligible, hence we say LogoutDone here. | 2135 // remaining work is negligible, hence we say LogoutDone here. |
| 2118 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 2136 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 2119 false); | 2137 false); |
| 2120 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 2138 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| 2121 #endif | 2139 #endif |
| 2122 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 2140 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
| 2123 return result_code; | 2141 return result_code; |
| 2124 } | 2142 } |
| OLD | NEW |