Index: chrome/browser/history/history_backend.cc |
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc |
index 015991a29a2f58c8a17eef6ea2af014dbe334113..24ff9ae0923a56a90417250042d816bd2653b3ac 100644 |
--- a/chrome/browser/history/history_backend.cc |
+++ b/chrome/browser/history/history_backend.cc |
@@ -1704,34 +1704,33 @@ void HistoryBackend::UpdateFavIconMappingAndFetchImpl( |
if (request->canceled()) |
return; |
- bool know_favicon = false; |
- bool expired = true; |
- scoped_refptr<RefCountedBytes> data; |
+ FaviconService::FaviconData favicon; |
if (thumbnail_db_.get()) { |
- IconType returned_icon_type; |
const FavIconID favicon_id = |
thumbnail_db_->GetFavIconIDForFavIconURL( |
- icon_url, icon_types, &returned_icon_type); |
+ icon_url, icon_types, &favicon.icon_type); |
if (favicon_id) { |
+ scoped_refptr<RefCountedBytes> data; |
sky
2011/03/10 17:54:44
Does this really work? Don't you need to set favic
michaelbai
2011/03/11 01:11:28
The new RefCountedBytes is actually in next line,
sky
2011/03/11 01:19:26
My mistake.
michaelbai
2011/03/11 16:56:19
data is the member of RefCountedBytes, the type of
sky
2011/03/11 17:56:45
GAH! Sorry. I get it.
I'm tempted to say the callb
|
data = new RefCountedBytes; |
- know_favicon = true; |
+ favicon.known_icon = true; |
Time last_updated; |
- if (thumbnail_db_->GetFavIcon(favicon_id, &last_updated, &data->data, |
+ if (thumbnail_db_->GetFavIcon(favicon_id, &last_updated, |
+ &data->data, |
NULL)) { |
- expired = (Time::Now() - last_updated) > |
+ favicon.expired = (Time::Now() - last_updated) > |
TimeDelta::FromDays(kFavIconRefetchDays); |
+ favicon.image_data = data; |
} |
if (page_url) |
- SetFavIconMapping(*page_url, favicon_id, returned_icon_type); |
+ SetFavIconMapping(*page_url, favicon_id, favicon.icon_type); |
} |
// else case, haven't cached entry yet. Caller is responsible for |
// downloading the favicon and invoking SetFavIcon. |
} |
request->ForwardResult(GetFavIconRequest::TupleType( |
- request->handle(), know_favicon, data, expired, |
- icon_url)); |
+ request->handle(), favicon)); |
} |
void HistoryBackend::GetFavIconForURL( |
@@ -1741,26 +1740,25 @@ void HistoryBackend::GetFavIconForURL( |
if (request->canceled()) |
return; |
- bool know_favicon = false; |
- bool expired = false; |
- GURL icon_url; |
- |
- scoped_refptr<RefCountedBytes> data; |
+ FaviconService::FaviconData favicon; |
if (db_.get() && thumbnail_db_.get()) { |
// Time the query. |
TimeTicks beginning_time = TimeTicks::Now(); |
std::vector<IconMapping> icon_mappings; |
- data = new RefCountedBytes; |
Time last_updated; |
+ scoped_refptr<RefCountedBytes> data; |
sky
2011/03/10 17:54:44
Same comment as above here.
michaelbai
2011/03/11 01:11:28
Moved new RefCountedBytes up
|
+ data = new RefCountedBytes; |
if (thumbnail_db_->GetIconMappingsForPageURL(page_url, &icon_mappings) && |
(icon_mappings.front().icon_type & icon_types) && |
thumbnail_db_->GetFavIcon(icon_mappings.front().icon_id, &last_updated, |
- &data->data, &icon_url)) { |
- know_favicon = true; |
- expired = (Time::Now() - last_updated) > |
+ &data->data, &favicon.icon_url)) { |
+ favicon.known_icon = true; |
+ favicon.expired = (Time::Now() - last_updated) > |
TimeDelta::FromDays(kFavIconRefetchDays); |
+ favicon.icon_type = icon_mappings.front().icon_type; |
+ favicon.image_data = data; |
} |
UMA_HISTOGRAM_TIMES("History.GetFavIconForURL", |
@@ -1768,8 +1766,7 @@ void HistoryBackend::GetFavIconForURL( |
} |
request->ForwardResult( |
- GetFavIconRequest::TupleType(request->handle(), know_favicon, data, |
- expired, icon_url)); |
+ GetFavIconRequest::TupleType(request->handle(), favicon)); |
} |
void HistoryBackend::SetFavIcon( |