| Index: components/favicon/core/favicon_handler.cc
|
| diff --git a/components/favicon/core/favicon_handler.cc b/components/favicon/core/favicon_handler.cc
|
| index 1d5eac7ccdf34289398f1c2aa256434a160ccb5a..7bfe2cf33a87d6a8b0c9963ace8630a235fa2503 100644
|
| --- a/components/favicon/core/favicon_handler.cc
|
| +++ b/components/favicon/core/favicon_handler.cc
|
| @@ -439,13 +439,15 @@ void FaviconHandler::OnDidDownloadFavicon(
|
| // Remove the first member of image_urls_ and process the remaining.
|
| image_urls_.erase(image_urls_.begin());
|
| ProcessCurrentUrl();
|
| - } else if (best_favicon_candidate_.icon_type != favicon_base::INVALID_ICON) {
|
| - // No more icons to request, set the favicon from the candidate.
|
| - SetFavicon(best_favicon_candidate_.url,
|
| - best_favicon_candidate_.image_url,
|
| - best_favicon_candidate_.image,
|
| - best_favicon_candidate_.icon_type);
|
| - // Reset candidate.
|
| + } else {
|
| + // We have either found the ideal candidate or run out of candidates.
|
| + if (best_favicon_candidate_.icon_type != favicon_base::INVALID_ICON) {
|
| + // No more icons to request, set the favicon from the candidate.
|
| + SetFavicon(best_favicon_candidate_.url, best_favicon_candidate_.image_url,
|
| + best_favicon_candidate_.image,
|
| + best_favicon_candidate_.icon_type);
|
| + }
|
| + // Clear download related state.
|
| image_urls_.clear();
|
| download_requests_.clear();
|
| best_favicon_candidate_ = FaviconCandidate();
|
| @@ -682,11 +684,18 @@ void FaviconHandler::ScheduleDownload(const GURL& url,
|
| // for more details about the max bitmap size.
|
| const int download_id = DownloadFavicon(image_url,
|
| GetMaximalIconSize(icon_type));
|
| - if (download_id) {
|
| - // Download ids should be unique.
|
| - DCHECK(download_requests_.find(download_id) == download_requests_.end());
|
| - download_requests_[download_id] =
|
| - DownloadRequest(url, image_url, icon_type);
|
| +
|
| + // Download ids should be unique.
|
| + DCHECK(download_requests_.find(download_id) == download_requests_.end());
|
| + download_requests_[download_id] = DownloadRequest(url, image_url, icon_type);
|
| +
|
| + if (download_id == 0) {
|
| + // If DownloadFavicon() did not start a download, it returns a download id
|
| + // of 0. We still need to call OnDidDownloadFavicon() because the method is
|
| + // responsible for initiating the data request for the next candidate.
|
| + OnDidDownloadFavicon(download_id, image_url, std::vector<SkBitmap>(),
|
| + std::vector<gfx::Size>());
|
| +
|
| }
|
| }
|
|
|
|
|