New issue
Advanced search Search tips

Issue 669683 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Change common pattern in previews_experiments.cc to be more efficient and readable

Project Member Reported by ryansturm@chromium.org, Nov 29 2016

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.
 
Status: Started (was: Assigned)
Project Member

Comment 2 by bugdroid1@chromium.org, 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

Status: Fixed (was: Started)

Sign in to add a comment