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

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

Issue 2333283005: Move EntropyProvider Source From MetricsService to MetricsServicesManager (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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 793
794 // This will be called after the command-line has been mutated by about:flags 794 // This will be called after the command-line has been mutated by about:flags
795 void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() { 795 void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() {
796 TRACE_EVENT0("startup", "ChromeBrowserMainParts::SetupMetricsAndFieldTrials"); 796 TRACE_EVENT0("startup", "ChromeBrowserMainParts::SetupMetricsAndFieldTrials");
797 // Must initialize metrics after labs have been converted into switches, 797 // Must initialize metrics after labs have been converted into switches,
798 // but before field trials are set up (so that client ID is available for 798 // but before field trials are set up (so that client ID is available for
799 // one-time randomized field trials). 799 // one-time randomized field trials).
800 800
801 // Initialize FieldTrialList to support FieldTrials that use one-time 801 // Initialize FieldTrialList to support FieldTrials that use one-time
802 // randomization. 802 // randomization.
803 metrics::MetricsService* metrics = browser_process_->metrics_service();
804
805 DCHECK(!field_trial_list_); 803 DCHECK(!field_trial_list_);
806 field_trial_list_.reset( 804 field_trial_list_.reset(
807 new base::FieldTrialList(metrics->CreateEntropyProvider().release())); 805 new base::FieldTrialList(browser_process_->GetMetricsServicesManager()
806 ->CreateEntropyProvider()
807 .release()));
808 808
809 const base::CommandLine* command_line = 809 const base::CommandLine* command_line =
810 base::CommandLine::ForCurrentProcess(); 810 base::CommandLine::ForCurrentProcess();
811 if (command_line->HasSwitch(switches::kEnableBenchmarking) || 811 if (command_line->HasSwitch(switches::kEnableBenchmarking) ||
812 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)) { 812 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)) {
813 base::FieldTrial::EnableBenchmarking(); 813 base::FieldTrial::EnableBenchmarking();
814 } 814 }
815 815
816 if (command_line->HasSwitch(switches::kForceFieldTrialParams)) { 816 if (command_line->HasSwitch(switches::kForceFieldTrialParams)) {
817 bool result = chrome_variations::AssociateParamsFromString( 817 bool result = chrome_variations::AssociateParamsFromString(
(...skipping 20 matching lines...) Expand all
838 838
839 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); 839 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
840 840
841 // Associate parameters chosen in about:flags and create trial/group for them. 841 // Associate parameters chosen in about:flags and create trial/group for them.
842 flags_ui::PrefServiceFlagsStorage flags_storage( 842 flags_ui::PrefServiceFlagsStorage flags_storage(
843 g_browser_process->local_state()); 843 g_browser_process->local_state());
844 std::vector<std::string> variation_ids = 844 std::vector<std::string> variation_ids =
845 about_flags::RegisterAllFeatureVariationParameters( 845 about_flags::RegisterAllFeatureVariationParameters(
846 &flags_storage, feature_list.get()); 846 &flags_storage, feature_list.get());
847 847
848 metrics::MetricsService* metrics = browser_process_->metrics_service();
848 variations::VariationsHttpHeaderProvider* http_header_provider = 849 variations::VariationsHttpHeaderProvider* http_header_provider =
849 variations::VariationsHttpHeaderProvider::GetInstance(); 850 variations::VariationsHttpHeaderProvider::GetInstance();
850 // Force the variation ids selected in chrome://flags and/or specified using 851 // Force the variation ids selected in chrome://flags and/or specified using
851 // the command-line flag. 852 // the command-line flag.
852 bool result = http_header_provider->ForceVariationIds( 853 bool result = http_header_provider->ForceVariationIds(
853 command_line->GetSwitchValueASCII(switches::kForceVariationIds), 854 command_line->GetSwitchValueASCII(switches::kForceVariationIds),
854 &variation_ids); 855 &variation_ids);
855 CHECK(result) << "Invalid list of variation ids specified (either in --" 856 CHECK(result) << "Invalid list of variation ids specified (either in --"
856 << switches::kForceVariationIds << " or in chrome://flags)"; 857 << switches::kForceVariationIds << " or in chrome://flags)";
857 metrics->AddSyntheticTrialObserver(http_header_provider); 858 metrics->AddSyntheticTrialObserver(http_header_provider);
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 chromeos::CrosSettings::Shutdown(); 2208 chromeos::CrosSettings::Shutdown();
2208 #endif // defined(OS_CHROMEOS) 2209 #endif // defined(OS_CHROMEOS)
2209 #endif // defined(OS_ANDROID) 2210 #endif // defined(OS_ANDROID)
2210 } 2211 }
2211 2212
2212 // Public members: 2213 // Public members:
2213 2214
2214 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 2215 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
2215 chrome_extra_parts_.push_back(parts); 2216 chrome_extra_parts_.push_back(parts);
2216 } 2217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698