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

Unified Diff: chrome/browser/android/provider/chrome_browser_provider.cc

Issue 745463002: Revert of Revert of ChromeBrowserProvider shouldn't own the FaviconService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/android/provider/chrome_browser_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/provider/chrome_browser_provider.cc
diff --git a/chrome/browser/android/provider/chrome_browser_provider.cc b/chrome/browser/android/provider/chrome_browser_provider.cc
index 6031f00267536badbf9e5fc0241debafa7b58e02..1db116610cc6996a40da880c31ba051aa2966d10 100644
--- a/chrome/browser/android/provider/chrome_browser_provider.cc
+++ b/chrome/browser/android/provider/chrome_browser_provider.cc
@@ -649,10 +649,12 @@
// Base class for all asynchronous blocking tasks that use the favicon service.
class FaviconServiceTask : public AsyncServiceRequest<FaviconService> {
public:
- FaviconServiceTask(FaviconService* service,
- base::CancelableTaskTracker* cancelable_tracker,
+ FaviconServiceTask(base::CancelableTaskTracker* cancelable_tracker,
Profile* profile)
- : AsyncServiceRequest<FaviconService>(service, cancelable_tracker),
+ : AsyncServiceRequest<FaviconService>(
+ FaviconServiceFactory::GetForProfile(profile,
+ Profile::EXPLICIT_ACCESS),
+ cancelable_tracker),
profile_(profile) {}
Profile* profile() const { return profile_; }
@@ -666,15 +668,18 @@
// Retrieves the favicon or touch icon for a URL from the FaviconService.
class BookmarkIconFetchTask : public FaviconServiceTask {
public:
- BookmarkIconFetchTask(FaviconService* favicon_service,
- base::CancelableTaskTracker* cancelable_tracker,
+ BookmarkIconFetchTask(base::CancelableTaskTracker* cancelable_tracker,
Profile* profile)
- : FaviconServiceTask(favicon_service, cancelable_tracker, profile) {}
+ : FaviconServiceTask(cancelable_tracker, profile) {}
favicon_base::FaviconRawBitmapResult Run(const GURL& url) {
float max_scale = ui::GetScaleForScaleFactor(
ResourceBundle::GetSharedInstance().GetMaxScaleFactor());
int desired_size_in_pixel = std::ceil(gfx::kFaviconSize * max_scale);
+
+ if (service() == NULL)
+ return favicon_base::FaviconRawBitmapResult();
+
RunAsyncRequestOnUIThreadBlocking(
base::Bind(&FaviconService::GetRawFaviconForPageURL,
base::Unretained(service()),
@@ -1160,8 +1165,6 @@
bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_);
top_sites_ = profile_->GetTopSites();
service_.reset(new AndroidHistoryProviderService(profile_));
- favicon_service_.reset(FaviconServiceFactory::GetForProfile(profile_,
- Profile::EXPLICIT_ACCESS));
// Registers the notifications we are interested.
bookmark_model_->AddObserver(this);
@@ -1548,8 +1551,7 @@
return ScopedJavaLocalRef<jbyteArray>();
GURL url = GURL(ConvertJavaStringToUTF16(env, jurl));
- BookmarkIconFetchTask favicon_task(
- favicon_service_.get(), &cancelable_task_tracker_, profile_);
+ BookmarkIconFetchTask favicon_task(&cancelable_task_tracker_, profile_);
favicon_base::FaviconRawBitmapResult bitmap_result = favicon_task.Run(url);
if (!bitmap_result.is_valid() || !bitmap_result.bitmap_data.get())
« no previous file with comments | « chrome/browser/android/provider/chrome_browser_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698