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

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

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Handle FrameHost-detached access in FrameLoader::allowPlugins() 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
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | Source/core/frame/LocalFrame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalDOMWindow.cpp
diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp
index 6c930d737ed8ddeac2084ccfee6205259667d83b..b5d3d8df55c8101bcecdc48bcf85d824af16623c 100644
--- a/Source/core/frame/LocalDOMWindow.cpp
+++ b/Source/core/frame/LocalDOMWindow.cpp
@@ -483,7 +483,7 @@ void LocalDOMWindow::enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stat
void LocalDOMWindow::statePopped(PassRefPtr<SerializedScriptValue> stateObject)
{
- if (!frame())
+ if (!m_frame)
return;
// Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we
@@ -496,8 +496,10 @@ void LocalDOMWindow::statePopped(PassRefPtr<SerializedScriptValue> stateObject)
LocalDOMWindow::~LocalDOMWindow()
{
+#if !ENABLE(OILPAN)
ASSERT(m_hasBeenReset);
reset();
+#endif
#if ENABLE(OILPAN)
// Oilpan: the frame host and document objects are
@@ -540,11 +542,13 @@ Page* LocalDOMWindow::page()
return frame() ? frame()->page() : 0;
}
+#if !ENABLE(OILPAN)
void LocalDOMWindow::frameDestroyed()
{
FrameDestructionObserver::frameDestroyed();
reset();
}
+#endif
void LocalDOMWindow::willDetachFrameHost()
{
@@ -557,7 +561,7 @@ void LocalDOMWindow::willDestroyDocumentInFrame()
{
// It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
// unregister themselves from the LocalDOMWindow as a result of the call to willDestroyGlobalObjectInFrame.
- Vector<DOMWindowProperty*> properties;
+ WillBeHeapVector<RawPtrWillBeMember<DOMWindowProperty> > properties;
copyToVector(m_properties, properties);
for (size_t i = 0; i < properties.size(); ++i)
properties[i]->willDestroyGlobalObjectInFrame();
@@ -567,7 +571,7 @@ void LocalDOMWindow::willDetachDocumentFromFrame()
{
// It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
// unregister themselves from the LocalDOMWindow as a result of the call to willDetachGlobalObjectFromFrame.
- Vector<DOMWindowProperty*> properties;
+ WillBeHeapVector<RawPtrWillBeMember<DOMWindowProperty> > properties;
copyToVector(m_properties, properties);
for (size_t i = 0; i < properties.size(); ++i)
properties[i]->willDetachGlobalObjectFromFrame();
@@ -913,7 +917,7 @@ void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intende
DOMSelection* LocalDOMWindow::getSelection()
{
- if (!isCurrentlyDisplayedInFrame() || !m_frame)
+ if (!isCurrentlyDisplayedInFrame())
return 0;
return m_frame->document()->getSelection();
@@ -1071,8 +1075,8 @@ bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar
return false;
// |m_frame| can be destructed during |Editor::findString()| via
- // |Document::updateLayou()|, e.g. event handler removes a frame.
- RefPtr<LocalFrame> protectFrame(m_frame);
+ // |Document::updateLayout()|, e.g. event handler removes a frame.
+ RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get());
// FIXME (13016): Support wholeWord, searchInFrames and showDialog
return m_frame->editor().findString(string, !backwards, caseSensitive, wrap, false);
@@ -1205,7 +1209,13 @@ int LocalDOMWindow::scrollY() const
bool LocalDOMWindow::closed() const
{
- return !m_frame;
+ // FIXME: Oilpan: the timing of when m_frame is GCed is clearly
+ // different to what happens non-Oilpan. m_frame->hasBeenClosed()
+ // is considered in both settings to make the behavior the same --
+ // the flag is set when the WebView (and frame) is closed. Finalization
+ // of the m_frame will happen at some point later.
+ //
+ return !m_frame || m_frame->hasBeenClosed();
}
unsigned LocalDOMWindow::length() const
@@ -1874,11 +1884,10 @@ void LocalDOMWindow::showModalDialog(const String& urlString, const String& dial
LocalDOMWindow* LocalDOMWindow::anonymousIndexedGetter(uint32_t index)
{
- LocalFrame* frame = this->frame();
- if (!frame)
+ if (!m_frame)
return 0;
- Frame* child = frame->tree().scopedChild(index);
+ Frame* child = m_frame->tree().scopedChild(index);
if (child)
return child->domWindow();
@@ -1898,6 +1907,9 @@ PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo
void LocalDOMWindow::trace(Visitor* visitor)
{
visitor->trace(m_document);
+#if ENABLE(OILPAN)
+ visitor->trace(m_properties);
+#endif
visitor->trace(m_screen);
visitor->trace(m_history);
visitor->trace(m_locationbar);
@@ -1919,6 +1931,7 @@ void LocalDOMWindow::trace(Visitor* visitor)
WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor);
EventTargetWithInlineData::trace(visitor);
LifecycleContext<LocalDOMWindow>::trace(visitor);
+ FrameDestructionObserver::trace(visitor);
}
} // namespace blink
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | Source/core/frame/LocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698