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

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: Conditionally define detach() 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
« Source/platform/Widget.h ('K') | « 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..1c3ef88099e24c0d411c216e89518d8a48d38348 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,12 +431,26 @@ void WebPluginContainerImpl::allowScriptObjects()
void WebPluginContainerImpl::clearScriptObjects()
{
+#if ENABLE(OILPAN)
+ if (m_scriptController) {
+ m_scriptController->cleanupScriptObjectsForPlugin(this);
haraken 2014/06/25 05:40:16 Maybe should we call cleanupScriptObjectsForPlugin
sof 2014/06/25 05:44:25 Is Node::detach() (from where we call this contain
haraken 2014/06/25 05:54:24 ah, understood. Then would it be possible to call
sof 2014/06/25 07:09:32 (cleanupScriptObjectsForPlugin() is something the
+ m_scriptController = nullptr;
+ }
+#else
LocalFrame* frame = m_element->document().frame();
if (!frame)
return;
frame->script().cleanupScriptObjectsForPlugin(this);
+#endif
}
+#if ENABLE(OILPAN)
+void WebPluginContainerImpl::setScriptController(WebCore::ScriptController* scriptController)
+{
+ m_scriptController = scriptController;
+}
+#endif
+
NPObject* WebPluginContainerImpl::scriptableObjectForElement()
{
return m_element->getNPObject();
@@ -655,6 +674,9 @@ bool WebPluginContainerImpl::paintCustomOverhangArea(GraphicsContext* context, c
WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin)
: m_element(element)
, m_webPlugin(webPlugin)
+#if ENABLE(OILPAN)
+ , m_scriptController(0)
+#endif
, m_webLayer(0)
, m_touchEventRequestType(TouchEventRequestTypeNone)
, m_wantsWheelEvents(false)
@@ -663,8 +685,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 +708,16 @@ WebPluginContainerImpl::~WebPluginContainerImpl()
GraphicsLayer::unregisterContentsLayer(m_webLayer);
haraken 2014/06/25 05:40:16 Probably can we move the line 704 - 708 to detach(
}
+#if ENABLE(OILPAN)
+void WebPluginContainerImpl::detach()
+{
+ if (m_touchEventRequestType != TouchEventRequestTypeNone)
+ m_element->document().didRemoveTouchEventHandler(m_element);
+
+ setWebLayer(0);
haraken 2014/06/25 05:54:24 Just help me understand: Calling setWebLayer(0) is
sof 2014/06/25 07:09:32 Exactly so; we cannot do it at finalization time a
+}
+#endif
+
void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event)
{
ASSERT(parent()->isFrameView());
« Source/platform/Widget.h ('K') | « Source/web/WebPluginContainerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698