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

Unified Diff: chrome/browser/sync/glue/session_model_associator.cc

Issue 10870022: Change FaviconData to be able to return data for multiple bitmaps for same icon URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/sync/glue/session_model_associator.cc
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc
index 67a017daa6ae2243dfe473bf70e2fe5c4eeecbe7..eb566c09d114684fc78150af4a81409b2489c93c 100644
--- a/chrome/browser/sync/glue/session_model_associator.cc
+++ b/chrome/browser/sync/glue/session_model_associator.cc
@@ -560,7 +560,8 @@ void SessionModelAssociator::LoadFaviconForTab(TabLink* tab_link) {
void SessionModelAssociator::OnFaviconDataAvailable(
FaviconService::Handle handle,
- history::FaviconData favicon) {
+ history::FaviconData favicon_data,
+ std::vector<GURL> icon_urls_in_db) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (!command_line.HasSwitch(switches::kSyncTabFavicons))
return;
@@ -579,10 +580,10 @@ void SessionModelAssociator::OnFaviconDataAvailable(
// been canceled if the url had changed, we know the url must still be
// up to date.
- if (favicon.is_valid()) {
+ if (favicon_data.has_valid_bitmaps()) {
DCHECK_EQ(handle, tab_link->favicon_load_handle());
tab_link->set_favicon_load_handle(0);
- DCHECK_EQ(favicon.icon_type, history::FAVICON);
+ DCHECK_EQ(favicon_data.icon_type, history::FAVICON);
DCHECK_NE(tab_link->sync_id(), syncer::kInvalidId);
// Load the sync tab node and update the favicon data.
syncer::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare());
@@ -597,14 +598,16 @@ void SessionModelAssociator::OnFaviconDataAvailable(
tab_node.GetSessionSpecifics();
DCHECK(session_specifics.has_tab());
sync_pb::SessionTab* tab = session_specifics.mutable_tab();
- if (favicon.image_data->size() > 0) {
+ scoped_refptr<base::RefCountedMemory> bitmap_data(
+ favicon_data.first_bitmap());
+ if (bitmap_data->size() > 0) {
DVLOG(1) << "Storing session favicon for "
<< tab_link->url() << " with size "
- << favicon.image_data->size() << " bytes.";
- tab->set_favicon(favicon.image_data->front(),
- favicon.image_data->size());
+ << bitmap_data->size() << " bytes.";
+ tab->set_favicon(bitmap_data->front(),
+ bitmap_data->size());
tab->set_favicon_type(sync_pb::SessionTab::TYPE_WEB_FAVICON);
- tab->set_favicon_source(favicon.icon_url.spec());
+ tab->set_favicon_source(favicon_data.icon_url.spec());
} else {
LOG(WARNING) << "Null favicon stored for url " << tab_link->url().spec();
}

Powered by Google App Engine
This is Rietveld 408576698