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

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: Fix a few comments 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..e413fa1a8e35de6643623c4434156ea5de9f9941 100644
--- a/chrome/browser/bitmap_fetcher/bitmap_fetcher.cc
+++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher.cc
@@ -12,7 +12,10 @@
namespace chrome {
BitmapFetcher::BitmapFetcher(const GURL& url, BitmapFetcherDelegate* delegate)
- : url_(url), delegate_(delegate) {
+ : ImageRequest(content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::UI)),
+ url_(url),
+ delegate_(delegate) {
}
BitmapFetcher::~BitmapFetcher() {
@@ -45,15 +48,10 @@ 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 =
- content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::UI);
- image_decoder_->Start(task_runner);
+ ImageDecoder::Start(this, image_data);
}
void BitmapFetcher::OnURLFetchDownloadProgress(const net::URLFetcher* source,
@@ -62,15 +60,14 @@ void BitmapFetcher::OnURLFetchDownloadProgress(const net::URLFetcher* source,
// Do nothing here.
}
-// Methods inherited from ImageDecoder::Delegate.
+// Methods inherited from ImageDecoder::ImageRequest.
-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();
}
« no previous file with comments | « chrome/browser/bitmap_fetcher/bitmap_fetcher.h ('k') | chrome/browser/bitmap_fetcher/bitmap_fetcher_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698