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

Unified Diff: components/history/core/browser/thumbnail_database.cc

Issue 2823093002: Make FaviconService::GetRawFaviconForPageURL() select the best candidate among all the icon types (Closed)
Patch Set: Merge branch 'master' into icon_type Created 3 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: components/history/core/browser/thumbnail_database.cc
diff --git a/components/history/core/browser/thumbnail_database.cc b/components/history/core/browser/thumbnail_database.cc
index d9bc22defb1f9eefac4d2f0c6154dd757ffc920a..02a1808dfa26bc56e9356c1078554fcd8ac0c6b8 100644
--- a/components/history/core/browser/thumbnail_database.cc
+++ b/components/history/core/browser/thumbnail_database.cc
@@ -584,19 +584,15 @@ bool ThumbnailDatabase::SetFaviconOutOfDate(favicon_base::FaviconID icon_id) {
favicon_base::FaviconID ThumbnailDatabase::GetFaviconIDForFaviconURL(
const GURL& icon_url,
- int required_icon_type,
- favicon_base::IconType* icon_type) {
- sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE,
- "SELECT id, icon_type FROM favicons WHERE url=? AND (icon_type & ? > 0) "
- "ORDER BY icon_type DESC"));
+ favicon_base::IconType icon_type) {
+ sql::Statement statement(db_.GetCachedStatement(
+ SQL_FROM_HERE, "SELECT id FROM favicons WHERE url=? AND icon_type=?"));
statement.BindString(0, URLDatabase::GURLToDatabaseURL(icon_url));
- statement.BindInt(1, required_icon_type);
+ statement.BindInt(1, icon_type);
if (!statement.Step())
return 0; // not cached
- if (icon_type)
- *icon_type = static_cast<favicon_base::IconType>(statement.ColumnInt(1));
return statement.ColumnInt64(0);
}
@@ -677,11 +673,6 @@ bool ThumbnailDatabase::GetIconMappingsForPageURL(
if (!filtered_mapping_data)
return result;
- // Restrict icon type of subsequent matches to |m->icon_type|.
- // |m->icon_type| is the largest IconType in |mapping_data| because
- // |mapping_data| is sorted in descending order of IconType.
- required_icon_types = m->icon_type;
-
filtered_mapping_data->push_back(*m);
}
}
@@ -691,14 +682,14 @@ bool ThumbnailDatabase::GetIconMappingsForPageURL(
bool ThumbnailDatabase::GetIconMappingsForPageURL(
const GURL& page_url,
std::vector<IconMapping>* mapping_data) {
- sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE,
+ sql::Statement statement(db_.GetCachedStatement(
+ SQL_FROM_HERE,
"SELECT icon_mapping.id, icon_mapping.icon_id, favicons.icon_type, "
"favicons.url "
"FROM icon_mapping "
"INNER JOIN favicons "
"ON icon_mapping.icon_id = favicons.id "
- "WHERE icon_mapping.page_url=? "
- "ORDER BY favicons.icon_type DESC"));
+ "WHERE icon_mapping.page_url=?"));
statement.BindString(0, URLDatabase::GURLToDatabaseURL(page_url));
bool result = false;

Powered by Google App Engine
This is Rietveld 408576698