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

Unified Diff: chrome/browser/history/history_backend.h

Issue 531493002: Move encoding SkBitmaps to PNG out of FaviconService::SetFavicons() and onto the history thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/history/history_backend.h
diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h
index d462b2ecee302da0f863265a16192aa4d1f5bf62..d21b59ae70eb8e69b60295525144f1b240289569 100644
--- a/chrome/browser/history/history_backend.h
+++ b/chrome/browser/history/history_backend.h
@@ -33,6 +33,7 @@
class HistoryURLProvider;
struct HistoryURLProviderParams;
struct ImportedFaviconUsage;
+class SkBitmap;
class TestingProfile;
struct ThumbnailScore;
@@ -264,10 +265,10 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
scoped_refptr<base::RefCountedMemory> bitmap_data,
const gfx::Size& pixel_size);
- void SetFavicons(const GURL& page_url,
- favicon_base::IconType icon_type,
- const std::vector<favicon_base::FaviconRawBitmapData>&
- favicon_bitmap_data);
+ void SetFavicon(const GURL& page_url,
+ favicon_base::IconType icon_type,
+ const GURL& icon_url,
+ const std::vector<SkBitmap>& bitmaps);
void SetFaviconsOutOfDateForPage(const GURL& page_url);
@@ -526,10 +527,10 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
SetFaviconMappingsForPageAndRedirects);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
SetFaviconMappingsForPageDuplicates);
- FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsDeleteBitmaps);
- FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsReplaceBitmapData);
+ FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconDeleteBitmaps);
+ FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconReplaceBitmapData);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
- SetFaviconsSameFaviconURLForTwoPages);
+ SetFaviconSameFaviconURLForTwoPages);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
UpdateFaviconMappingsAndFetchNoChange);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB);
@@ -546,7 +547,6 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
GetFaviconsFromDBNoFaviconBitmaps);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
GetFaviconsFromDBSelectClosestMatch);
- FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBSingleIconURL);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired);
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
@@ -689,29 +689,19 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
std::vector<favicon_base::FaviconRawBitmapResult>* results);
// Set the favicon bitmaps for |icon_id|.
- // For each entry in |favicon_bitmap_data|, if a favicon bitmap already
- // exists at the entry's pixel size, replace the favicon bitmap's data with
- // the entry's bitmap data. Otherwise add a new favicon bitmap.
- // Any favicon bitmaps already mapped to |icon_id| whose pixel sizes are not
- // in |favicon_bitmap_data| are deleted.
+ // For each entry in |bitmaps|, if a favicon bitmap already exists at the
+ // entry's pixel size, replace the favicon bitmap's data with the entry's
+ // bitmap data. Otherwise add a new favicon bitmap.
+ // Any favicon bitmaps already mapped to |icon_id| whose pixel size does not
+ // match the pixel size of one of |bitmaps| is deleted.
// If not NULL, |favicon_bitmaps_changed| is set to whether any of the bitmap
// data at |icon_id| is changed as a result of calling this method.
// Computing |favicon_bitmaps_changed| requires additional database queries
// so should be avoided if unnecessary.
void SetFaviconBitmaps(favicon_base::FaviconID icon_id,
- const std::vector<favicon_base::FaviconRawBitmapData>&
- favicon_bitmap_data,
+ const std::vector<SkBitmap>& bitmaps,
bool* favicon_bitmaps_changed);
- // Returns true if |favicon_bitmap_data| passed to SetFavicons() is valid.
- // Criteria:
- // 1) |favicon_bitmap_data| contains no more than
- // kMaxFaviconsPerPage unique icon URLs.
- // kMaxFaviconBitmapsPerIconURL favicon bitmaps for each icon URL.
- // 2) FaviconRawBitmapData::bitmap_data contains non NULL bitmap data.
- bool ValidateSetFaviconsParams(const std::vector<
- favicon_base::FaviconRawBitmapData>& favicon_bitmap_data) const;
-
// Returns true if the bitmap data at |bitmap_id| equals |new_bitmap_data|.
bool IsFaviconBitmapDataEqual(
FaviconBitmapID bitmap_id,

Powered by Google App Engine
This is Rietveld 408576698