Chromium Code Reviews| Index: ios/chrome/browser/reading_list/reading_list_entry.cc |
| diff --git a/ios/chrome/browser/reading_list/reading_list_entry.cc b/ios/chrome/browser/reading_list/reading_list_entry.cc |
| index 62fa14300bc4f9b724d7bb7152295b44d6878eb9..3370663afc2f24ac9baacdc3c02e443d7bf52491 100644 |
| --- a/ios/chrome/browser/reading_list/reading_list_entry.cc |
| +++ b/ios/chrome/browser/reading_list/reading_list_entry.cc |
| @@ -5,7 +5,10 @@ |
| #include "ios/chrome/browser/reading_list/reading_list_entry.h" |
| ReadingListEntry::ReadingListEntry(const GURL& url, const std::string& title) |
| - : url_(url), title_(title), distilled_state_(WAITING) { |
| + : url_(url), |
| + title_(title), |
| + distilled_state_(WAITING), |
| + failed_distillation_counter_(0) { |
| DCHECK(!url.is_empty()); |
| DCHECK(url.is_valid()); |
| } |
| @@ -13,7 +16,8 @@ ReadingListEntry::ReadingListEntry(const ReadingListEntry& entry) |
| : url_(entry.URL()), |
| title_(entry.Title()), |
| distilled_url_(entry.DistilledURL()), |
| - distilled_state_(entry.DistilledState()) {} |
| + distilled_state_(entry.DistilledState()), |
| + failed_distillation_counter_(entry.FailedDistillationCounter()) {} |
| ReadingListEntry::~ReadingListEntry() {} |
| const GURL& ReadingListEntry::URL() const { |
| @@ -32,11 +36,16 @@ const GURL& ReadingListEntry::DistilledURL() const { |
| return distilled_url_; |
| } |
| +int ReadingListEntry::FailedDistillationCounter() const { |
| + return failed_distillation_counter_; |
| +} |
| + |
| ReadingListEntry& ReadingListEntry::operator=(const ReadingListEntry& other) { |
| url_ = other.url_; |
| title_ = other.title_; |
| distilled_url_ = other.distilled_url_; |
| distilled_state_ = other.distilled_state_; |
| + failed_distillation_counter_ = other.failed_distillation_counter_; |
| return *this; |
| } |
| @@ -52,11 +61,15 @@ void ReadingListEntry::SetDistilledURL(const GURL& url) { |
| DCHECK(url.is_valid()); |
| distilled_url_ = url; |
| distilled_state_ = PROCESSED; |
| + failed_distillation_counter_ = 0; |
| } |
| void ReadingListEntry::SetDistilledState(DistillationState distilled_state) { |
| DCHECK(distilled_state != PROCESSED); // use SetDistilledURL instead. |
| DCHECK(distilled_state != WAITING); |
| + if ((distilled_state == WILL_RETRY || distilled_state == ERROR) && |
| + distilled_state_ != WILL_RETRY && distilled_state_ != ERROR) |
|
noyau (Ping after 24h)
2016/09/16 14:25:13
This condition is quite hard to read. Can you add
gambard
2016/09/19 09:08:09
Done.
|
| + failed_distillation_counter_++; |
| distilled_state_ = distilled_state; |
| distilled_url_ = GURL(); |
| } |