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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index 5c6f689c26a2141192e15d7e42ccd73d29db6707..436ca2d9a43464cac5b8030d4ce4129efdad9a47 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -105,11 +105,48 @@
return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload || type == FrameLoadTypeReloadFromOrigin;
}
+class FrameLoader::FrameProgressTracker {
+public:
+ static PassOwnPtr<FrameProgressTracker> create(LocalFrame* frame) { return adoptPtr(new FrameProgressTracker(frame)); }
+ ~FrameProgressTracker()
+ {
+ ASSERT(!m_inProgress || m_frame->page());
+ if (m_inProgress)
+ m_frame->page()->progress().progressCompleted(m_frame);
+ }
+
+ void progressStarted()
+ {
+ ASSERT(m_frame->page());
+ if (!m_inProgress)
+ m_frame->page()->progress().progressStarted(m_frame);
+ m_inProgress = true;
+ }
+
+ void progressCompleted()
+ {
+ ASSERT(m_inProgress);
+ ASSERT(m_frame->page());
+ m_inProgress = false;
+ m_frame->page()->progress().progressCompleted(m_frame);
+ }
+
+private:
+ FrameProgressTracker(LocalFrame* frame)
+ : m_frame(frame)
+ , m_inProgress(false)
+ {
+ }
+
+ LocalFrame* m_frame;
+ bool m_inProgress;
+};
+
FrameLoader::FrameLoader(LocalFrame* frame, FrameLoaderClient* client)
: m_frame(frame)
, m_client(client)
, m_mixedContentChecker(frame)
- , m_progressTracker(ProgressTracker::create(frame))
+ , m_progressTracker(FrameProgressTracker::create(m_frame))
, m_state(FrameStateProvisional)
, m_loadType(FrameLoadTypeStandard)
, m_fetchContext(FrameFetchContext::create(frame))
@@ -536,14 +573,14 @@
// don't fire them for fragment redirection that happens in window.onload handler.
// See https://bugs.webkit.org/show_bug.cgi?id=31838
if (m_frame->document()->loadEventFinished())
- m_client->didStartLoading(NavigationWithinSameDocument);
+ m_client->postProgressStartedNotification(NavigationWithinSameDocument);
HistoryCommitType historyCommitType = updateBackForwardList == UpdateBackForwardList && m_currentItem ? StandardCommit : HistoryInertCommit;
setHistoryItemStateForCommit(historyCommitType, sameDocumentNavigationSource == SameDocumentNavigationHistoryApi, data);
m_client->dispatchDidNavigateWithinPage(m_currentItem.get(), historyCommitType);
m_client->dispatchDidReceiveTitle(m_frame->document()->title());
if (m_frame->document()->loadEventFinished())
- m_client->didStopLoading();
+ m_client->postProgressFinishedNotification();
}
void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScriptValue> stateObject, UpdateBackForwardListPolicy updateBackForwardList, ClientRedirectPolicy clientRedirect)
@@ -1051,6 +1088,17 @@
checkLoadComplete();
}
+int FrameLoader::numPendingOrLoadingRequests(bool recurse) const
+{
+ if (!recurse)
+ return m_frame->document()->fetcher()->requestCount();
+
+ int count = 0;
+ for (LocalFrame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_frame))
+ count += frame->document()->fetcher()->requestCount();
+ return count;
+}
+
String FrameLoader::userAgent(const KURL& url) const
{
String userAgent = m_client->userAgent(url);
« 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