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

Unified Diff: Source/web/WebFrame.cpp

Issue 594483002: Oilpan: extend tracing over WebFrame trees. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improve weak callback registration Created 6 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/web/OpenedFrameTracker.cpp ('k') | Source/web/WebLocalFrameImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebFrame.cpp
diff --git a/Source/web/WebFrame.cpp b/Source/web/WebFrame.cpp
index 62d8960918986b4871c7dfca6561e753754cecf4..64e4450f0252dca1b340ba690efa514c037fe54e 100644
--- a/Source/web/WebFrame.cpp
+++ b/Source/web/WebFrame.cpp
@@ -226,20 +226,44 @@ WebFrame::~WebFrame()
m_openedFrameTracker.reset(0);
}
-void WebFrame::traceChildren(Visitor* visitor, WebFrame* frame)
-{
#if ENABLE(OILPAN)
- // Trace the children frames.
- WebFrame* child = frame ? frame->firstChild() : 0;
- while (child) {
- if (child->isWebLocalFrame())
- visitor->trace(toWebLocalFrameImpl(child));
- else
- visitor->trace(toWebRemoteFrameImpl(child));
-
- child = child->nextSibling();
- }
-#endif
+void WebFrame::traceFrame(Visitor* visitor, WebFrame* frame)
+{
+ if (!frame)
+ return;
+
+ if (frame->isWebLocalFrame())
+ visitor->trace(toWebLocalFrameImpl(frame));
+ else
+ visitor->trace(toWebRemoteFrameImpl(frame));
+}
+
+void WebFrame::traceFrames(Visitor* visitor, WebFrame* frame)
+{
+ ASSERT(frame);
+ traceFrame(visitor, frame->m_parent);
+ for (WebFrame* child = frame->firstChild(); child; child = child->nextSibling())
+ traceFrame(visitor, child);
+ // m_opener is a weak reference.
+ frame->m_openedFrameTracker->traceFrames(visitor);
}
+bool WebFrame::isAlive(Visitor* visitor, WebFrame* frame)
+{
+ if (!frame)
+ return true;
+
+ if (frame->isWebLocalFrame())
+ return visitor->isAlive(toWebLocalFrameImpl(frame));
+
+ return visitor->isAlive(toWebRemoteFrameImpl(frame));
+}
+
+void WebFrame::clearWeakFrames(Visitor* visitor)
+{
+ if (!isAlive(visitor, m_opener))
+ m_opener = nullptr;
+}
+#endif
+
} // namespace blink
« no previous file with comments | « Source/web/OpenedFrameTracker.cpp ('k') | Source/web/WebLocalFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698