 Chromium Code Reviews
 Chromium Code Reviews Issue 2378123002:
  Load offline page if reading list entry takes more than 1s to load.  (Closed)
    
  
    Issue 2378123002:
  Load offline page if reading list entry takes more than 1s to load.  (Closed) 
  | Index: ios/chrome/browser/reading_list/reading_list_download_service.cc | 
| diff --git a/ios/chrome/browser/reading_list/reading_list_download_service.cc b/ios/chrome/browser/reading_list/reading_list_download_service.cc | 
| index c6a2a0bb8ecd6188e6f3bc84c3991ae6cc354ad4..d686472f5dbf3cc0166e494ad3c51121067c7e41 100644 | 
| --- a/ios/chrome/browser/reading_list/reading_list_download_service.cc | 
| +++ b/ios/chrome/browser/reading_list/reading_list_download_service.cc | 
| @@ -62,14 +62,18 @@ void ReadingListDownloadService::ReadingListWillRemoveReadEntry( | 
| const ReadingListModel* model, | 
| size_t index) { | 
| DCHECK_EQ(reading_list_model_, model); | 
| - RemoveDownloadedEntry(model->GetReadEntryAtIndex(index)); | 
| + const ReadingListEntry* entry = model->GetReadEntryAtIndex(index); | 
| + if (entry) | 
| + RemoveDownloadedEntry(*entry); | 
| } | 
| void ReadingListDownloadService::ReadingListWillRemoveUnreadEntry( | 
| const ReadingListModel* model, | 
| size_t index) { | 
| DCHECK_EQ(reading_list_model_, model); | 
| - RemoveDownloadedEntry(model->GetUnreadEntryAtIndex(index)); | 
| + const ReadingListEntry* entry = model->GetUnreadEntryAtIndex(index); | 
| + if (entry) | 
| + RemoveDownloadedEntry(*entry); | 
| } | 
| void ReadingListDownloadService::ReadingListWillAddUnreadEntry( | 
| @@ -90,14 +94,16 @@ void ReadingListDownloadService::DownloadAllEntries() { | 
| DCHECK(reading_list_model_->loaded()); | 
| size_t size = reading_list_model_->unread_size(); | 
| for (size_t i = 0; i < size; i++) { | 
| - const ReadingListEntry& entry = | 
| + const ReadingListEntry* entry = | 
| reading_list_model_->GetUnreadEntryAtIndex(i); | 
| - this->ScheduleDownloadEntry(entry); | 
| + if (entry) | 
| 
sdefresne
2016/10/04 13:26:46
Can this be null? It look like it iterate over all
 | 
| + this->ScheduleDownloadEntry(*entry); | 
| } | 
| size = reading_list_model_->read_size(); | 
| for (size_t i = 0; i < size; i++) { | 
| - const ReadingListEntry& entry = reading_list_model_->GetReadEntryAtIndex(i); | 
| - this->ScheduleDownloadEntry(entry); | 
| + const ReadingListEntry* entry = reading_list_model_->GetReadEntryAtIndex(i); | 
| + if (entry) | 
| 
sdefresne
2016/10/04 13:26:46
ditto
 | 
| + this->ScheduleDownloadEntry(*entry); | 
| } | 
| } |