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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2809733003: Move most of FrameLoader::CheckCompleted() to Document (Closed)
Patch Set: Fix failing android test Created 3 years, 8 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: third_party/WebKit/Source/core/loader/DocumentLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
index e3a8c51eae71d0c0d750835cbf63215175798993..1f4d1f494e8326fe82901d9c4fc13026dff0bd7a 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -402,23 +402,31 @@ void DocumentLoader::LoadFailed(const ResourceError& error) {
}
HistoryCommitType history_commit_type = LoadTypeToCommitType(load_type_);
- FrameLoader& loader = GetFrameLoader();
- if (state_ < kCommitted) {
- if (state_ == kNotStarted)
+ switch (state_) {
+ case kNotStarted:
probe::frameClearedScheduledClientNavigation(frame_);
- state_ = kSentDidFinishLoad;
- GetLocalFrameClient().DispatchDidFailProvisionalLoad(error,
- history_commit_type);
- if (!frame_)
- return;
- loader.DetachProvisionalDocumentLoader(this);
- } else if (state_ == kCommitted) {
- if (frame_->GetDocument()->Parser())
- frame_->GetDocument()->Parser()->StopParsing();
- state_ = kSentDidFinishLoad;
- GetLocalFrameClient().DispatchDidFailLoad(error, history_commit_type);
+ // Fall-through
+ case kProvisional:
+ state_ = kSentDidFinishLoad;
+ GetLocalFrameClient().DispatchDidFailProvisionalLoad(error,
+ history_commit_type);
+ if (frame_)
+ GetFrameLoader().DetachProvisionalDocumentLoader(this);
+ break;
+ case kCommitted:
+ if (frame_->GetDocument()->Parser())
+ frame_->GetDocument()->Parser()->StopParsing();
+ state_ = kSentDidFinishLoad;
+ GetLocalFrameClient().DispatchDidFailLoad(error, history_commit_type);
+ if (frame_)
+ frame_->GetDocument()->CheckCompleted();
+ break;
+ case kSentDidFinishLoad:
+ // TODO(japhet): Why do we need to call DidFinishNavigation() again?
+ GetFrameLoader().DidFinishNavigation();
+ break;
}
- loader.CheckCompleted();
+ DCHECK_EQ(kSentDidFinishLoad, state_);
}
void DocumentLoader::FinishedLoading(double finish_time) {

Powered by Google App Engine
This is Rietveld 408576698