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

Unified Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 2849403002: Use const ref for LocalFrame::LocalFrameRoot and FrameTree::Top (Closed)
Patch Set: fix compile and dchecks 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/frame/LocalFrame.cpp
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
index 4f9e243c9ec65b932878b908397989bf4dd373c2..804b604178be2673f6c1b995f7b72a0d183de56d 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -567,21 +567,20 @@ void LocalFrame::DidChangeVisibilityState() {
Frame::DidChangeVisibilityState();
}
-LocalFrame* LocalFrame::LocalFrameRoot() {
- LocalFrame* cur_frame = this;
+LocalFrame& LocalFrame::LocalFrameRoot() const {
+ const LocalFrame* cur_frame = this;
while (cur_frame && cur_frame->Tree().Parent() &&
cur_frame->Tree().Parent()->IsLocalFrame())
cur_frame = ToLocalFrame(cur_frame->Tree().Parent());
- return cur_frame;
+ return const_cast<LocalFrame&>(*cur_frame);
}
bool LocalFrame::IsCrossOriginSubframe() const {
const SecurityOrigin* security_origin =
GetSecurityContext()->GetSecurityOrigin();
- Frame* top = Tree().Top();
- return top && !security_origin->CanAccess(
- top->GetSecurityContext()->GetSecurityOrigin());
+ return !security_origin->CanAccess(
+ Tree().Top().GetSecurityContext()->GetSecurityOrigin());
}
void LocalFrame::SetPrinting(bool printing,
@@ -901,8 +900,8 @@ inline LocalFrame::LocalFrame(LocalFrameClient* client,
instrumenting_agents_ = new CoreProbeSink();
performance_monitor_ = new PerformanceMonitor(this);
} else {
- instrumenting_agents_ = LocalFrameRoot()->instrumenting_agents_;
- performance_monitor_ = LocalFrameRoot()->performance_monitor_;
+ instrumenting_agents_ = LocalFrameRoot().instrumenting_agents_;
+ performance_monitor_ = LocalFrameRoot().performance_monitor_;
}
}
@@ -928,7 +927,7 @@ PluginData* LocalFrame::GetPluginData() const {
if (!Loader().AllowPlugins(kNotAboutToInstantiatePlugin))
return nullptr;
return GetPage()->GetPluginData(
- Tree().Top()->GetSecurityContext()->GetSecurityOrigin());
+ Tree().Top().GetSecurityContext()->GetSecurityOrigin());
}
DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame);
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.h ('k') | third_party/WebKit/Source/core/frame/RemoteFrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698