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

Unified Diff: chrome/browser/engagement/site_engagement_score.cc

Issue 2352263002: Allow incomplete params for site engagement configs. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/engagement/site_engagement_score.cc
diff --git a/chrome/browser/engagement/site_engagement_score.cc b/chrome/browser/engagement/site_engagement_score.cc
index d38d2ad9f349ddfa7d0d7f635d88c7627895ea42..118936d68b1471c26ed4764b57689d41f78c8487 100644
--- a/chrome/browser/engagement/site_engagement_score.cc
+++ b/chrome/browser/engagement/site_engagement_score.cc
@@ -157,25 +157,21 @@ double SiteEngagementScore::GetLastEngagementGracePeriodInHours() {
// static
void SiteEngagementScore::UpdateFromVariations(const char* param_name) {
- double param_vals[MAX_VARIATION];
-
for (int i = 0; i < MAX_VARIATION; ++i) {
+ double param;
std::string param_string = variations::GetVariationParamValue(
param_name, GetParamValues()[i].first);
// Bail out if we didn't get a param string for the key, or if we couldn't
// convert the param string to a double, or if we get a negative value.
if (param_string.empty() ||
- !base::StringToDouble(param_string, &param_vals[i]) ||
- param_vals[i] < 0) {
- return;
+ !base::StringToDouble(param_string, &param) ||
+ param < 0) {
+ continue;
}
- }
- // Once we're sure everything is valid, assign the variation to the param
- // values array.
- for (int i = 0; i < MAX_VARIATION; ++i)
- SiteEngagementScore::GetParamValues()[i].second = param_vals[i];
+ SiteEngagementScore::GetParamValues()[i].second = param;
+ }
}
SiteEngagementScore::SiteEngagementScore(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698