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

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

Issue 1442643003: Oilpan: move WebPluginLoadObserver to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: provide clearPluginContainer() w/ non-Oilpan only Created 5 years, 1 month 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
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 72629f332e487324fae1cc8a508400a567b45c9e..60ab35cf439ce584894150ffa595f198ca372518 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
@@ -497,9 +497,10 @@ void WebPluginContainerImpl::loadFrameRequest(const WebURLRequest& request, cons
// FIXME: This is a bit of hack to allow us to observe completion of
// our frame request. It would be better to evolve FrameLoader to
// support a completion callback instead.
- OwnPtr<WebPluginLoadObserver> observer = adoptPtr(new WebPluginLoadObserver(this, request.url(), notifyData));
- // FIXME: Calling get here is dangerous! What if observer is freed?
+ OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = WebPluginLoadObserver::create(this, request.url(), notifyData);
+#if !ENABLE(OILPAN)
m_pluginLoadObservers.append(observer.get());
+#endif
WebDataSourceImpl::setNextPluginLoadObserver(observer.release());
}
@@ -679,6 +680,7 @@ bool WebPluginContainerImpl::wantsWheelEvents()
return m_wantsWheelEvents;
}
+#if !ENABLE(OILPAN)
void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver* observer)
{
size_t pos = m_pluginLoadObservers.find(observer);
@@ -686,6 +688,7 @@ void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver
return;
m_pluginLoadObservers.remove(pos);
}
+#endif
// Private methods -------------------------------------------------------------
@@ -722,21 +725,25 @@ void WebPluginContainerImpl::dispose()
if (m_element && m_touchEventRequestType != TouchEventRequestTypeNone && m_element->document().frameHost())
m_element->document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*m_element, EventHandlerRegistry::TouchEvent);
- for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i)
- m_pluginLoadObservers[i]->clearPluginContainer();
+#if !ENABLE(OILPAN)
+ for (const auto& observer : m_pluginLoadObservers)
+ observer->clearPluginContainer();
+#endif
if (m_webPlugin) {
RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() == this);
m_webPlugin->destroy();
+ m_webPlugin = nullptr;
}
- m_webPlugin = nullptr;
if (m_webLayer) {
GraphicsLayer::unregisterContentsLayer(m_webLayer);
m_webLayer = nullptr;
}
+#if !ENABLE(OILPAN)
m_pluginLoadObservers.clear();
+#endif
m_element = nullptr;
}
« no previous file with comments | « third_party/WebKit/Source/web/WebPluginContainerImpl.h ('k') | third_party/WebKit/Source/web/WebPluginLoadObserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698