Chromium Code Reviews| Index: ios/chrome/browser/suggestions/ios_image_decoder_impl.h |
| diff --git a/ios/chrome/browser/suggestions/ios_image_decoder_impl.h b/ios/chrome/browser/suggestions/ios_image_decoder_impl.h |
| index 32b31ed7ad1e74fc2f01de4a94459616df48e42e..5cfa166c46e3de3508d19ae846b1eca42d96e22f 100644 |
| --- a/ios/chrome/browser/suggestions/ios_image_decoder_impl.h |
| +++ b/ios/chrome/browser/suggestions/ios_image_decoder_impl.h |
| @@ -5,14 +5,24 @@ |
| #ifndef IOS_CHROME_BROWSER_SUGGESTIONS_IOS_IMAGE_DECODER_IMPL_H_ |
| #define IOS_CHROME_BROWSER_SUGGESTIONS_IOS_IMAGE_DECODER_IMPL_H_ |
| +#include "base/mac/scoped_nsobject.h" |
| #include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "components/image_fetcher/image_decoder.h" |
| +@class NSData; |
| + |
| +namespace base { |
| +class TaskRunner; |
| +} |
| + |
| namespace suggestions { |
| class IOSImageDecoderImpl : public image_fetcher::ImageDecoder { |
| public: |
| - IOSImageDecoderImpl(); |
| + explicit IOSImageDecoderImpl( |
| + const scoped_refptr<base::TaskRunner>& task_runner); |
| ~IOSImageDecoderImpl() override; |
| void DecodeImage( |
| @@ -20,6 +30,17 @@ class IOSImageDecoderImpl : public image_fetcher::ImageDecoder { |
| const image_fetcher::ImageDecodedCallback& callback) override; |
| private: |
| + void CreateUIImageAndRunCallback( |
| + const image_fetcher::ImageDecodedCallback& callback, |
| + base::scoped_nsobject<NSData> data); |
|
noyau (Ping after 24h)
2016/09/09 10:18:04
This private use scoped_nsobject has the unfortuna
vitaliii
2016/09/09 13:03:41
No, I have not, but that is a great idea (though q
|
| + |
| + // The task runner used to decode images if necessary. |
| + const scoped_refptr<base::TaskRunner> task_runner_; |
| + |
| + // The WeakPtrFactory is used to cancel callbacks if ImageFetcher is destroyed |
| + // during WebP decoding. |
| + base::WeakPtrFactory<IOSImageDecoderImpl> weak_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(IOSImageDecoderImpl); |
| }; |