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 c3bd2d67533fd7a859b45179a581d576cdd78e3d..a62de40182c8bfe7eb3e2e40a937cd158f0f7e72 100644 |
--- a/chrome/browser/android/provider/chrome_browser_provider.cc |
+++ b/chrome/browser/android/provider/chrome_browser_provider.cc |
@@ -650,10 +650,12 @@ class AsyncServiceRequest : protected BlockingUIThreadAsyncRequest { |
// 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_; } |
@@ -667,15 +669,18 @@ class FaviconServiceTask : public AsyncServiceRequest<FaviconService> { |
// 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()), |
@@ -1162,8 +1167,6 @@ ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj) |
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); |
@@ -1550,8 +1553,7 @@ ScopedJavaLocalRef<jbyteArray> ChromeBrowserProvider::GetFaviconOrTouchIcon( |
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()) |