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

Unified Diff: ios/chrome/browser/reading_list/reading_list_web_state_observer.mm

Issue 2572583003: Check three times for the loading of the page. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_web_state_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/reading_list/reading_list_web_state_observer.mm
diff --git a/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm b/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm
index c2dc319b6ade3c951ac61a2b4487d775073dc099..b4aa9c0983e0990ab5f7f49a9064cd8bef3b5f2b 100644
--- a/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm
+++ b/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm
@@ -104,6 +104,7 @@ void ReadingListWebStateObserver::WebStateDestroyed() {
void ReadingListWebStateObserver::StartCheckingProgress(
const GURL& pending_url) {
pending_url_ = pending_url;
+ try_number_ = 0;
timer_.reset(new base::Timer(false, true));
const base::TimeDelta kDelayUntilLoadingProgressIsChecked =
base::TimeDelta::FromSeconds(1);
@@ -128,10 +129,15 @@ void ReadingListWebStateObserver::VerifyIfReadingListEntryStartedLoading() {
if (!entry || entry->DistilledState() != ReadingListEntry::PROCESSED) {
return;
}
+ try_number_++;
double progress = web_state()->GetLoadingProgress();
- const double kMinimumExpectedProgress = 0.15;
- if (progress < kMinimumExpectedProgress) {
+ const double kMinimumExpectedProgressPerStep = 0.25;
+ if (progress < try_number_ * kMinimumExpectedProgressPerStep) {
reading_list::LoadReadingListDistilled(*entry, reading_list_model_,
web_state());
}
+ if (try_number_ >= 3) {
+ // Loading reached 75%, let the page finish normal loading.
+ timer_->Stop();
+ }
}
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_web_state_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698