Index: Source/web/WebFrame.cpp |
diff --git a/Source/web/WebFrame.cpp b/Source/web/WebFrame.cpp |
index 826f69d06bb99574a13a752590594315a9d81917..82fc8c78ee8d4de009864ffb0c8b0eed9d4f150c 100644 |
--- a/Source/web/WebFrame.cpp |
+++ b/Source/web/WebFrame.cpp |
@@ -231,19 +231,52 @@ WebFrame::~WebFrame() |
m_openedFrameTracker.reset(0); |
} |
-void WebFrame::traceChildren(Visitor* visitor, WebFrame* frame) |
+void WebFrame::traceFrame(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(); |
- } |
+ if (!frame) |
+ return; |
+ |
+ if (frame->isWebLocalFrame()) |
+ visitor->trace(toWebLocalFrameImpl(frame)); |
+ else |
+ visitor->trace(toWebRemoteFrameImpl(frame)); |
+#endif |
+} |
+ |
+bool WebFrame::isAlive(Visitor* visitor, WebFrame* frame) |
+{ |
+#if ENABLE(OILPAN) |
+ if (!frame) |
+ return true; |
haraken
2014/09/24 14:13:04
Shouldn't this be false?
sof
2014/09/24 14:24:34
It could be, I'll move the null check to the call
|
+ |
+ if (frame->isWebLocalFrame()) |
+ return visitor->isAlive(toWebLocalFrameImpl(frame)); |
+ |
+ return visitor->isAlive(toWebRemoteFrameImpl(frame)); |
+#else |
haraken
2014/09/24 14:13:04
Is it possible that isAlive is called in non-oilpa
sof
2014/09/24 14:24:34
Not possible, but I've resisted the temptation to
haraken
2014/09/24 14:28:51
I'd guess it's allowed.
Even if it's not allowed,
|
+ return true; |
+#endif |
+} |
+ |
+void WebFrame::traceFrames(Visitor* visitor, WebFrame* frame) |
+{ |
+#if ENABLE(OILPAN) |
+ 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); |
+#endif |
+} |
+ |
+void WebFrame::clearWeakFrames(Visitor* visitor, WebFrame* frame) |
+{ |
+#if ENABLE(OILPAN) |
+ ASSERT(frame); |
+ if (!isAlive(visitor, frame->m_opener)) |
+ frame->m_opener = nullptr; |
#endif |
} |