summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 20:38:20 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 20:38:20 +0000
commitfb0372963fa9860d6be99c6cf26b5dcb4d992c53 (patch)
tree28588ad72c0b8880f05f1a58be9919be360ed551 /content
parent07dc0ec34909ca945706d04c2bea092ba36b2aed (diff)
downloadchromium_src-fb0372963fa9860d6be99c6cf26b5dcb4d992c53.zip
chromium_src-fb0372963fa9860d6be99c6cf26b5dcb4d992c53.tar.gz
chromium_src-fb0372963fa9860d6be99c6cf26b5dcb4d992c53.tar.bz2
Terminate plugins as well as runing onunload handlers during slow shutdown.
This implementation uses the existing OnDestruct method. This is called in a state where webkit is still intact, so any callbacks by the plugin should still function properly. BUG=https://code.google.com/p/flapper/issues/detail?id=120 Review URL: https://chromiumcodereview.appspot.com/10383059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135901 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.cc13
-rw-r--r--content/renderer/render_view_impl.cc2
2 files changed, 12 insertions, 3 deletions
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index 95085f5..7929fb5 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -1408,9 +1408,16 @@ bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) {
}
void PepperPluginDelegateImpl::OnDestruct() {
- // Nothing to do here. Default implementation in RenderViewObserver does
- // 'delete this' but it's not suitable for PepperPluginDelegateImpl because
- // it's non-pointer member in RenderViewImpl.
+ // This method may be called as part of an abbreviated shutdown by
+ // RenderViewImpl::OnShouldClose() as well as part of a full cleanup.
+ // Default implementation in RenderViewObserver does 'delete this' but it's
+ // not suitable for PepperPluginDelegateImpl because it's non-pointer member
+ // in RenderViewImpl.
+ while (active_instances_.begin() != active_instances_.end()) {
+ webkit::ppapi::PluginInstance* instance = *active_instances_.begin();
+ instance->Delete();
+ active_instances_.erase(instance);
+ }
}
void PepperPluginDelegateImpl::OnTCPSocketConnectACK(
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 1f77c90..bdfed70 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -4470,6 +4470,8 @@ void RenderViewImpl::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
void RenderViewImpl::OnShouldClose() {
base::TimeTicks before_unload_start_time = base::TimeTicks::Now();
bool should_close = webview()->dispatchBeforeUnloadEvent();
+ if (should_close)
+ pepper_delegate_.OnDestruct();
base::TimeTicks before_unload_end_time = base::TimeTicks::Now();
Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close,
before_unload_start_time,