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

Side by Side Diff: Source/core/loader/FrameLoader.cpp

Issue 215533004: Revert of Make start/stop loading notifications per-frame (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool isBackForwardLoadType(FrameLoadType type) 98 bool isBackForwardLoadType(FrameLoadType type)
99 { 99 {
100 return type == FrameLoadTypeBackForward; 100 return type == FrameLoadTypeBackForward;
101 } 101 }
102 102
103 static bool needsHistoryItemRestore(FrameLoadType type) 103 static bool needsHistoryItemRestore(FrameLoadType type)
104 { 104 {
105 return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload || ty pe == FrameLoadTypeReloadFromOrigin; 105 return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload || ty pe == FrameLoadTypeReloadFromOrigin;
106 } 106 }
107 107
108 class FrameLoader::FrameProgressTracker {
109 public:
110 static PassOwnPtr<FrameProgressTracker> create(LocalFrame* frame) { return a doptPtr(new FrameProgressTracker(frame)); }
111 ~FrameProgressTracker()
112 {
113 ASSERT(!m_inProgress || m_frame->page());
114 if (m_inProgress)
115 m_frame->page()->progress().progressCompleted(m_frame);
116 }
117
118 void progressStarted()
119 {
120 ASSERT(m_frame->page());
121 if (!m_inProgress)
122 m_frame->page()->progress().progressStarted(m_frame);
123 m_inProgress = true;
124 }
125
126 void progressCompleted()
127 {
128 ASSERT(m_inProgress);
129 ASSERT(m_frame->page());
130 m_inProgress = false;
131 m_frame->page()->progress().progressCompleted(m_frame);
132 }
133
134 private:
135 FrameProgressTracker(LocalFrame* frame)
136 : m_frame(frame)
137 , m_inProgress(false)
138 {
139 }
140
141 LocalFrame* m_frame;
142 bool m_inProgress;
143 };
144
108 FrameLoader::FrameLoader(LocalFrame* frame, FrameLoaderClient* client) 145 FrameLoader::FrameLoader(LocalFrame* frame, FrameLoaderClient* client)
109 : m_frame(frame) 146 : m_frame(frame)
110 , m_client(client) 147 , m_client(client)
111 , m_mixedContentChecker(frame) 148 , m_mixedContentChecker(frame)
112 , m_progressTracker(ProgressTracker::create(frame)) 149 , m_progressTracker(FrameProgressTracker::create(m_frame))
113 , m_state(FrameStateProvisional) 150 , m_state(FrameStateProvisional)
114 , m_loadType(FrameLoadTypeStandard) 151 , m_loadType(FrameLoadTypeStandard)
115 , m_fetchContext(FrameFetchContext::create(frame)) 152 , m_fetchContext(FrameFetchContext::create(frame))
116 , m_inStopAllLoaders(false) 153 , m_inStopAllLoaders(false)
117 , m_isComplete(false) 154 , m_isComplete(false)
118 , m_checkTimer(this, &FrameLoader::checkTimerFired) 155 , m_checkTimer(this, &FrameLoader::checkTimerFired)
119 , m_shouldCallCheckCompleted(false) 156 , m_shouldCallCheckCompleted(false)
120 , m_didAccessInitialDocument(false) 157 , m_didAccessInitialDocument(false)
121 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired) 158 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired)
122 , m_forcedSandboxFlags(SandboxNone) 159 , m_forcedSandboxFlags(SandboxNone)
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume ntNavigationSource sameDocumentNavigationSource, PassRefPtr<SerializedScriptValu e> data, UpdateBackForwardListPolicy updateBackForwardList) 566 void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume ntNavigationSource sameDocumentNavigationSource, PassRefPtr<SerializedScriptValu e> data, UpdateBackForwardListPolicy updateBackForwardList)
530 { 567 {
531 // Update the data source's request with the new URL to fake the URL change 568 // Update the data source's request with the new URL to fake the URL change
532 m_frame->document()->setURL(newURL); 569 m_frame->document()->setURL(newURL);
533 documentLoader()->updateForSameDocumentNavigation(newURL); 570 documentLoader()->updateForSameDocumentNavigation(newURL);
534 571
535 // Generate start and stop notifications only when loader is completed so th at we 572 // Generate start and stop notifications only when loader is completed so th at we
536 // don't fire them for fragment redirection that happens in window.onload ha ndler. 573 // don't fire them for fragment redirection that happens in window.onload ha ndler.
537 // See https://bugs.webkit.org/show_bug.cgi?id=31838 574 // See https://bugs.webkit.org/show_bug.cgi?id=31838
538 if (m_frame->document()->loadEventFinished()) 575 if (m_frame->document()->loadEventFinished())
539 m_client->didStartLoading(NavigationWithinSameDocument); 576 m_client->postProgressStartedNotification(NavigationWithinSameDocument);
540 577
541 HistoryCommitType historyCommitType = updateBackForwardList == UpdateBackFor wardList && m_currentItem ? StandardCommit : HistoryInertCommit; 578 HistoryCommitType historyCommitType = updateBackForwardList == UpdateBackFor wardList && m_currentItem ? StandardCommit : HistoryInertCommit;
542 setHistoryItemStateForCommit(historyCommitType, sameDocumentNavigationSource == SameDocumentNavigationHistoryApi, data); 579 setHistoryItemStateForCommit(historyCommitType, sameDocumentNavigationSource == SameDocumentNavigationHistoryApi, data);
543 m_client->dispatchDidNavigateWithinPage(m_currentItem.get(), historyCommitTy pe); 580 m_client->dispatchDidNavigateWithinPage(m_currentItem.get(), historyCommitTy pe);
544 m_client->dispatchDidReceiveTitle(m_frame->document()->title()); 581 m_client->dispatchDidReceiveTitle(m_frame->document()->title());
545 if (m_frame->document()->loadEventFinished()) 582 if (m_frame->document()->loadEventFinished())
546 m_client->didStopLoading(); 583 m_client->postProgressFinishedNotification();
547 } 584 }
548 585
549 void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip tValue> stateObject, UpdateBackForwardListPolicy updateBackForwardList, ClientRe directPolicy clientRedirect) 586 void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip tValue> stateObject, UpdateBackForwardListPolicy updateBackForwardList, ClientRe directPolicy clientRedirect)
550 { 587 {
551 // If we have a state object, we cannot also be a new navigation. 588 // If we have a state object, we cannot also be a new navigation.
552 ASSERT(!stateObject || updateBackForwardList == DoNotUpdateBackForwardList); 589 ASSERT(!stateObject || updateBackForwardList == DoNotUpdateBackForwardList);
553 590
554 // If we have a provisional request for a different document, a fragment scr oll should cancel it. 591 // If we have a provisional request for a different document, a fragment scr oll should cancel it.
555 if (m_provisionalDocumentLoader) { 592 if (m_provisionalDocumentLoader) {
556 m_provisionalDocumentLoader->stopLoading(); 593 m_provisionalDocumentLoader->stopLoading();
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 page->mainFrame()->loader().checkLoadCompleteForThisFrame(); 1081 page->mainFrame()->loader().checkLoadCompleteForThisFrame();
1045 } 1082 }
1046 1083
1047 void FrameLoader::checkLoadComplete(DocumentLoader* documentLoader) 1084 void FrameLoader::checkLoadComplete(DocumentLoader* documentLoader)
1048 { 1085 {
1049 if (documentLoader) 1086 if (documentLoader)
1050 documentLoader->checkLoadComplete(); 1087 documentLoader->checkLoadComplete();
1051 checkLoadComplete(); 1088 checkLoadComplete();
1052 } 1089 }
1053 1090
1091 int FrameLoader::numPendingOrLoadingRequests(bool recurse) const
1092 {
1093 if (!recurse)
1094 return m_frame->document()->fetcher()->requestCount();
1095
1096 int count = 0;
1097 for (LocalFrame* frame = m_frame; frame; frame = frame->tree().traverseNext( m_frame))
1098 count += frame->document()->fetcher()->requestCount();
1099 return count;
1100 }
1101
1054 String FrameLoader::userAgent(const KURL& url) const 1102 String FrameLoader::userAgent(const KURL& url) const
1055 { 1103 {
1056 String userAgent = m_client->userAgent(url); 1104 String userAgent = m_client->userAgent(url);
1057 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); 1105 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent);
1058 return userAgent; 1106 return userAgent;
1059 } 1107 }
1060 1108
1061 void FrameLoader::frameDetached() 1109 void FrameLoader::frameDetached()
1062 { 1110 {
1063 // stopAllLoaders can detach the LocalFrame, so protect it. 1111 // stopAllLoaders can detach the LocalFrame, so protect it.
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 { 1473 {
1426 SandboxFlags flags = m_forcedSandboxFlags; 1474 SandboxFlags flags = m_forcedSandboxFlags;
1427 if (LocalFrame* parentFrame = m_frame->tree().parent()) 1475 if (LocalFrame* parentFrame = m_frame->tree().parent())
1428 flags |= parentFrame->document()->sandboxFlags(); 1476 flags |= parentFrame->document()->sandboxFlags();
1429 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) 1477 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement())
1430 flags |= ownerElement->sandboxFlags(); 1478 flags |= ownerElement->sandboxFlags();
1431 return flags; 1479 return flags;
1432 } 1480 }
1433 1481
1434 } // namespace WebCore 1482 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698