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

Unified Diff: chrome/browser/favicon/favicon_service.cc

Issue 14322023: Don't request missing favicon on every page request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Propagate HTTP Status Code to FaviconTabHelper::DidDownloadFavicon, Clear Missing Favicons on RELOA… Created 7 years, 8 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: chrome/browser/favicon/favicon_service.cc
diff --git a/chrome/browser/favicon/favicon_service.cc b/chrome/browser/favicon/favicon_service.cc
index b762b19886e76adfb51da6044e1dc1c3cf85b05a..fb5a8bce981fdef139fc571999f668a98fe08253 100644
--- a/chrome/browser/favicon/favicon_service.cc
+++ b/chrome/browser/favicon/favicon_service.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/favicon/favicon_service.h"
+#include "base/hash.h"
#include "base/message_loop_proxy.h"
#include "chrome/browser/favicon/favicon_util.h"
#include "chrome/browser/history/history_backend.h"
@@ -353,3 +354,19 @@ void FaviconService::RunFaviconRawCallbackWithBitmapResults(
&resized_bitmap_data);
callback.Run(bitmap_result);
}
+
+void FaviconService::AddMissingFavicon(const GURL& icon_url) {
sky 2013/05/03 20:24:54 Order should match header.
mef 2013/05/03 21:45:59 Done.
+ MissingFaviconURLHash url_hash = base::Hash(icon_url.spec());
sky 2013/05/03 20:24:54 How likely are we to get false collisions?
mef 2013/05/03 21:45:59 With ideal Hash it should be 1/2**32 ~ 25*(10**-11
+ missing_favicon_urls_.insert(url_hash);
+}
+
+bool FaviconService::IsMissingFavicon(const GURL& icon_url) const {
+ MissingFaviconURLHash url_hash = base::Hash(icon_url.spec());
+ return missing_favicon_urls_.find(url_hash) != missing_favicon_urls_.end();
+}
+
+void FaviconService::ClearMissingFavicons() {
+ missing_favicon_urls_.clear();
+}
+
sky 2013/05/03 20:24:54 nit: nuke newlines.
mef 2013/05/03 21:45:59 Done.
+

Powered by Google App Engine
This is Rietveld 408576698