Change common pattern in previews_experiments.cc to be more efficient and readable |
||
Issue description
Currently, the following pattern is used repeatedly in components/previews/core/previews_experiments.cc:
int duration;
if (!base::StringToInt(param_value, &duration)) {
return base::TimeDelta::FromDays(<some default value>);
}
return base::TimeDelta::FromDays(duration);
This could be more efficiently written as:
int duration;
if (!base::StringToInt(param_value, &duration)) {
duration = <some default value>;
}
return base::TimeDelta::FromDays(duration);
This change will reduce binary size slightly and it will make the code somewhat simpler and easier to read.
,
Nov 30 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/de09bb7918768dcb4d73b1183c3ab7c1526696bb commit de09bb7918768dcb4d73b1183c3ab7c1526696bb Author: ryansturm <ryansturm@chromium.org> Date: Wed Nov 30 14:16:34 2016 Refactoring a code pattern in previews_experiments.cc This changes a code pattern in previews params to be a little more readable and in some cases more efficient in terms of binary size. BUG= 669683 Review-Url: https://codereview.chromium.org/2537643005 Cr-Commit-Position: refs/heads/master@{#435253} [modify] https://crrev.com/de09bb7918768dcb4d73b1183c3ab7c1526696bb/components/previews/core/previews_experiments.cc
,
Nov 30 2016
|
||
►
Sign in to add a comment |
||
Comment 1 by ryansturm@chromium.org
, Nov 29 2016