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

Unified Diff: components/previews/core/previews_experiments.cc

Issue 2537643005: Refactoring a code pattern in previews_experiments.cc (Closed)
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/previews/core/previews_experiments.cc
diff --git a/components/previews/core/previews_experiments.cc b/components/previews/core/previews_experiments.cc
index fc7922cca8a83bf8b79c8419372e9c5761183a63..3806bc9c8e8f6084023175e7ff2c222bed53c99f 100644
--- a/components/previews/core/previews_experiments.cc
+++ b/components/previews/core/previews_experiments.cc
@@ -89,81 +89,72 @@ namespace params {
size_t MaxStoredHistoryLengthForPerHostBlackList() {
std::string param_value = ParamValue(kMaxStoredHistoryLengthPerHost);
size_t history_length;
- if (!base::StringToSizeT(param_value, &history_length)) {
- return 4;
- }
+ if (!base::StringToSizeT(param_value, &history_length))
+ history_length = 4;
return history_length;
}
size_t MaxStoredHistoryLengthForHostIndifferentBlackList() {
std::string param_value = ParamValue(kMaxStoredHistoryLengthHostIndifferent);
size_t history_length;
- if (!base::StringToSizeT(param_value, &history_length)) {
- return 10;
- }
+ if (!base::StringToSizeT(param_value, &history_length))
+ history_length = 10;
return history_length;
}
size_t MaxInMemoryHostsInBlackList() {
std::string param_value = ParamValue(kMaxHostsInBlackList);
size_t max_hosts;
- if (!base::StringToSizeT(param_value, &max_hosts)) {
- return 100;
- }
+ if (!base::StringToSizeT(param_value, &max_hosts))
+ max_hosts = 100;
return max_hosts;
}
int PerHostBlackListOptOutThreshold() {
std::string param_value = ParamValue(kPerHostOptOutThreshold);
int opt_out_threshold;
- if (!base::StringToInt(param_value, &opt_out_threshold)) {
- return 2;
- }
+ if (!base::StringToInt(param_value, &opt_out_threshold))
+ opt_out_threshold = 2;
return opt_out_threshold;
}
int HostIndifferentBlackListOptOutThreshold() {
std::string param_value = ParamValue(kHostIndifferentOptOutThreshold);
int opt_out_threshold;
- if (!base::StringToInt(param_value, &opt_out_threshold)) {
- return 4;
- }
+ if (!base::StringToInt(param_value, &opt_out_threshold))
+ opt_out_threshold = 4;
return opt_out_threshold;
}
base::TimeDelta PerHostBlackListDuration() {
std::string param_value = ParamValue(kPerHostBlackListDurationInDays);
int duration;
- if (!base::StringToInt(param_value, &duration)) {
- return base::TimeDelta::FromDays(30);
- }
+ if (!base::StringToInt(param_value, &duration))
+ duration = 30;
return base::TimeDelta::FromDays(duration);
}
base::TimeDelta HostIndifferentBlackListPerHostDuration() {
std::string param_value = ParamValue(kHostIndifferentBlackListDurationInDays);
int duration;
- if (!base::StringToInt(param_value, &duration)) {
- return base::TimeDelta::FromDays(365 * 100);
- }
+ if (!base::StringToInt(param_value, &duration))
+ duration = 365 * 100;
return base::TimeDelta::FromDays(duration);
}
base::TimeDelta SingleOptOutDuration() {
std::string param_value = ParamValue(kSingleOptOutDurationInSeconds);
int duration;
- if (!base::StringToInt(param_value, &duration)) {
- return base::TimeDelta::FromSeconds(60 * 5);
- }
+ if (!base::StringToInt(param_value, &duration))
+ duration = 60 * 5;
return base::TimeDelta::FromSeconds(duration);
}
base::TimeDelta OfflinePreviewFreshnessDuration() {
std::string param_value = ParamValue(kOfflinePreviewFreshnessDurationInDays);
int duration;
- if (!base::StringToInt(param_value, &duration)) {
- return base::TimeDelta::FromDays(7);
- }
+ if (!base::StringToInt(param_value, &duration))
+ duration = 7;
return base::TimeDelta::FromDays(duration);
}
« 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