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

Unified Diff: ios/chrome/browser/reading_list/reading_list_download_service.cc

Issue 2378123002: Load offline page if reading list entry takes more than 1s to load. (Closed)
Patch Set: Experimental change (reviewers: do not review this PS). Created 4 years, 2 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/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);
}
}

Powered by Google App Engine
This is Rietveld 408576698