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

Unified Diff: Source/core/frame/Frame.cpp

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase past r181245 conflict Created 6 years, 3 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: Source/core/frame/Frame.cpp
diff --git a/Source/core/frame/Frame.cpp b/Source/core/frame/Frame.cpp
index f647b3e5988b5ed202236a17a12183a39112612d..3ffd98811ceb4180b61749304dcc81c28d2b6deb 100644
--- a/Source/core/frame/Frame.cpp
+++ b/Source/core/frame/Frame.cpp
@@ -63,6 +63,10 @@ Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner)
, m_owner(owner)
, m_client(client)
, m_remotePlatformLayer(0)
+#if ENABLE(OILPAN)
+ , m_disposeProtectionCount(0)
+ , m_hasBeenDisposed(false)
+#endif
{
ASSERT(page());
@@ -81,19 +85,51 @@ Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner)
Frame::~Frame()
{
+#if ENABLE(OILPAN)
+ // With Oilpan, we depend on the Frame owner explicitly disposing it first.
+ // FIXME: consider also insisting on this non-Oilpan.
+ ASSERT(m_hasBeenDisposed);
+#else
+ // FIXME: We should not be doing all this work inside the destructor
+ dispose();
+#endif
+}
+
+#if ENABLE(OILPAN)
+void Frame::willBeDestroyed()
+{
+ if (m_disposeProtectionCount > 0) {
+ setHasBeenDisposed();
+ return;
+ }
+ if (hasBeenDisposed())
+ return;
+
+ setHasBeenDisposed();
+ dispose();
+}
+#endif
+
+void Frame::dispose()
+{
disconnectOwnerElement();
setDOMWindow(nullptr);
- // FIXME: We should not be doing all this work inside the destructor
-
#ifndef NDEBUG
frameCounter.decrement();
#endif
}
+void Frame::trace(Visitor* visitor)
+{
+ visitor->trace(m_treeNode);
+ visitor->trace(m_owner);
+ visitor->trace(m_domWindow);
+}
+
void Frame::detachChildren()
{
- typedef Vector<RefPtr<Frame> > FrameVector;
+ typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector;
FrameVector childrenToDetach;
childrenToDetach.reserveCapacity(tree().childCount());
for (Frame* child = tree().firstChild(); child; child = child->tree().nextSibling())
@@ -158,7 +194,7 @@ RenderPart* Frame::ownerRenderer() const
return toRenderPart(object);
}
-void Frame::setRemotePlatformLayer(blink::WebLayer* layer)
+void Frame::setRemotePlatformLayer(WebLayer* layer)
{
if (m_remotePlatformLayer)
GraphicsLayer::unregisterContentsLayer(m_remotePlatformLayer);
@@ -197,7 +233,7 @@ void Frame::disconnectOwnerElement()
if (page())
page()->decrementSubframeCount();
}
- m_owner = 0;
+ m_owner = nullptr;
}
HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const

Powered by Google App Engine
This is Rietveld 408576698