Avoid dependency on unspecified evaluation order of parameters.
According to the standard, "the order of evaluation of arguments is unspecified. All side effects of argument expression evaluations take effect before the function is entered." This mean that |site| may be moved before |site.url| or |IconType| are evaluated, thus having them access a moved object (returning unspecified values). BUG=None Review-Url: https://codereview.chromium.org/2737873002 Cr-Commit-Position: refs/heads/master@{#455515}
This commit is contained in:
@ -49,8 +49,11 @@ void IconCacherImpl::StartFetch(
|
||||
PopularSites::Site site,
|
||||
const base::Closure& icon_available,
|
||||
const base::Closure& preliminary_icon_available) {
|
||||
// Copy values from |site| before it is moved.
|
||||
GURL site_url = site.url;
|
||||
favicon_base::IconType icon_type = IconType(site);
|
||||
favicon::GetFaviconImageForPageURL(
|
||||
favicon_service_, site.url, IconType(site),
|
||||
favicon_service_, site_url, icon_type,
|
||||
base::Bind(&IconCacherImpl::OnGetFaviconImageForPageURLFinished,
|
||||
base::Unretained(this), std::move(site), icon_available,
|
||||
preliminary_icon_available),
|
||||
|
Reference in New Issue
Block a user