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

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

Issue 1295733002: Ignore duplicate FaviconHandler::OnUpdateFaviconURL() calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@page_changed_under_us
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | components/favicon/core/favicon_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/core/favicon_handler.h
diff --git a/components/favicon/core/favicon_handler.h b/components/favicon/core/favicon_handler.h
index 4850f3c936d9d59cd7b8dd9d11aed289deec3e91..48f459495450bdbaf246bc0a3a1616b805489ecc 100644
--- a/components/favicon/core/favicon_handler.h
+++ b/components/favicon/core/favicon_handler.h
@@ -231,7 +231,9 @@ class FaviconHandler {
// Return the current candidate if any.
favicon::FaviconURL* current_candidate() {
- return (!image_urls_.empty()) ? &image_urls_.front() : NULL;
+ return current_candidate_index_ < image_urls_.size()
+ ? &image_urls_[current_candidate_index_]
+ : nullptr;
}
// Returns the preferred size of the image. 0 means no preference (any size
@@ -242,11 +244,6 @@ class FaviconHandler {
return handler_type_ == FAVICON ? gfx::kFaviconSize : 0;
}
- // Sorts the entries in |image_urls_| by icon size in descending order.
- // Additionally removes any entries whose sizes are all greater than the max
- // allowed size.
- void SortAndPruneImageUrls();
-
// Used for FaviconService requests.
base::CancelableTaskTracker cancelable_task_tracker_;
@@ -288,6 +285,10 @@ class FaviconHandler {
// This handler's driver, owns this object.
FaviconDriver* driver_;
+ // The index of the favicon URL in |image_urls_| which is currently being
+ // requested from history or downloaded.
+ size_t current_candidate_index_;
+
// Best image we've seen so far. As images are downloaded from the page they
// are stored here. When there is an exact match, or no more images are
// available the favicon service and the current page are updated (assuming
« no previous file with comments | « no previous file | components/favicon/core/favicon_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698