OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/ntp_tiles/icon_cacher_impl.h" | 5 #include "components/ntp_tiles/icon_cacher_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "components/favicon/core/favicon_service.h" | 9 #include "components/favicon/core/favicon_service.h" |
10 #include "components/favicon/core/favicon_util.h" | 10 #include "components/favicon/core/favicon_util.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 // For images with multiple frames, prefer one of size 128x128px. | 42 // For images with multiple frames, prefer one of size 128x128px. |
43 image_fetcher_->SetDesiredImageFrameSize(gfx::Size(128, 128)); | 43 image_fetcher_->SetDesiredImageFrameSize(gfx::Size(128, 128)); |
44 } | 44 } |
45 | 45 |
46 IconCacherImpl::~IconCacherImpl() = default; | 46 IconCacherImpl::~IconCacherImpl() = default; |
47 | 47 |
48 void IconCacherImpl::StartFetch( | 48 void IconCacherImpl::StartFetch( |
49 PopularSites::Site site, | 49 PopularSites::Site site, |
50 const base::Closure& icon_available, | 50 const base::Closure& icon_available, |
51 const base::Closure& preliminary_icon_available) { | 51 const base::Closure& preliminary_icon_available) { |
52 // From [5.2.2] of the standard, "the order of evaluation of arguments is | |
53 // unspecified. All side effects of argument expression evaluations take | |
54 // effect before the function is entered" so copy values from |site| before | |
55 // it is moved. | |
sfiera
2017/03/08 09:38:54
I think "copy values from |site| before it is move
sdefresne
2017/03/08 18:35:35
Done.
| |
56 GURL site_url = site.url; | |
57 favicon_base::IconType icon_type = IconType(site); | |
52 favicon::GetFaviconImageForPageURL( | 58 favicon::GetFaviconImageForPageURL( |
53 favicon_service_, site.url, IconType(site), | 59 favicon_service_, site_url, icon_type, |
54 base::Bind(&IconCacherImpl::OnGetFaviconImageForPageURLFinished, | 60 base::Bind(&IconCacherImpl::OnGetFaviconImageForPageURLFinished, |
55 base::Unretained(this), std::move(site), icon_available, | 61 base::Unretained(this), std::move(site), icon_available, |
56 preliminary_icon_available), | 62 preliminary_icon_available), |
57 &tracker_); | 63 &tracker_); |
58 } | 64 } |
59 | 65 |
60 void IconCacherImpl::OnGetFaviconImageForPageURLFinished( | 66 void IconCacherImpl::OnGetFaviconImageForPageURLFinished( |
61 PopularSites::Site site, | 67 PopularSites::Site site, |
62 const base::Closure& icon_available, | 68 const base::Closure& icon_available, |
63 const base::Closure& preliminary_icon_available, | 69 const base::Closure& preliminary_icon_available, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 bool IconCacherImpl::ProvideDefaultIcon(const PopularSites::Site& site) { | 104 bool IconCacherImpl::ProvideDefaultIcon(const PopularSites::Site& site) { |
99 if (site.default_icon_resource < 0) { | 105 if (site.default_icon_resource < 0) { |
100 return false; | 106 return false; |
101 } | 107 } |
102 SaveIconForSite(site, ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 108 SaveIconForSite(site, ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
103 site.default_icon_resource)); | 109 site.default_icon_resource)); |
104 return true; | 110 return true; |
105 } | 111 } |
106 | 112 |
107 } // namespace ntp_tiles | 113 } // namespace ntp_tiles |
OLD | NEW |