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

Unified Diff: chrome/browser/bitmap_fetcher/bitmap_fetcher.cc

Issue 931993002: Make image_decoder a Leaky LazyInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small changes based on review from Antony Created 5 years, 9 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/bitmap_fetcher/bitmap_fetcher.cc
diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher.cc b/chrome/browser/bitmap_fetcher/bitmap_fetcher.cc
index ae8ab659f47e23c8dbdbb67db33933429a2e5948..31292c82e5a2e7ebe455ccffce90d66b85984cac 100644
--- a/chrome/browser/bitmap_fetcher/bitmap_fetcher.cc
+++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher.cc
@@ -45,15 +45,14 @@ void BitmapFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
std::string image_data;
source->GetResponseAsString(&image_data);
- image_decoder_ =
- new ImageDecoder(this, image_data, ImageDecoder::DEFAULT_CODEC);
// Call start to begin decoding. The ImageDecoder will call OnImageDecoded
// with the data when it is done.
- scoped_refptr<base::MessageLoopProxy> task_runner =
+ ImageDecoder::GetInstance()->Start(
+ this, image_data, ImageDecoder::DEFAULT_CODEC,
content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::UI);
- image_decoder_->Start(task_runner);
+ content::BrowserThread::UI),
+ false);
}
void BitmapFetcher::OnURLFetchDownloadProgress(const net::URLFetcher* source,
@@ -64,13 +63,12 @@ void BitmapFetcher::OnURLFetchDownloadProgress(const net::URLFetcher* source,
// Methods inherited from ImageDecoder::Delegate.
-void BitmapFetcher::OnImageDecoded(const ImageDecoder* decoder,
- const SkBitmap& decoded_image) {
+void BitmapFetcher::OnImageDecoded(const SkBitmap& decoded_image) {
// Report success.
delegate_->OnFetchComplete(url_, &decoded_image);
}
-void BitmapFetcher::OnDecodeImageFailed(const ImageDecoder* decoder) {
+void BitmapFetcher::OnDecodeImageFailed() {
ReportFailure();
}

Powered by Google App Engine
This is Rietveld 408576698