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

Unified Diff: components/favicon/core/favicon_handler.cc

Issue 2728893004: Move WasUnableToDownload logic to FaviconHandler (Closed)
Patch Set: Created 3 years, 10 months 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
Index: components/favicon/core/favicon_handler.cc
diff --git a/components/favicon/core/favicon_handler.cc b/components/favicon/core/favicon_handler.cc
index adbb5df8e2a4b4c769f4cca819fc95f424a78fda..57e196ab2a6b0a24b9dcf0769dfd54a5f0158a42 100644
--- a/components/favicon/core/favicon_handler.cc
+++ b/components/favicon/core/favicon_handler.cc
@@ -475,9 +475,8 @@ void FaviconHandler::OnDidDownloadFavicon(
}
}
- if (request_next_icon && current_candidate_index_ + 1 < image_urls_.size()) {
+ if (request_next_icon && IncrementCurrentCandidateIndex()) {
// Process the next candidate.
- ++current_candidate_index_;
DownloadCurrentCandidateOrAskFaviconService();
} else {
// We have either found the ideal candidate or run out of candidates.
@@ -599,6 +598,13 @@ void FaviconHandler::OnFaviconDataForInitialURLFromFaviconService(
OnGotInitialHistoryDataAndIconURLCandidates();
}
+bool FaviconHandler::IncrementCurrentCandidateIndex() {
+ if (current_candidate_index_ + 1 >= image_urls_.size())
+ return false;
+ ++current_candidate_index_;
+ return true;
+}
+
void FaviconHandler::DownloadCurrentCandidateOrAskFaviconService() {
GURL icon_url = current_candidate()->icon_url;
favicon_base::IconType icon_type = current_candidate()->icon_type;
@@ -661,6 +667,14 @@ void FaviconHandler::OnFaviconData(const std::vector<
void FaviconHandler::ScheduleDownload(const GURL& image_url,
favicon_base::IconType icon_type) {
DCHECK(image_url.is_valid());
+ if (service_ && service_->WasUnableToDownloadFavicon(image_url)) {
pkotwicz 2017/03/02 21:20:26 Won't this cause a regression? In particular if a
mastiz 2017/03/03 14:21:14 I think you're right. I tried to add tests that wo
pkotwicz 2017/03/03 18:31:16 This bug is reproduceable on the desktop for a Fav
mastiz 2017/03/03 20:37:01 This seems so unlikely that I'd rather not add tes
pkotwicz 2017/03/03 20:56:14 Fair enough
+ DVLOG(1) << "Skip Failed FavIcon: " << image_url;
+ // Process the next candidate.
+ if (IncrementCurrentCandidateIndex()) {
+ DownloadCurrentCandidateOrAskFaviconService();
+ }
+ return;
+ }
// A max bitmap size is specified to avoid receiving huge bitmaps in
// OnDidDownloadFavicon(). See FaviconDriver::StartDownload()
// for more details about the max bitmap size.

Powered by Google App Engine
This is Rietveld 408576698