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

Side by Side Diff: chrome/browser/sync/glue/favicon_cache.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sync/glue/favicon_cache.h" 5 #include "chrome/browser/sync/glue/favicon_cache.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/favicon/favicon_service.h" 9 #include "chrome/browser/favicon/favicon_service.h"
10 #include "chrome/browser/favicon/favicon_service_factory.h" 10 #include "chrome/browser/favicon/favicon_service_factory.h"
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 page_favicon_map_[page_url] = icon_url; 504 page_favicon_map_[page_url] = icon_url;
505 505
506 // If there is no actual image, it means there either is no synced 506 // If there is no actual image, it means there either is no synced
507 // favicon, or it's on its way (race condition). 507 // favicon, or it's on its way (race condition).
508 // TODO(zea): potentially trigger a favicon web download here (delayed?). 508 // TODO(zea): potentially trigger a favicon web download here (delayed?).
509 if (icon_bytes.size() == 0) 509 if (icon_bytes.size() == 0)
510 return; 510 return;
511 511
512 // Post a task to do the actual association because this method may have been 512 // Post a task to do the actual association because this method may have been
513 // called while in a transaction. 513 // called while in a transaction.
514 MessageLoop::current()->PostTask( 514 base::MessageLoop::current()->PostTask(
515 FROM_HERE, 515 FROM_HERE,
516 base::Bind(&FaviconCache::OnReceivedSyncFaviconImpl, 516 base::Bind(&FaviconCache::OnReceivedSyncFaviconImpl,
517 weak_ptr_factory_.GetWeakPtr(), 517 weak_ptr_factory_.GetWeakPtr(),
518 icon_url, 518 icon_url,
519 icon_bytes, 519 icon_bytes,
520 visit_time_ms)); 520 visit_time_ms));
521 } 521 }
522 522
523 void FaviconCache::OnReceivedSyncFaviconImpl( 523 void FaviconCache::OnReceivedSyncFaviconImpl(
524 const GURL& icon_url, 524 const GURL& icon_url,
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 989
990 size_t FaviconCache::NumFaviconsForTest() const { 990 size_t FaviconCache::NumFaviconsForTest() const {
991 return synced_favicons_.size(); 991 return synced_favicons_.size();
992 } 992 }
993 993
994 size_t FaviconCache::NumTasksForTest() const { 994 size_t FaviconCache::NumTasksForTest() const {
995 return page_task_map_.size(); 995 return page_task_map_.size();
996 } 996 }
997 997
998 } // namespace browser_sync 998 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698