Index: Source/core/frame/LocalFrame.cpp |
diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp |
index 94a5d12e52729f9b52217b2c695faf5249daa7ce..1e70bd94b3d016bc3901e5ff3667814bfc2c9e5d 100644 |
--- a/Source/core/frame/LocalFrame.cpp |
+++ b/Source/core/frame/LocalFrame.cpp |
@@ -44,6 +44,7 @@ |
#include "core/frame/FrameConsole.h" |
#include "core/frame/FrameDestructionObserver.h" |
#include "core/frame/FrameHost.h" |
+#include "core/frame/FrameProtector.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/LocalDOMWindow.h" |
#include "core/frame/Settings.h" |
@@ -106,15 +107,37 @@ inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO |
{ |
} |
-PassRefPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client, FrameHost* host, FrameOwner* owner) |
+PassRefPtrWillBeRawPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client, FrameHost* host, FrameOwner* owner) |
{ |
- RefPtr<LocalFrame> frame = adoptRef(new LocalFrame(client, host, owner)); |
+ RefPtrWillBeRawPtr<LocalFrame> frame = adoptRefWillBeNoop(new LocalFrame(client, host, owner)); |
InspectorInstrumentation::frameAttachedToParent(frame.get()); |
return frame.release(); |
} |
LocalFrame::~LocalFrame() |
{ |
+#if !ENABLE(OILPAN) |
+ dispose(); |
+#endif |
+} |
+ |
+void LocalFrame::trace(Visitor* visitor) |
+{ |
+ visitor->trace(m_loader); |
+ visitor->trace(m_navigationScheduler); |
+ visitor->trace(m_pagePopupOwner); |
+ visitor->trace(m_editor); |
+ visitor->trace(m_spellChecker); |
+ visitor->trace(m_selection); |
+ visitor->trace(m_eventHandler); |
+ visitor->trace(m_console); |
+ visitor->trace(m_inputMethodController); |
+ Frame::trace(visitor); |
+ WillBeHeapSupplementable<LocalFrame>::trace(visitor); |
+} |
+ |
+void LocalFrame::dispose() |
+{ |
setView(nullptr); |
loader().clear(); |
setDOMWindow(nullptr); |
@@ -123,13 +146,22 @@ LocalFrame::~LocalFrame() |
HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.end(); |
for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it) |
(*it)->frameDestroyed(); |
+ |
+#if ENABLE(OILPAN) |
+ // For non-Oilpan, ~Frame arranges for same. |
+ Frame::dispose(); |
+#endif |
} |
void LocalFrame::detach() |
{ |
+#if ENABLE(OILPAN) |
+ if (hasBeenDisposed()) |
Mads Ager (chromium)
2014/09/03 10:07:54
Could you explain when we get a detach of a local
|
+ return; |
+#endif |
// A lot of the following steps can result in the current frame being |
// detached, so protect a reference to it. |
- RefPtr<LocalFrame> protect(this); |
+ FrameProtector protect(this); |
m_loader.stopAllLoaders(); |
m_loader.closeURL(); |
detachChildren(); |
@@ -199,7 +231,7 @@ void LocalFrame::setPrinting(bool printing, const FloatSize& pageSize, const Flo |
} |
// Subframes of the one we're printing don't lay out to the page size. |
- for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree().nextSibling()) { |
+ for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = child->tree().nextSibling()) { |
if (child->isLocalFrame()) |
toLocalFrame(child.get())->setPrinting(printing, FloatSize(), FloatSize(), 0); |
} |
@@ -248,7 +280,7 @@ void LocalFrame::didChangeVisibilityState() |
if (document()) |
document()->didChangeVisibilityState(); |
- Vector<RefPtr<LocalFrame> > childFrames; |
+ WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > childFrames; |
for (Frame* child = tree().firstChild(); child; child = child->tree().nextSibling()) { |
if (child->isLocalFrame()) |
childFrames.append(toLocalFrame(child)); |
@@ -294,7 +326,7 @@ void LocalFrame::willDetachFrameHost() |
void LocalFrame::detachFromFrameHost() |
{ |
- // We should never be detatching the page during a Layout. |
+ // We should never be detaching the page during a Layout. |
RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); |
m_host = 0; |
} |
@@ -513,7 +545,7 @@ void LocalFrame::setPageAndTextZoomFactors(float pageZoomFactor, float textZoomF |
m_pageZoomFactor = pageZoomFactor; |
m_textZoomFactor = textZoomFactor; |
- for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree().nextSibling()) { |
+ for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = child->tree().nextSibling()) { |
if (child->isLocalFrame()) |
toLocalFrame(child.get())->setPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor); |
} |
@@ -525,7 +557,7 @@ void LocalFrame::setPageAndTextZoomFactors(float pageZoomFactor, float textZoomF |
void LocalFrame::deviceOrPageScaleFactorChanged() |
{ |
document()->mediaQueryAffectingValueChanged(); |
- for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree().nextSibling()) { |
+ for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = child->tree().nextSibling()) { |
if (child->isLocalFrame()) |
toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); |
} |