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

Unified Diff: ios/chrome/browser/suggestions/ios_image_decoder_impl.h

Issue 2324793002: Support WebP images in the IOSImageDecoderImpl (Closed)
Patch Set: Created 4 years, 3 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: 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);
};

Powered by Google App Engine
This is Rietveld 408576698