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

Unified Diff: chrome/browser/media_galleries/fileapi/supported_image_type_validator.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/media_galleries/fileapi/supported_image_type_validator.cc
diff --git a/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc b/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc
index 460a563b7a2767745814dd00bfccd857ee954f25..ac590cd73d7fd7946ff41515855bdf1c882e7596 100644
--- a/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc
+++ b/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc
@@ -47,12 +47,15 @@ scoped_ptr<std::string> ReadOnFileThread(const base::FilePath& path) {
return result.Pass();
}
-class ImageDecoderDelegateAdapter : public ImageDecoder::Delegate {
+class ImageDecoderDelegateAdapter : public ImageDecoder::ImageRequest {
public:
ImageDecoderDelegateAdapter(
scoped_ptr<std::string> data,
const storage::CopyOrMoveFileValidator::ResultCallback& callback)
- : data_(data.Pass()), callback_(callback) {
+ : ImageRequest(content::BrowserThread::GetMessageLoopProxyForThread(
+ BrowserThread::IO)),
+ data_(data.Pass()),
+ callback_(callback) {
DCHECK(data_);
}
@@ -60,14 +63,13 @@ class ImageDecoderDelegateAdapter : public ImageDecoder::Delegate {
return *data_;
}
- // ImageDecoder::Delegate methods.
- void OnImageDecoded(const ImageDecoder* /*decoder*/,
- const SkBitmap& /*decoded_image*/) override {
+ // ImageDecoder::ImageRequest methods.
+ void OnImageDecoded(const SkBitmap& /*decoded_image*/) override {
callback_.Run(base::File::FILE_OK);
delete this;
}
- void OnDecodeImageFailed(const ImageDecoder* /*decoder*/) override {
+ void OnDecodeImageFailed() override {
callback_.Run(base::File::FILE_ERROR_SECURITY);
delete this;
}
@@ -127,8 +129,5 @@ void SupportedImageTypeValidator::OnFileOpen(scoped_ptr<std::string> data) {
// |adapter| will delete itself after a completion message is received.
ImageDecoderDelegateAdapter* adapter =
new ImageDecoderDelegateAdapter(data.Pass(), callback_);
- decoder_ = new ImageDecoder(adapter, adapter->data(),
- ImageDecoder::DEFAULT_CODEC);
- decoder_->Start(content::BrowserThread::GetMessageLoopProxyForThread(
- BrowserThread::IO));
+ ImageDecoder::Start(adapter, adapter->data());
}
« no previous file with comments | « chrome/browser/media_galleries/fileapi/supported_image_type_validator.h ('k') | chrome/browser/profiles/profile_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698