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

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 2280183002: Remove all code related to the PreRead field trial. (Closed)
Patch Set: Created 4 years, 3 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.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 12 matching lines...) Expand all
23 #include "base/feature_list.h" 23 #include "base/feature_list.h"
24 #include "base/files/file_path.h" 24 #include "base/files/file_path.h"
25 #include "base/files/file_util.h" 25 #include "base/files/file_util.h"
26 #include "base/logging.h" 26 #include "base/logging.h"
27 #include "base/memory/ptr_util.h" 27 #include "base/memory/ptr_util.h"
28 #include "base/metrics/field_trial.h" 28 #include "base/metrics/field_trial.h"
29 #include "base/metrics/histogram_macros.h" 29 #include "base/metrics/histogram_macros.h"
30 #include "base/path_service.h" 30 #include "base/path_service.h"
31 #include "base/profiler/scoped_tracker.h" 31 #include "base/profiler/scoped_tracker.h"
32 #include "base/run_loop.h" 32 #include "base/run_loop.h"
33 #include "base/string16.h"
33 #include "base/strings/string_number_conversions.h" 34 #include "base/strings/string_number_conversions.h"
34 #include "base/strings/string_piece.h" 35 #include "base/strings/string_piece.h"
35 #include "base/strings/string_split.h" 36 #include "base/strings/string_split.h"
36 #include "base/strings/sys_string_conversions.h" 37 #include "base/strings/sys_string_conversions.h"
37 #include "base/strings/utf_string_conversions.h" 38 #include "base/strings/utf_string_conversions.h"
38 #include "base/sys_info.h" 39 #include "base/sys_info.h"
39 #include "base/task_scheduler/scheduler_worker_pool_params.h" 40 #include "base/task_scheduler/scheduler_worker_pool_params.h"
40 #include "base/task_scheduler/switches.h" 41 #include "base/task_scheduler/switches.h"
41 #include "base/task_scheduler/task_scheduler.h" 42 #include "base/task_scheduler/task_scheduler.h"
42 #include "base/task_scheduler/task_traits.h" 43 #include "base/task_scheduler/task_traits.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 #include "chromeos/settings/cros_settings_names.h" 200 #include "chromeos/settings/cros_settings_names.h"
200 #endif // defined(OS_CHROMEOS) 201 #endif // defined(OS_CHROMEOS)
201 202
202 // TODO(port): several win-only methods have been pulled out of this, but 203 // TODO(port): several win-only methods have been pulled out of this, but
203 // BrowserMain() as a whole needs to be broken apart so that it's usable by 204 // BrowserMain() as a whole needs to be broken apart so that it's usable by
204 // other platforms. For now, it's just a stub. This is a serious work in 205 // other platforms. For now, it's just a stub. This is a serious work in
205 // progress and should not be taken as an indication of a real refactoring. 206 // progress and should not be taken as an indication of a real refactoring.
206 207
207 #if defined(OS_WIN) 208 #if defined(OS_WIN)
208 #include "base/trace_event/trace_event_etw_export_win.h" 209 #include "base/trace_event/trace_event_etw_export_win.h"
210 #include "base/win/registry.h"
209 #include "base/win/windows_version.h" 211 #include "base/win/windows_version.h"
210 #include "chrome/browser/chrome_browser_main_win.h" 212 #include "chrome/browser/chrome_browser_main_win.h"
211 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" 213 #include "chrome/browser/component_updater/sw_reporter_installer_win.h"
212 #include "chrome/browser/downgrade/user_data_downgrade.h" 214 #include "chrome/browser/downgrade/user_data_downgrade.h"
213 #include "chrome/browser/first_run/try_chrome_dialog_view.h" 215 #include "chrome/browser/first_run/try_chrome_dialog_view.h"
214 #include "chrome/browser/first_run/upgrade_util_win.h" 216 #include "chrome/browser/first_run/upgrade_util_win.h"
215 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
216 #include "chrome/browser/ui/network_profile_bubble.h" 217 #include "chrome/browser/ui/network_profile_bubble.h"
217 #include "chrome/browser/win/browser_util.h" 218 #include "chrome/browser/win/browser_util.h"
218 #include "chrome/browser/win/chrome_select_file_dialog_factory.h" 219 #include "chrome/browser/win/chrome_select_file_dialog_factory.h"
219 #include "chrome/installer/util/browser_distribution.h" 220 #include "chrome/installer/util/browser_distribution.h"
220 #include "chrome/installer/util/helper.h" 221 #include "chrome/installer/util/helper.h"
221 #include "chrome/installer/util/install_util.h" 222 #include "chrome/installer/util/install_util.h"
222 #include "chrome/installer/util/shell_util.h" 223 #include "chrome/installer/util/shell_util.h"
223 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win. h"
224 #include "ui/base/l10n/l10n_util_win.h" 224 #include "ui/base/l10n/l10n_util_win.h"
225 #include "ui/shell_dialogs/select_file_dialog.h" 225 #include "ui/shell_dialogs/select_file_dialog.h"
226 #endif // defined(OS_WIN) 226 #endif // defined(OS_WIN)
227 227
228 #if defined(OS_MACOSX) 228 #if defined(OS_MACOSX)
229 #include <Security/Security.h> 229 #include <Security/Security.h>
230 230
231 #include "base/mac/scoped_nsautorelease_pool.h" 231 #include "base/mac/scoped_nsautorelease_pool.h"
232 #include "chrome/browser/mac/keystone_glue.h" 232 #include "chrome/browser/mac/keystone_glue.h"
233 #endif // defined(OS_MACOSX) 233 #endif // defined(OS_MACOSX)
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 ~ScopedMainMessageLoopRunEvent() { 737 ~ScopedMainMessageLoopRunEvent() {
738 TRACE_EVENT_ASYNC_END0("toplevel", 738 TRACE_EVENT_ASYNC_END0("toplevel",
739 "ChromeBrowserMainParts::MainMessageLoopRun", this); 739 "ChromeBrowserMainParts::MainMessageLoopRun", this);
740 } 740 }
741 }; 741 };
742 742
743 } // namespace 743 } // namespace
744 744
745 namespace chrome_browser { 745 namespace chrome_browser {
746 746
747 #if defined(OS_WIN)
748 // Helper function to setup the pre-read field trial. This function is defined
749 // outside of the anonymous namespace to allow it to be friend with
750 // ChromeMetricsServiceAccessor.
751 void SetupPreReadFieldTrial() {
752 const base::string16 registry_path =
753 BrowserDistribution::GetDistribution()->GetRegistryPath();
754
755 // Register a synthetic field trial with the PreRead group used during the
756 // current startup. This must be done before the first metric log
757 // (metrics::MetricLog) is created. Otherwise, UMA metrics generated during
758 // startup won't be correctly annotated. The current function is always called
759 // before the first metric log is created, as part of
760 // ChromeBrowserMainParts::PreMainMessageLoopRun().
761 startup_metric_utils::RegisterPreReadSyntheticFieldTrial(
762 registry_path,
763 base::Bind(&ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial));
764
765 // Initialize the PreRead options for the current process.
766 startup_metric_utils::InitializePreReadOptions(registry_path);
767
768 // After startup is complete, update the PreRead group in the registry. The
769 // group written in the registry will be used for the next startup.
770 BrowserThread::PostAfterStartupTask(
771 FROM_HERE, content::BrowserThread::GetBlockingPool(),
772 base::Bind(&startup_metric_utils::UpdatePreReadOptions, registry_path));
773 }
774 #endif // defined(OS_WIN)
775
776 // This error message is not localized because we failed to load the 747 // This error message is not localized because we failed to load the
777 // localization data files. 748 // localization data files.
778 #if defined(OS_WIN) 749 #if defined(OS_WIN)
779 const char kMissingLocaleDataTitle[] = "Missing File Error"; 750 const char kMissingLocaleDataTitle[] = "Missing File Error";
780 #endif // defined(OS_WIN) 751 #endif // defined(OS_WIN)
781 752
782 #if defined(OS_WIN) 753 #if defined(OS_WIN)
783 // TODO(port) This should be used on Linux Aura as well. http://crbug.com/338969 754 // TODO(port) This should be used on Linux Aura as well. http://crbug.com/338969
784 const char kMissingLocaleDataMessage[] = 755 const char kMissingLocaleDataMessage[] =
785 "Unable to find locale data files. Please reinstall."; 756 "Unable to find locale data files. Please reinstall.";
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 // Register a synthetic field trial for the sampling profiler configuration 918 // Register a synthetic field trial for the sampling profiler configuration
948 // that was already chosen. 919 // that was already chosen.
949 sampling_profiler_config_.RegisterSyntheticFieldTrial(); 920 sampling_profiler_config_.RegisterSyntheticFieldTrial();
950 921
951 #if defined(OS_WIN) || defined(OS_MACOSX) || \ 922 #if defined(OS_WIN) || defined(OS_MACOSX) || \
952 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) 923 (defined(OS_LINUX) && !defined(OS_CHROMEOS))
953 metrics::DesktopEngagementService::Initialize(); 924 metrics::DesktopEngagementService::Initialize();
954 #endif 925 #endif
955 926
956 #if defined(OS_WIN) 927 #if defined(OS_WIN)
957 chrome_browser::SetupPreReadFieldTrial(); 928 // Cleanup the PreRead field trial registry key.
929 // TODO(fdoray): Remove this when M56 hits stable.
930 const base::string16 pre_read_field_trial_registry_path =
931 BrowserDistribution::GetDistribution()->GetRegistryPath() +
932 L"\\PreReadFieldTrial";
933 base::win::RegKey(HKEY_CURRENT_USER,
934 pre_read_field_trial_registry_path.c_str(), KEY_SET_VALUE)
935 .DeleteKey(L"");
958 #endif // defined(OS_WIN) 936 #endif // defined(OS_WIN)
959 } 937 }
960 938
961 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- 939 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related --------------
962 940
963 void ChromeBrowserMainParts::StartMetricsRecording() { 941 void ChromeBrowserMainParts::StartMetricsRecording() {
964 TRACE_EVENT0("startup", "ChromeBrowserMainParts::StartMetricsRecording"); 942 TRACE_EVENT0("startup", "ChromeBrowserMainParts::StartMetricsRecording");
965 943
966 g_browser_process->metrics_service()->CheckForClonedInstall( 944 g_browser_process->metrics_service()->CheckForClonedInstall(
967 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); 945 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE));
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 chromeos::CrosSettings::Shutdown(); 2188 chromeos::CrosSettings::Shutdown();
2211 #endif // defined(OS_CHROMEOS) 2189 #endif // defined(OS_CHROMEOS)
2212 #endif // defined(OS_ANDROID) 2190 #endif // defined(OS_ANDROID)
2213 } 2191 }
2214 2192
2215 // Public members: 2193 // Public members:
2216 2194
2217 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 2195 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
2218 chrome_extra_parts_.push_back(parts); 2196 chrome_extra_parts_.push_back(parts);
2219 } 2197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698