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

Unified Diff: components/variations/variations_seed_processor.h

Issue 59103009: Refactor VariationsSeedProcessor to add ProcessedStudy struct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/variations/processed_study.cc ('k') | components/variations/variations_seed_processor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/variations/variations_seed_processor.h
===================================================================
--- components/variations/variations_seed_processor.h (revision 233704)
+++ components/variations/variations_seed_processor.h (working copy)
@@ -6,6 +6,7 @@
#define COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_
#include <string>
+#include <vector>
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
@@ -17,6 +18,8 @@
namespace chrome_variations {
+struct ProcessedStudy;
+
// Helper class to instantiate field trials from a variations seed.
class VariationsSeedProcessor {
public:
@@ -38,7 +41,7 @@
FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyStartDate);
FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyVersion);
FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest,
- CheckStudyVersionWildcards);
+ FilterAndValidateStudies);
FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag1);
FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag2);
FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest,
@@ -51,6 +54,22 @@
FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest,
VariationParamsWithForcingFlag);
+ // Filters the list of studies in |seed| and validates and pre-processes them,
+ // adding any kept studies to |filtered_studies| list. Ensures that the
+ // resulting list will not have more than one study with the same name.
+ void FilterAndValidateStudies(const VariationsSeed& seed,
+ const std::string& locale,
+ const base::Time& reference_date,
+ const base::Version& version,
+ Study_Channel channel,
+ std::vector<ProcessedStudy>* filtered_studies);
+
+ // Validates |study| and if valid, adds it to |filtered_studies| as a
+ // ProcessedStudy object.
+ void ValidateAndAddStudy(const Study& study,
+ bool is_expired,
+ std::vector<ProcessedStudy>* filtered_studies);
+
// Checks whether a study is applicable for the given |channel| per |filter|.
bool CheckStudyChannel(const Study_Filter& filter, Study_Channel channel);
@@ -68,9 +87,9 @@
bool CheckStudyVersion(const Study_Filter& filter,
const base::Version& version);
- // Creates and registers a field trial from the |study| data. Disables the
- // trial if |is_expired| is true.
- void CreateTrialFromStudy(const Study& study, bool is_expired);
+ // Creates and registers a field trial from the |processed_study| data.
+ // Disables the trial if |processed_study.is_expired| is true.
+ void CreateTrialFromStudy(const ProcessedStudy& processed_study);
// Checks whether |study| is expired using the given date/time.
bool IsStudyExpired(const Study& study, const base::Time& date_time);
« no previous file with comments | « components/variations/processed_study.cc ('k') | components/variations/variations_seed_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698