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

Unified Diff: ppapi/proxy/plugin_dispatcher.cc

Issue 6493004: Implement basic crash detection and shutdown handling for out of process PPAP... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | « ppapi/proxy/plugin_dispatcher.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/plugin_dispatcher.cc
===================================================================
--- ppapi/proxy/plugin_dispatcher.cc (revision 74766)
+++ ppapi/proxy/plugin_dispatcher.cc (working copy)
@@ -129,6 +129,8 @@
}
void PluginDispatcher::OnChannelError() {
+ Dispatcher::OnChannelError();
+
// The renderer has crashed. This channel and all instances associated with
// it are no longer valid.
ForceFreeAllInstances();
@@ -168,7 +170,7 @@
#if defined(OS_POSIX)
int PluginDispatcher::GetRendererFD() {
- if (renderer_fd_ == -1)
+ if (renderer_fd_ == -1 && channel())
renderer_fd_ = channel()->GetClientFileDescriptor();
return renderer_fd_;
}
@@ -183,7 +185,21 @@
#endif
void PluginDispatcher::ForceFreeAllInstances() {
- // TODO(brettw) implement freeing instances on crash.
+ if (!g_instance_to_dispatcher)
+ return;
+
+ // Iterating will remove each item from the map, so we need to make a copy
+ // to avoid things changing out from under is.
+ InstanceToDispatcherMap temp_map = *g_instance_to_dispatcher;
+ for (InstanceToDispatcherMap::iterator i = temp_map.begin();
+ i != temp_map.end(); ++i) {
+ if (i->second == this) {
+ // Synthesize an "instance destroyed" message, this will notify the
+ // plugin and also remove it from our list of tracked plugins.
+ OnMessageReceived(
+ PpapiMsg_PPPInstance_DidDestroy(INTERFACE_ID_PPP_INSTANCE, i->first));
+ }
+ }
}
void PluginDispatcher::OnMsgSupportsInterface(
« no previous file with comments | « ppapi/proxy/plugin_dispatcher.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698