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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2836103003: Revert of Move most of FrameLoader::CheckCompleted() to Document (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 396
397 void DocumentLoader::LoadFailed(const ResourceError& error) { 397 void DocumentLoader::LoadFailed(const ResourceError& error) {
398 if (!error.IsCancellation() && frame_->Owner()) { 398 if (!error.IsCancellation() && frame_->Owner()) {
399 // FIXME: For now, fallback content doesn't work cross process. 399 // FIXME: For now, fallback content doesn't work cross process.
400 if (frame_->Owner()->IsLocal()) 400 if (frame_->Owner()->IsLocal())
401 frame_->DeprecatedLocalOwner()->RenderFallbackContent(); 401 frame_->DeprecatedLocalOwner()->RenderFallbackContent();
402 } 402 }
403 403
404 HistoryCommitType history_commit_type = LoadTypeToCommitType(load_type_); 404 HistoryCommitType history_commit_type = LoadTypeToCommitType(load_type_);
405 switch (state_) { 405 FrameLoader& loader = GetFrameLoader();
406 case kNotStarted: 406 if (state_ < kCommitted) {
407 if (state_ == kNotStarted)
407 probe::frameClearedScheduledClientNavigation(frame_); 408 probe::frameClearedScheduledClientNavigation(frame_);
408 // Fall-through 409 state_ = kSentDidFinishLoad;
409 case kProvisional: 410 GetLocalFrameClient().DispatchDidFailProvisionalLoad(error,
410 state_ = kSentDidFinishLoad; 411 history_commit_type);
411 GetLocalFrameClient().DispatchDidFailProvisionalLoad(error, 412 if (!frame_)
412 history_commit_type); 413 return;
413 if (frame_) 414 loader.DetachProvisionalDocumentLoader(this);
414 GetFrameLoader().DetachProvisionalDocumentLoader(this); 415 } else if (state_ == kCommitted) {
415 break; 416 if (frame_->GetDocument()->Parser())
416 case kCommitted: 417 frame_->GetDocument()->Parser()->StopParsing();
417 if (frame_->GetDocument()->Parser()) 418 state_ = kSentDidFinishLoad;
418 frame_->GetDocument()->Parser()->StopParsing(); 419 GetLocalFrameClient().DispatchDidFailLoad(error, history_commit_type);
419 state_ = kSentDidFinishLoad;
420 GetLocalFrameClient().DispatchDidFailLoad(error, history_commit_type);
421 if (frame_)
422 frame_->GetDocument()->CheckCompleted();
423 break;
424 case kSentDidFinishLoad:
425 // TODO(japhet): Why do we need to call DidFinishNavigation() again?
426 GetFrameLoader().DidFinishNavigation();
427 break;
428 } 420 }
429 DCHECK_EQ(kSentDidFinishLoad, state_); 421 loader.CheckCompleted();
430 } 422 }
431 423
432 void DocumentLoader::FinishedLoading(double finish_time) { 424 void DocumentLoader::FinishedLoading(double finish_time) {
433 DCHECK(frame_->Loader().StateMachine()->CreatingInitialEmptyDocument() || 425 DCHECK(frame_->Loader().StateMachine()->CreatingInitialEmptyDocument() ||
434 !frame_->GetPage()->Suspended() || 426 !frame_->GetPage()->Suspended() ||
435 MainThreadDebugger::Instance()->IsPaused()); 427 MainThreadDebugger::Instance()->IsPaused());
436 428
437 double response_end_time = finish_time; 429 double response_end_time = finish_time;
438 if (!response_end_time) 430 if (!response_end_time)
439 response_end_time = time_of_last_data_received_; 431 response_end_time = time_of_last_data_received_;
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 InstallNewDocumentReason::kJavascriptURL, 1086 InstallNewDocumentReason::kJavascriptURL,
1095 kForceSynchronousParsing, KURL()); 1087 kForceSynchronousParsing, KURL());
1096 if (!source.IsNull()) 1088 if (!source.IsNull())
1097 writer_->AppendReplacingData(source); 1089 writer_->AppendReplacingData(source);
1098 EndWriting(); 1090 EndWriting();
1099 } 1091 }
1100 1092
1101 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 1093 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
1102 1094
1103 } // namespace blink 1095 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698