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

Unified Diff: chrome/browser/android/offline_pages/prerendering_loader.cc

Issue 2405863003: [Offline Pages] Fix PrerenderingLoader regression for handle a stop event from the prerender stack. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/prerendering_loader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/prerendering_loader.cc
diff --git a/chrome/browser/android/offline_pages/prerendering_loader.cc b/chrome/browser/android/offline_pages/prerendering_loader.cc
index 4e614eae249e006de213b16b82c27222076776ca..a3607b7938b1da9fe22c6b9a9a883af083ba24cc 100644
--- a/chrome/browser/android/offline_pages/prerendering_loader.cc
+++ b/chrome/browser/android/offline_pages/prerendering_loader.cc
@@ -184,26 +184,30 @@ void PrerenderingLoader::HandleLoadingStopped() {
Offliner::RequestStatus request_status;
- if (IsLoaded()) {
- // If page already loaded, then prerender is telling us that it is
- // canceling (and we should stop using the loaded WebContents).
- request_status = Offliner::RequestStatus::PRERENDERING_CANCELED;
- } else if (adapter_->IsActive()) {
- // Get the available FinalStatus to better identify the outcome.
- prerender::FinalStatus final_status = adapter_->GetFinalStatus();
- DVLOG(1) << "Load failed: " << final_status;
- request_status = ClassifyFinalStatus(final_status);
-
- // Loss of network connection can show up as unsupported scheme per
- // a redirect to a special data URL is used to navigate to error page.
- // Capture the current connectivity here in case we can leverage that
- // to differentiate how to treat it.
- if (final_status == prerender::FINAL_STATUS_UNSUPPORTED_SCHEME) {
- UMA_HISTOGRAM_ENUMERATION(
- "OfflinePages.Background.UnsupportedScheme.ConnectionType",
- net::NetworkChangeNotifier::GetConnectionType(),
- net::NetworkChangeNotifier::ConnectionType::CONNECTION_LAST + 1);
+ if (adapter_->IsActive()) {
+ if (IsLoaded()) {
+ // If page already loaded, then prerender is telling us that it is
+ // canceling (and we should stop using the loaded WebContents).
+ request_status = Offliner::RequestStatus::PRERENDERING_CANCELED;
+ } else {
+ // Otherwise, get the available FinalStatus to classify the outcome.
+ prerender::FinalStatus final_status = adapter_->GetFinalStatus();
+ DVLOG(1) << "Load failed: " << final_status;
+ request_status = ClassifyFinalStatus(final_status);
+
+ // Loss of network connection can show up as unsupported scheme per
+ // a redirect to a special data URL is used to navigate to error page.
+ // Capture the current connectivity here in case we can leverage that
+ // to differentiate how to treat it.
+ if (final_status == prerender::FINAL_STATUS_UNSUPPORTED_SCHEME) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "OfflinePages.Background.UnsupportedScheme.ConnectionType",
+ net::NetworkChangeNotifier::GetConnectionType(),
+ net::NetworkChangeNotifier::ConnectionType::CONNECTION_LAST + 1);
+ }
}
+
+ // Now clean up the active prerendering operation detail.
adapter_->DestroyActive();
} else {
// No access to FinalStatus so classify as retryable failure.
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/prerendering_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698