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

Unified Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp

Issue 1652093002: Support reviving a disposed plugin container. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename m_inDispose to m_isDisposed Created 4 years, 11 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 | « third_party/WebKit/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: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
index 1a9ca1339518c78fb8dc3857623631ac64e0a435..3167727860d70be4b700cda6dc752157108e6ffe 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
@@ -267,11 +267,12 @@ void WebPluginContainerImpl::setParent(Widget* widget)
void WebPluginContainerImpl::setPlugin(WebPlugin* plugin)
{
- RELEASE_ASSERT(!m_inDispose);
- if (plugin != m_webPlugin) {
- m_element->resetInstance();
- m_webPlugin = plugin;
- }
+ if (plugin == m_webPlugin)
+ return;
+
+ m_element->resetInstance();
+ m_webPlugin = plugin;
+ m_isDisposed = false;
}
float WebPluginContainerImpl::deviceScaleFactor()
@@ -508,7 +509,7 @@ bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect)
// be valid memory once this object has started disposal. In particular, we might be being
// disposed because the frame has already be deleted and then something else dropped the
// last reference to the this object.
- if (m_inDispose || !m_element)
+ if (m_isDisposed || !m_element)
return false;
LocalFrame* frame = m_element->document().frame();
@@ -530,7 +531,7 @@ bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect)
void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType requestType)
{
- if (m_touchEventRequestType == requestType)
+ if (m_touchEventRequestType == requestType || !m_element)
return;
if (m_element->document().frameHost()) {
@@ -683,7 +684,7 @@ WebPluginContainerImpl::WebPluginContainerImpl(HTMLPlugInElement* element, WebPl
, m_webLayer(nullptr)
, m_touchEventRequestType(TouchEventRequestTypeNone)
, m_wantsWheelEvents(false)
- , m_inDispose(false)
+ , m_isDisposed(false)
{
#if ENABLE(OILPAN)
ThreadState::current()->registerPreFinalizer(this);
@@ -702,10 +703,9 @@ WebPluginContainerImpl::~WebPluginContainerImpl()
void WebPluginContainerImpl::dispose()
{
- m_inDispose = true;
+ m_isDisposed = true;
- if (m_element && m_touchEventRequestType != TouchEventRequestTypeNone && m_element->document().frameHost())
- m_element->document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*m_element, EventHandlerRegistry::TouchEvent);
+ requestTouchEventType(TouchEventRequestTypeNone);
if (m_webPlugin) {
RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() == this);
@@ -717,8 +717,6 @@ void WebPluginContainerImpl::dispose()
GraphicsLayer::unregisterContentsLayer(m_webLayer);
m_webLayer = nullptr;
}
-
- m_element = nullptr;
}
DEFINE_TRACE(WebPluginContainerImpl)
« no previous file with comments | « third_party/WebKit/Source/web/WebPluginContainerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698