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

Unified Diff: chrome/common/metrics/variations/variations_util.cc

Issue 23579003: GCAPI should append to the existing experiment_labels instead of clobbering them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: check return value of ReadExperimentLabels Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/installer/gcapi/gcapi_omaha_experiment.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/metrics/variations/variations_util.cc
diff --git a/chrome/common/metrics/variations/variations_util.cc b/chrome/common/metrics/variations/variations_util.cc
index 5ef0bf89d3ef8337225a4fdb555346b8daed17ce..e0ffaf61b403b12ca0a8c1468f665f76aece05a0 100644
--- a/chrome/common/metrics/variations/variations_util.cc
+++ b/chrome/common/metrics/variations/variations_util.cc
@@ -13,6 +13,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/child_process_logging.h"
+#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/google_update_experiment_util.h"
namespace chrome_variations {
@@ -20,7 +21,6 @@ namespace chrome_variations {
namespace {
const char kVariationPrefix[] = "CrVar";
-const char kExperimentLabelSep[] = ";";
robertshield 2013/08/30 01:13:53 This has gone from a char to a wchar_t and doesn't
Alexei Svitkine (slow) 2013/08/30 02:16:47 It should be a char16, since on some platforms wch
gab 2013/08/30 02:43:18 Good catch; thanks for the hint; done.
// Populates |name_group_ids| based on |active_groups|.
void GetFieldTrialActiveGroupIdsForActiveGroups(
@@ -118,7 +118,7 @@ string16 BuildGoogleUpdateExperimentLabel(
continue;
if (!experiment_labels.empty())
- experiment_labels += ASCIIToUTF16(kExperimentLabelSep);
+ experiment_labels += google_update::kExperimentLabelSep;
experiment_labels += CreateSingleExperimentLabel(++counter, id);
}
@@ -126,12 +126,12 @@ string16 BuildGoogleUpdateExperimentLabel(
}
string16 ExtractNonVariationLabels(const string16& labels) {
- const string16 separator = ASCIIToUTF16(kExperimentLabelSep);
string16 non_variation_labels;
// First, split everything by the label separator.
std::vector<string16> entries;
- base::SplitStringUsingSubstr(labels, separator, &entries);
+ base::SplitStringUsingSubstr(
+ labels, google_update::kExperimentLabelSep, &entries);
// For each label, keep the ones that do not look like a Variations label.
for (std::vector<string16>::const_iterator it = entries.begin();
@@ -141,7 +141,7 @@ string16 ExtractNonVariationLabels(const string16& labels) {
// Dump the whole thing, including the timestamp.
if (!non_variation_labels.empty())
- non_variation_labels += separator;
+ non_variation_labels += google_update::kExperimentLabelSep;
non_variation_labels += *it;
}
@@ -150,15 +150,16 @@ string16 ExtractNonVariationLabels(const string16& labels) {
string16 CombineExperimentLabels(const string16& variation_labels,
const string16& other_labels) {
- const string16 separator = ASCIIToUTF16(kExperimentLabelSep);
- DCHECK(!StartsWith(variation_labels, separator, false));
- DCHECK(!EndsWith(variation_labels, separator, false));
- DCHECK(!StartsWith(other_labels, separator, false));
- DCHECK(!EndsWith(other_labels, separator, false));
+ DCHECK(!StartsWith(variation_labels, google_update::kExperimentLabelSep,
+ false));
+ DCHECK(!EndsWith(variation_labels, google_update::kExperimentLabelSep,
+ false));
+ DCHECK(!StartsWith(other_labels, google_update::kExperimentLabelSep, false));
+ DCHECK(!EndsWith(other_labels, google_update::kExperimentLabelSep, false));
// Note that if either label is empty, a separator is not necessary.
string16 combined_labels = other_labels;
if (!other_labels.empty() && !variation_labels.empty())
- combined_labels += separator;
+ combined_labels += google_update::kExperimentLabelSep;
combined_labels += variation_labels;
return combined_labels;
}
« no previous file with comments | « no previous file | chrome/installer/gcapi/gcapi_omaha_experiment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698