Chromium Code Reviews| Index: ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm |
| diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm |
| index 4749f4f7104e4e5a6e9e991f3c909bb4064cd77b..af48a7c8edf1c1759f3fc80ed511fda565b2d4d2 100644 |
| --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm |
| +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm |
| @@ -20,6 +20,10 @@ const CGFloat kStandardSpacing = 8; |
| @property(nonatomic, copy) NSString* subtitle; |
| @property(nonatomic, weak) id<ContentSuggestionsArticleItemDelegate> delegate; |
| +// Used to check if the image has already been fetched. There is no way to |
| +// discriminate between failed image download and nonexitent image. The article |
| +// tries to download the image only once. |
| +@property(nonatomic, assign) BOOL imageFetched; |
| @end |
| @@ -35,7 +39,7 @@ const CGFloat kStandardSpacing = 8; |
| @synthesize publishDate = _publishDate; |
| @synthesize suggestionIdentifier = _suggestionIdentifier; |
| @synthesize delegate = _delegate; |
| -@synthesize imageBeingFetched = _imageBeingFetched; |
| +@synthesize imageFetched = _imageFetched; |
| - (instancetype)initWithType:(NSInteger)type |
| title:(NSString*)title |
| @@ -55,7 +59,8 @@ const CGFloat kStandardSpacing = 8; |
| - (void)configureCell:(ContentSuggestionsArticleCell*)cell { |
| [super configureCell:cell]; |
| - if (!self.image && !self.imageBeingFetched) { |
| + if (!self.image && !self.imageFetched) { |
| + self.imageFetched = YES; |
| [self.delegate loadImageForArticleItem:self]; |
|
Olivier
2017/03/01 08:33:56
This looks async. Is it OK to use _image just afte
gambard
2017/03/01 08:37:12
It is indeed async. This is only called if the ima
Olivier
2017/03/01 12:42:08
I think it would be worth add a comment for this b
gambard
2017/03/01 12:55:49
Done.
|
| } |
| cell.titleLabel.text = _title; |