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

Side by Side 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: fix lint errors Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/favicon/favicon_service.h" 5 #include "chrome/browser/favicon/favicon_service.h"
6 6
7 #include "base/hash.h"
7 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
8 #include "chrome/browser/favicon/favicon_util.h" 9 #include "chrome/browser/favicon/favicon_util.h"
9 #include "chrome/browser/history/history_backend.h" 10 #include "chrome/browser/history/history_backend.h"
10 #include "chrome/browser/history/history_service.h" 11 #include "chrome/browser/history/history_service.h"
11 #include "chrome/browser/history/history_service_factory.h" 12 #include "chrome/browser/history/history_service_factory.h"
12 #include "chrome/browser/history/select_favicon_frames.h" 13 #include "chrome/browser/history/select_favicon_frames.h"
13 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 14 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
14 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
15 #include "extensions/common/constants.h" 16 #include "extensions/common/constants.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, 347 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false,
347 &resized_bitmap_data)) { 348 &resized_bitmap_data)) {
348 callback.Run(history::FaviconBitmapResult()); 349 callback.Run(history::FaviconBitmapResult());
349 return; 350 return;
350 } 351 }
351 352
352 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( 353 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector(
353 &resized_bitmap_data); 354 &resized_bitmap_data);
354 callback.Run(bitmap_result); 355 callback.Run(bitmap_result);
355 } 356 }
357
358 void FaviconService::AddMissingFavicon(const GURL& icon_url) {
359 missing_favicon_urls_.insert(base::Hash(icon_url.spec()));
mef 2013/04/29 21:55:03 Should I somehow protect this set from multi-threa
pauljensen 2013/04/30 14:38:04 I would always tend to say yes, but I don't see an
mef 2013/04/30 21:57:03 Sounds good, will do. On 2013/04/30 14:38:04, paul
360 }
361
362 bool FaviconService::IsMissingFavicon(const GURL& icon_url) const {
363 int32 url_hash = base::Hash(icon_url.spec());
364 return missing_favicon_urls_.find(url_hash) != missing_favicon_urls_.end();
365 }
366
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698