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

Unified Diff: Source/web/WebPluginContainerImpl.cpp

Issue 357443005: Oilpan: make shutdown of plugin container objects work better. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have WebPluginContainerImpl be a FrameDestructionObserver Created 6 years, 6 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/WebPluginContainerImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebPluginContainerImpl.cpp
diff --git a/Source/web/WebPluginContainerImpl.cpp b/Source/web/WebPluginContainerImpl.cpp
index 5f5bd41aefe882ae08f1652521b96cdec90ed94a..73f81f7cd1c7ac1f7bdc29b9ab44c3b25e98361a 100644
--- a/Source/web/WebPluginContainerImpl.cpp
+++ b/Source/web/WebPluginContainerImpl.cpp
@@ -303,6 +303,11 @@ void WebPluginContainerImpl::setWebLayer(WebLayer* layer)
if (!needsCompositingUpdate)
return;
+#if ENABLE(OILPAN)
+ if (!m_element)
+ return;
+#endif
+
m_element->setNeedsCompositingUpdate();
// Being composited or not affects the self painting layer bit
// on the RenderLayer.
@@ -426,10 +431,10 @@ void WebPluginContainerImpl::allowScriptObjects()
void WebPluginContainerImpl::clearScriptObjects()
{
- LocalFrame* frame = m_element->document().frame();
- if (!frame)
+ if (!frame())
return;
- frame->script().cleanupScriptObjectsForPlugin(this);
+
+ frame()->script().cleanupScriptObjectsForPlugin(this);
}
NPObject* WebPluginContainerImpl::scriptableObjectForElement()
@@ -653,7 +658,8 @@ bool WebPluginContainerImpl::paintCustomOverhangArea(GraphicsContext* context, c
// Private methods -------------------------------------------------------------
WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin)
- : m_element(element)
+ : WebCore::FrameDestructionObserver(element->document().frame())
+ , m_element(element)
, m_webPlugin(webPlugin)
, m_webLayer(0)
, m_touchEventRequestType(TouchEventRequestTypeNone)
@@ -663,8 +669,21 @@ WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* eleme
WebPluginContainerImpl::~WebPluginContainerImpl()
{
+#if ENABLE(OILPAN)
+ // The element (and its document) are heap allocated and may
+ // have been finalized by now; unsafe to unregister the touch
+ // event handler at this stage.
+ //
+ // This is acceptable, as the widget will unregister itself if it
+ // is cleanly detached. If an explicit detach doesn't happen, this
+ // container is assumed to have died with the plugin element (and
+ // its document), hence no unregistration step is needed.
+ //
+ m_element = 0;
+#else
if (m_touchEventRequestType != TouchEventRequestTypeNone)
m_element->document().didRemoveTouchEventHandler(m_element);
+#endif
for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i)
m_pluginLoadObservers[i]->clearPluginContainer();
@@ -673,6 +692,16 @@ WebPluginContainerImpl::~WebPluginContainerImpl()
GraphicsLayer::unregisterContentsLayer(m_webLayer);
}
+#if ENABLE(OILPAN)
+void WebPluginContainerImpl::detach()
+{
+ if (m_touchEventRequestType != TouchEventRequestTypeNone)
+ m_element->document().didRemoveTouchEventHandler(m_element);
+
+ setWebLayer(0);
+}
+#endif
+
void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event)
{
ASSERT(parent()->isFrameView());
« no previous file with comments | « Source/web/WebPluginContainerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698