| OLD | NEW |
| 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/chromeos/external_metrics.h" | 5 #include "chrome/browser/chromeos/external_metrics.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return true; | 43 return true; |
| 44 return histogram->HasConstructionArguments(minimum, maximum, bucket_count); | 44 return histogram->HasConstructionArguments(minimum, maximum, bucket_count); |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool CheckLinearValues(const std::string& name, int maximum) { | 47 bool CheckLinearValues(const std::string& name, int maximum) { |
| 48 return CheckValues(name, 1, maximum, maximum + 1); | 48 return CheckValues(name, 1, maximum, maximum + 1); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Establishes field trial for wifi scanning in chromeos. crbug.com/242733. | 51 // Establishes field trial for wifi scanning in chromeos. crbug.com/242733. |
| 52 void SetupProgressiveScanFieldTrial() { | 52 void SetupProgressiveScanFieldTrial() { |
| 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 53 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 54 const char name_of_experiment[] = "ProgressiveScan"; | 54 const char name_of_experiment[] = "ProgressiveScan"; |
| 55 const base::FilePath group_file_path( | 55 const base::FilePath group_file_path( |
| 56 "/home/chronos/.progressive_scan_variation"); | 56 "/home/chronos/.progressive_scan_variation"); |
| 57 const base::FieldTrial::Probability kDivisor = 1000; | 57 const base::FieldTrial::Probability kDivisor = 1000; |
| 58 scoped_refptr<base::FieldTrial> trial = | 58 scoped_refptr<base::FieldTrial> trial = |
| 59 base::FieldTrialList::FactoryGetFieldTrial( | 59 base::FieldTrialList::FactoryGetFieldTrial( |
| 60 name_of_experiment, kDivisor, "Default", 2013, 12, 31, | 60 name_of_experiment, kDivisor, "Default", 2013, 12, 31, |
| 61 base::FieldTrial::SESSION_RANDOMIZED, NULL); | 61 base::FieldTrial::SESSION_RANDOMIZED, NULL); |
| 62 | 62 |
| 63 // Announce the groups with 0 percentage; the actual percentages come from | 63 // Announce the groups with 0 percentage; the actual percentages come from |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 void ExternalMetrics::ScheduleCollector() { | 244 void ExternalMetrics::ScheduleCollector() { |
| 245 bool result; | 245 bool result; |
| 246 result = BrowserThread::PostDelayedTask( | 246 result = BrowserThread::PostDelayedTask( |
| 247 BrowserThread::FILE, FROM_HERE, | 247 BrowserThread::FILE, FROM_HERE, |
| 248 base::Bind(&chromeos::ExternalMetrics::CollectEventsAndReschedule, this), | 248 base::Bind(&chromeos::ExternalMetrics::CollectEventsAndReschedule, this), |
| 249 base::TimeDelta::FromSeconds(kExternalMetricsCollectionIntervalSeconds)); | 249 base::TimeDelta::FromSeconds(kExternalMetricsCollectionIntervalSeconds)); |
| 250 DCHECK(result); | 250 DCHECK(result); |
| 251 } | 251 } |
| 252 | 252 |
| 253 void ExternalMetrics::SetupFieldTrialsOnFileThread() { | 253 void ExternalMetrics::SetupFieldTrialsOnFileThread() { |
| 254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 254 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 255 // Field trials that do not read from files can be initialized in | 255 // Field trials that do not read from files can be initialized in |
| 256 // ExternalMetrics::Start() above. | 256 // ExternalMetrics::Start() above. |
| 257 SetupProgressiveScanFieldTrial(); | 257 SetupProgressiveScanFieldTrial(); |
| 258 | 258 |
| 259 ScheduleCollector(); | 259 ScheduleCollector(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace chromeos | 262 } // namespace chromeos |
| OLD | NEW |