Implement basic crash detection and shutdown handling for out of process PPAPI
plugins.

Currently when a crash is detected we just delete as much stuff as is
convenient, clear the plugin's backing store, and continue running. It does not
hook up a sad plugin page yet.

This adds a "proxy" interface for the proxy to tell the PPAPI backend
implementation in the renderer about proxy-related stuff (like the plugin
crashing).

This also implements keeping the process alive for a period of time so we can
re-use the same process.
Review URL: http://codereview.chromium.org/6493004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74965 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/dispatcher.h b/ppapi/proxy/dispatcher.h
index b3b520d..82c0f31 100644
--- a/ppapi/proxy/dispatcher.h
+++ b/ppapi/proxy/dispatcher.h
@@ -59,7 +59,7 @@
   typedef int32_t (*InitModuleFunc)(PP_Module, GetInterfaceFunc);
   typedef void (*ShutdownModuleFunc)();
 
-  ~Dispatcher();
+  virtual ~Dispatcher();
 
   // You must call this function before anything else. Returns true on success.
   bool InitWithChannel(MessageLoop* ipc_message_loop,
@@ -79,9 +79,6 @@
   VarSerializationRules* serialization_rules() const {
     return serialization_rules_.get();
   }
-  PP_Module pp_module() const {
-    return pp_module_;
-  }
 
   // Wrapper for calling the local GetInterface function.
   const void* GetLocalInterface(const char* interface);
@@ -103,8 +100,9 @@
 
   // IPC::Channel::Listener implementation.
   virtual bool OnMessageReceived(const IPC::Message& msg);
+  virtual void OnChannelError();
 
-  // Will be NULL in some unit tests.
+  // Will be NULL in some unit tests and if the remote side has crashed.
   IPC::SyncChannel* channel() const {
     return channel_.get();
   }
@@ -132,19 +130,11 @@
   // Takes ownership of the given pointer, which must be on the heap.
   void SetSerializationRules(VarSerializationRules* var_serialization_rules);
 
-  void set_pp_module(PP_Module module) {
-    pp_module_ = module;
-  }
-
   bool disallow_trusted_interfaces() const {
     return disallow_trusted_interfaces_;
   }
 
  private:
-  // Set by the derived classed to indicate the module ID corresponding to
-  // this dispatcher.
-  PP_Module pp_module_;
-
   base::ProcessHandle remote_process_handle_;  // See getter above.
 
   // When we're unit testing, this will indicate the sink for the messages to
@@ -152,7 +142,8 @@
   // indicates that the channel should not be used.
   IPC::TestSink* test_sink_;
 
-  // Will be null for some tests when there is a test_sink_.
+  // Will be null for some tests when there is a test_sink_, and if the
+  // remote side has crashed.
   scoped_ptr<IPC::SyncChannel> channel_;
 
   bool disallow_trusted_interfaces_;