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

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

Issue 10830241: Inform GetEntropySource of whether or not metrics reporting will be enabled. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 #if defined(OS_WIN) 533 #if defined(OS_WIN)
534 if (parsed_command_line_.HasSwitch(switches::kChromeFrame)) 534 if (parsed_command_line_.HasSwitch(switches::kChromeFrame))
535 MetricsLog::set_version_extension("-F"); 535 MetricsLog::set_version_extension("-F");
536 #elif defined(ARCH_CPU_64_BITS) 536 #elif defined(ARCH_CPU_64_BITS)
537 MetricsLog::set_version_extension("-64"); 537 MetricsLog::set_version_extension("-64");
538 #endif // defined(OS_WIN) 538 #endif // defined(OS_WIN)
539 539
540 // Initialize FieldTrialList to support FieldTrials that use one-time 540 // Initialize FieldTrialList to support FieldTrials that use one-time
541 // randomization. 541 // randomization.
542 MetricsService* metrics = browser_process_->metrics_service(); 542 MetricsService* metrics = browser_process_->metrics_service();
543 if (IsMetricsReportingEnabled()) 543 bool metrics_reporting_enabled = IsMetricsReportingEnabled();
544 if (metrics_reporting_enabled)
544 metrics->ForceClientIdCreation(); // Needed below. 545 metrics->ForceClientIdCreation(); // Needed below.
545 field_trial_list_.reset( 546 field_trial_list_.reset(
546 new base::FieldTrialList(metrics->GetEntropySource())); 547 new base::FieldTrialList(
548 metrics->GetEntropySource(metrics_reporting_enabled)));
547 549
548 // Ensure any field trials specified on the command line are initialized. 550 // Ensure any field trials specified on the command line are initialized.
549 // Also stop the metrics service so that we don't pollute UMA. 551 // Also stop the metrics service so that we don't pollute UMA.
550 #ifndef NDEBUG 552 #ifndef NDEBUG
551 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 553 const CommandLine* command_line = CommandLine::ForCurrentProcess();
552 if (command_line->HasSwitch(switches::kForceFieldTrials)) { 554 if (command_line->HasSwitch(switches::kForceFieldTrials)) {
553 std::string persistent = command_line->GetSwitchValueASCII( 555 std::string persistent = command_line->GetSwitchValueASCII(
554 switches::kForceFieldTrials); 556 switches::kForceFieldTrials);
555 bool ret = base::FieldTrialList::CreateTrialsFromString(persistent); 557 bool ret = base::FieldTrialList::CreateTrialsFromString(persistent);
556 CHECK(ret) << "Invalid --" << switches::kForceFieldTrials << 558 CHECK(ret) << "Invalid --" << switches::kForceFieldTrials <<
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 606
605 #if defined(GOOGLE_CHROME_BUILD) 607 #if defined(GOOGLE_CHROME_BUILD)
606 #if defined(OS_CHROMEOS) 608 #if defined(OS_CHROMEOS)
607 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, 609 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
608 &enabled); 610 &enabled);
609 #else 611 #else
610 enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled); 612 enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled);
611 #endif // #if defined(OS_CHROMEOS) 613 #endif // #if defined(OS_CHROMEOS)
612 #endif // defined(GOOGLE_CHROME_BUILD) 614 #endif // defined(GOOGLE_CHROME_BUILD)
613 return enabled; 615 return enabled;
614 } 616 }
Ilya Sherman 2012/08/09 16:47:29 Another option is to move this method into the Met
SteveT 2012/08/09 17:18:30 I'd rather go for a reasonable and simpler fix tha
615 617
616 // ----------------------------------------------------------------------------- 618 // -----------------------------------------------------------------------------
617 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. 619 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts.
618 620
619 #if defined(OS_WIN) 621 #if defined(OS_WIN)
620 #define DLLEXPORT __declspec(dllexport) 622 #define DLLEXPORT __declspec(dllexport)
621 623
622 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. 624 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling.
623 extern "C" { 625 extern "C" {
624 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded(); 626 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded();
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 if (base::win::GetVersion() <= base::win::VERSION_XP) 1526 if (base::win::GetVersion() <= base::win::VERSION_XP)
1525 uma_name += "_XP"; 1527 uma_name += "_XP";
1526 1528
1527 uma_name += "_PreRead_"; 1529 uma_name += "_PreRead_";
1528 uma_name += pre_read_percentage; 1530 uma_name += pre_read_percentage;
1529 AddPreReadHistogramTime(uma_name.c_str(), time); 1531 AddPreReadHistogramTime(uma_name.c_str(), time);
1530 } 1532 }
1531 #endif 1533 #endif
1532 #endif 1534 #endif
1533 } 1535 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/metrics_service.h » ('j') | chrome/browser/metrics/metrics_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698