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

Unified Diff: Source/core/loader/FrameLoader.cpp

Issue 33353003: Have Frame::tree() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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 | « Source/core/loader/DocumentLoader.cpp ('k') | Source/core/loader/HistoryController.cpp » ('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 ae5d5109e55cd3c42762db3cbed42ddee4bd3d7c..88c3de4ab22373c5bb71ad44675bb685ffe46022 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -390,7 +390,7 @@ void FrameLoader::loadDone()
bool FrameLoader::allChildrenAreComplete() const
{
- for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
+ for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) {
if (!child->loader()->m_isComplete)
return false;
}
@@ -399,7 +399,7 @@ bool FrameLoader::allChildrenAreComplete() const
bool FrameLoader::allAncestorsAreComplete() const
{
- for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree()->parent()) {
+ for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree().parent()) {
if (!ancestor->document()->loadEventFinished())
return false;
}
@@ -483,7 +483,7 @@ String FrameLoader::outgoingReferrer() const
// for why we walk the parent chain for srcdoc documents.
Frame* frame = m_frame;
while (frame->document()->isSrcdocDocument()) {
- frame = frame->tree()->parent();
+ frame = frame->tree().parent();
// Srcdoc documents cannot be top-level documents, by definition,
// because they need to be contained in iframes with the srcdoc.
ASSERT(frame);
@@ -604,10 +604,10 @@ void FrameLoader::completed()
{
RefPtr<Frame> protect(m_frame);
- for (Frame* descendant = m_frame->tree()->traverseNext(m_frame); descendant; descendant = descendant->tree()->traverseNext(m_frame))
+ for (Frame* descendant = m_frame->tree().traverseNext(m_frame); descendant; descendant = descendant->tree().traverseNext(m_frame))
descendant->navigationScheduler()->startTimer();
- if (Frame* parent = m_frame->tree()->parent())
+ if (Frame* parent = m_frame->tree().parent())
parent->loader()->checkCompleted();
if (m_frame->view())
@@ -616,7 +616,7 @@ void FrameLoader::completed()
void FrameLoader::started()
{
- for (Frame* frame = m_frame; frame; frame = frame->tree()->parent())
+ for (Frame* frame = m_frame; frame; frame = frame->tree().parent())
frame->loader()->m_isComplete = false;
}
@@ -656,16 +656,16 @@ bool FrameLoader::isScriptTriggeredFormSubmissionInChildFrame(const FrameLoadReq
// If this is a child frame and the form submission was triggered by a script, lock the back/forward list
// to match IE and Opera.
// See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this.
- if (!m_frame->tree()->parent() || UserGestureIndicator::processingUserGesture())
+ if (!m_frame->tree().parent() || UserGestureIndicator::processingUserGesture())
return false;
return request.formState() && request.formState()->formSubmissionTrigger() == SubmittedByJavaScript;
}
FrameLoadType FrameLoader::determineFrameLoadType(const FrameLoadRequest& request)
{
- if (m_frame->tree()->parent() && !m_stateMachine.startedFirstRealLoad())
+ if (m_frame->tree().parent() && !m_stateMachine.startedFirstRealLoad())
return FrameLoadTypeInitialInChildFrame;
- if (!m_frame->tree()->parent() && !history()->currentItem())
+ if (!m_frame->tree().parent() && !history()->currentItem())
return FrameLoadTypeStandard;
if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData)
return FrameLoadTypeReload;
@@ -818,7 +818,7 @@ void FrameLoader::stopAllLoaders()
m_inStopAllLoaders = true;
- for (RefPtr<Frame> child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+ for (RefPtr<Frame> child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling())
child->loader()->stopAllLoaders();
if (m_provisionalDocumentLoader)
m_provisionalDocumentLoader->stopLoading();
@@ -929,7 +929,7 @@ void FrameLoader::closeOldDataSources()
// FIXME: Is it important for this traversal to be postorder instead of preorder?
// If so, add helpers for postorder traversal, and use them. If not, then lets not
// use a recursive algorithm here.
- for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+ for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling())
child->loader()->closeOldDataSources();
if (m_documentLoader)
@@ -945,7 +945,7 @@ bool FrameLoader::isLoadingMainFrame() const
bool FrameLoader::subframeIsLoading() const
{
// It's most likely that the last added frame is the last to load so we walk backwards.
- for (Frame* child = m_frame->tree()->lastChild(); child; child = child->tree()->previousSibling()) {
+ for (Frame* child = m_frame->tree().lastChild(); child; child = child->tree().previousSibling()) {
FrameLoader* childLoader = child->loader();
DocumentLoader* documentLoader = childLoader->documentLoader();
if (documentLoader && documentLoader->isLoadingInAPISense())
@@ -973,7 +973,7 @@ CachePolicy FrameLoader::subresourceCachePolicy() const
if (m_loadType == FrameLoadTypeReloadFromOrigin)
return CachePolicyReload;
- if (Frame* parentFrame = m_frame->tree()->parent()) {
+ if (Frame* parentFrame = m_frame->tree().parent()) {
CachePolicy parentCachePolicy = parentFrame->loader()->subresourceCachePolicy();
if (parentCachePolicy != CachePolicyVerify)
return parentCachePolicy;
@@ -1049,8 +1049,8 @@ void FrameLoader::detachChildren()
{
typedef Vector<RefPtr<Frame> > FrameVector;
FrameVector childrenToDetach;
- childrenToDetach.reserveCapacity(m_frame->tree()->childCount());
- for (Frame* child = m_frame->tree()->lastChild(); child; child = child->tree()->previousSibling())
+ childrenToDetach.reserveCapacity(m_frame->tree().childCount());
+ for (Frame* child = m_frame->tree().lastChild(); child; child = child->tree().previousSibling())
childrenToDetach.append(child);
FrameVector::iterator end = childrenToDetach.end();
for (FrameVector::iterator it = childrenToDetach.begin(); it != end; it++)
@@ -1059,7 +1059,7 @@ void FrameLoader::detachChildren()
void FrameLoader::closeAndRemoveChild(Frame* child)
{
- child->tree()->detachFromParent();
+ child->tree().detachFromParent();
child->setView(0);
if (child->ownerElement() && child->page())
@@ -1067,7 +1067,7 @@ void FrameLoader::closeAndRemoveChild(Frame* child)
child->willDetachPage();
child->detachFromPage();
- m_frame->tree()->removeChild(child);
+ m_frame->tree().removeChild(child);
}
// Called every time a resource is completely loaded or an error is received.
@@ -1079,7 +1079,7 @@ void FrameLoader::checkLoadComplete()
// is currently needed in order to null out the previous history item for all frames.
if (Page* page = m_frame->page()) {
Vector<RefPtr<Frame>, 10> frames;
- for (RefPtr<Frame> frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
+ for (RefPtr<Frame> frame = page->mainFrame(); frame; frame = frame->tree().traverseNext())
frames.append(frame);
// To process children before their parents, iterate the vector backwards.
for (size_t i = frames.size(); i; --i)
@@ -1100,7 +1100,7 @@ int FrameLoader::numPendingOrLoadingRequests(bool recurse) const
return m_frame->document()->fetcher()->requestCount();
int count = 0;
- for (Frame* frame = m_frame; frame; frame = frame->tree()->traverseNext(m_frame))
+ for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_frame))
count += frame->document()->fetcher()->requestCount();
return count;
}
@@ -1141,7 +1141,7 @@ void FrameLoader::detachFromParent()
m_progressTracker.clear();
- if (Frame* parent = m_frame->tree()->parent()) {
+ if (Frame* parent = m_frame->tree().parent()) {
parent->loader()->closeAndRemoveChild(m_frame);
parent->loader()->scheduleCheckCompleted();
} else {
@@ -1296,7 +1296,7 @@ bool FrameLoader::shouldClose()
// Store all references to each subframe in advance since beforeunload's event handler may modify frame
Vector<RefPtr<Frame> > targetFrames;
targetFrames.append(m_frame);
- for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->traverseNext(m_frame))
+ for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().traverseNext(m_frame))
targetFrames.append(child);
bool shouldClose = false;
@@ -1305,7 +1305,7 @@ bool FrameLoader::shouldClose()
size_t i;
for (i = 0; i < targetFrames.size(); i++) {
- if (!targetFrames[i]->tree()->isDescendantOf(m_frame))
+ if (!targetFrames[i]->tree().isDescendantOf(m_frame))
continue;
if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->chrome(), m_frame->document()))
break;
@@ -1348,7 +1348,7 @@ void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const
m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistoryItem);
m_policyDocumentLoader->setIsClientRedirect(m_startingClientRedirect);
- if (Frame* parent = m_frame->tree()->parent())
+ if (Frame* parent = m_frame->tree().parent())
m_policyDocumentLoader->setOverrideEncoding(parent->loader()->documentLoader()->overrideEncoding());
else if (!overrideEncoding.isEmpty())
m_policyDocumentLoader->setOverrideEncoding(overrideEncoding);
@@ -1425,7 +1425,7 @@ void FrameLoader::checkNewWindowPolicyAndContinue(PassRefPtr<FormState> formStat
}
if (frameName != "_blank")
- mainFrame->tree()->setName(frameName);
+ mainFrame->tree().setName(frameName);
mainFrame->page()->setOpenedByDOM();
mainFrame->page()->chrome().show(navigationPolicy);
@@ -1450,7 +1450,7 @@ bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con
{
UseCounter::count(m_frame->domWindow(), UseCounter::XFrameOptions);
- Frame* topFrame = m_frame->tree()->top();
+ Frame* topFrame = m_frame->tree().top();
if (m_frame == topFrame)
return false;
@@ -1462,7 +1462,7 @@ bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con
RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url);
if (!origin->isSameSchemeHostPort(topFrame->document()->securityOrigin()))
return true;
- for (Frame* frame = m_frame->tree()->parent(); frame; frame = frame->tree()->parent()) {
+ for (Frame* frame = m_frame->tree().parent(); frame; frame = frame->tree().parent()) {
if (!origin->isSameSchemeHostPort(frame->document()->securityOrigin())) {
UseCounter::count(m_frame->domWindow(), UseCounter::XFrameOptionsSameOriginWithBadAncestorChain);
return true;
@@ -1508,7 +1508,7 @@ bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const
Frame* FrameLoader::findFrameForNavigation(const AtomicString& name, Document* activeDocument)
{
ASSERT(activeDocument);
- Frame* frame = m_frame->tree()->find(name);
+ Frame* frame = m_frame->tree().find(name);
// From http://www.whatwg.org/specs/web-apps/current-work/#seamlessLinks:
//
@@ -1520,7 +1520,7 @@ Frame* FrameLoader::findFrameForNavigation(const AtomicString& name, Document* a
// browsing context flag set, and continue these steps as if that
// browsing context was the one that was going to be navigated instead.
if (frame == m_frame && name != "_self" && m_frame->document()->shouldDisplaySeamlesslyWithParent()) {
- for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree()->parent()) {
+ for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree().parent()) {
if (!ancestor->document()->shouldDisplaySeamlesslyWithParent()) {
frame = ancestor;
break;
@@ -1599,7 +1599,7 @@ void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
SandboxFlags FrameLoader::effectiveSandboxFlags() const
{
SandboxFlags flags = m_forcedSandboxFlags;
- if (Frame* parentFrame = m_frame->tree()->parent())
+ if (Frame* parentFrame = m_frame->tree().parent())
flags |= parentFrame->document()->sandboxFlags();
if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement())
flags |= ownerElement->sandboxFlags();
« no previous file with comments | « Source/core/loader/DocumentLoader.cpp ('k') | Source/core/loader/HistoryController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698