Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp |
| diff --git a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp |
| index acbe2d537a7697ade62daf4111ad04a2c5831b58..450ae85567775aeb827a797729a82c0e1637dee8 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp |
| @@ -92,23 +92,18 @@ HTMLPlugInElement::~HTMLPlugInElement() { |
| DEFINE_TRACE(HTMLPlugInElement) { |
| visitor->trace(m_imageLoader); |
| - visitor->trace(m_persistedPluginWidget); |
| + visitor->trace(m_persistedPlugin); |
| HTMLFrameOwnerElement::trace(visitor); |
| } |
| -void HTMLPlugInElement::setPersistedPluginWidget(FrameViewBase* frameViewBase) { |
| - if (m_persistedPluginWidget == frameViewBase) |
| +void HTMLPlugInElement::setPersistedPlugin(PluginView* plugin) { |
| + if (m_persistedPlugin == plugin) |
| return; |
| - if (m_persistedPluginWidget) { |
| - if (m_persistedPluginWidget->isPluginView()) { |
| - m_persistedPluginWidget->hide(); |
| - disposeWidgetSoon(m_persistedPluginWidget.release()); |
| - } else { |
| - DCHECK(m_persistedPluginWidget->isFrameView() || |
| - m_persistedPluginWidget->isRemoteFrameView()); |
|
haraken
2017/03/20 03:06:35
Just to confirm: Was this code path not reachable?
joelhockey
2017/03/20 03:54:29
Yes, the code path has never been reachable, and b
|
| - } |
| + if (m_persistedPlugin) { |
| + m_persistedPlugin->hide(); |
| + disposeWidgetSoon(m_persistedPlugin.release()); |
| } |
| - m_persistedPluginWidget = frameViewBase; |
| + m_persistedPlugin = plugin; |
| } |
| bool HTMLPlugInElement::requestObjectInternal( |
| @@ -176,9 +171,9 @@ void HTMLPlugInElement::attachLayoutTree(const AttachContext& context) { |
| if (!layoutObject() || useFallbackContent()) { |
| // If we don't have a layoutObject we have to dispose of any plugins |
| // which we persisted over a reattach. |
| - if (m_persistedPluginWidget) { |
| + if (m_persistedPlugin) { |
| HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
| - setPersistedPluginWidget(nullptr); |
| + setPersistedPlugin(nullptr); |
| } |
| return; |
| } |
| @@ -208,11 +203,11 @@ void HTMLPlugInElement::updatePlugin() { |
| void HTMLPlugInElement::removedFrom(ContainerNode* insertionPoint) { |
| // If we've persisted the plugin and we're removed from the tree then |
| // make sure we cleanup the persistance pointer. |
| - if (m_persistedPluginWidget) { |
| + if (m_persistedPlugin) { |
| // TODO(dcheng): This UpdateSuspendScope doesn't seem to provide much; |
| // investigate removing it. |
| HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
| - setPersistedPluginWidget(nullptr); |
| + setPersistedPlugin(nullptr); |
| } |
| HTMLFrameOwnerElement::removedFrom(insertionPoint); |
| } |
| @@ -252,11 +247,7 @@ void HTMLPlugInElement::createPluginWithoutLayoutObject() { |
| } |
| bool HTMLPlugInElement::shouldAccelerate() const { |
| - if (FrameViewBase* frameViewBase = ownedWidget()) { |
| - return frameViewBase->isPluginView() && |
| - toPluginView(frameViewBase)->platformLayer(); |
| - } |
| - return false; |
| + return ownedPlugin()->platformLayer(); |
| } |
| void HTMLPlugInElement::detachLayoutTree(const AttachContext& context) { |
| @@ -271,13 +262,13 @@ void HTMLPlugInElement::detachLayoutTree(const AttachContext& context) { |
| document().decrementLoadEventDelayCount(); |
| } |
| - // Only try to persist a plugin FrameViewBase we actually own. |
| - FrameViewBase* plugin = ownedWidget(); |
| + // Only try to persist a plugin we actually own. |
| + PluginView* plugin = ownedPlugin(); |
| if (plugin && context.performingReattach) { |
| - setPersistedPluginWidget(releaseWidget()); |
| + setPersistedPlugin(releasePlugin()); |
| } else { |
| - // Clear the FrameViewBase; will trigger disposal of it with Oilpan. |
| - setWidget(nullptr); |
| + // Clear the plugin; will trigger disposal of it with Oilpan. |
| + setPlugin(nullptr); |
| } |
| resetInstance(); |
| @@ -328,8 +319,8 @@ SharedPersistent<v8::Object>* HTMLPlugInElement::pluginWrapper() { |
| if (!m_pluginWrapper) { |
| FrameViewBase* plugin; |
| - if (m_persistedPluginWidget) |
| - plugin = m_persistedPluginWidget.get(); |
| + if (m_persistedPlugin) |
| + plugin = m_persistedPlugin.get(); |
| else |
| plugin = pluginWidget(); |
| @@ -430,7 +421,7 @@ bool HTMLPlugInElement::isPluginElement() const { |
| void HTMLPlugInElement::disconnectContentFrame() { |
| HTMLFrameOwnerElement::disconnectContentFrame(); |
| - setPersistedPluginWidget(nullptr); |
| + setPersistedPlugin(nullptr); |
| } |
| bool HTMLPlugInElement::layoutObjectIsFocusable() const { |
| @@ -524,17 +515,17 @@ bool HTMLPlugInElement::loadPlugin(const KURL& url, |
| VLOG(1) << "Loaded URL: " << url.getString(); |
| m_loadedUrl = url; |
| - if (m_persistedPluginWidget) { |
| - setWidget(m_persistedPluginWidget.release()); |
| + if (m_persistedPlugin) { |
| + setPlugin(m_persistedPlugin.release()); |
| } else { |
| bool loadManually = |
| document().isPluginDocument() && !document().containsPlugins(); |
| LocalFrameClient::DetachedPluginPolicy policy = |
| requireLayoutObject ? LocalFrameClient::FailOnDetachedPlugin |
| : LocalFrameClient::AllowDetachedPlugin; |
| - FrameViewBase* frameViewBase = frame->loader().client()->createPlugin( |
| + PluginView* plugin = frame->loader().client()->createPlugin( |
| this, url, paramNames, paramValues, mimeType, loadManually, policy); |
| - if (!frameViewBase) { |
| + if (!plugin) { |
| if (!layoutItem.isNull() && |
| !layoutItem.showsUnavailablePluginIndicator()) { |
| m_pluginIsAvailable = false; |
| @@ -544,9 +535,9 @@ bool HTMLPlugInElement::loadPlugin(const KURL& url, |
| } |
| if (!layoutItem.isNull()) |
| - setWidget(frameViewBase); |
| + setPlugin(plugin); |
| else |
| - setPersistedPluginWidget(frameViewBase); |
| + setPersistedPlugin(plugin); |
| } |
| document().setContainsPlugins(); |
| @@ -652,7 +643,7 @@ void HTMLPlugInElement::lazyReattachIfNeeded() { |
| if (!useFallbackContent() && needsPluginUpdate() && layoutObject() && |
| !isImageType()) { |
| lazyReattachIfAttached(); |
| - setPersistedPluginWidget(nullptr); |
| + setPersistedPlugin(nullptr); |
| } |
| } |