summaryrefslogtreecommitdiffstats
path: root/content/ppapi_plugin/ppapi_thread.h
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-28 01:54:18 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-28 01:54:18 +0000
commit9791a4c84e78fb72e203d45a317504f2b0ebbaf5 (patch)
tree7854f31dc3ca35865bba2677c4a2eac4e0baa985 /content/ppapi_plugin/ppapi_thread.h
parent0548bbf99d20961885b23d9f2f631bc4c5a5a59d (diff)
downloadchromium_src-9791a4c84e78fb72e203d45a317504f2b0ebbaf5.zip
chromium_src-9791a4c84e78fb72e203d45a317504f2b0ebbaf5.tar.gz
chromium_src-9791a4c84e78fb72e203d45a317504f2b0ebbaf5.tar.bz2
PpapiThread should handle child process messages.
The current code overrides ChildThread::OnMessageReceived(), but doesn't handle child process messages. One consequence is that we ignore the browser message to shut down ppapi processes. With this CL, a ppapi process should be shut down when the plugin is not used by any tab for 30 seconds. BUG=None TEST=None Review URL: https://chromiumcodereview.appspot.com/11633051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174718 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/ppapi_plugin/ppapi_thread.h')
-rw-r--r--content/ppapi_plugin/ppapi_thread.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h
index 6d5bb16..b6f84a8 100644
--- a/content/ppapi_plugin/ppapi_thread.h
+++ b/content/ppapi_plugin/ppapi_thread.h
@@ -15,6 +15,7 @@
#include "base/scoped_native_library.h"
#include "build/build_config.h"
#include "content/common/child_thread.h"
+#include "ipc/ipc_listener.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/trusted/ppp_broker.h"
#include "ppapi/proxy/plugin_dispatcher.h"
@@ -45,9 +46,25 @@ class PpapiThread : public ChildThread,
virtual ~PpapiThread();
private:
+ // This class finds the target PluginDispatcher for each message it receives
+ // and forwards the message.
+ class DispatcherMessageListener : public IPC::Listener {
+ public:
+ explicit DispatcherMessageListener(PpapiThread* owner);
+ virtual ~DispatcherMessageListener();
+
+ // IPC::Listener implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
+
+ private:
+ PpapiThread* owner_;
+
+ DISALLOW_COPY_AND_ASSIGN(DispatcherMessageListener);
+ };
+
// ChildThread overrides.
virtual bool Send(IPC::Message* msg) OVERRIDE;
- virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
+ virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE;
virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
// PluginDispatcher::PluginDelegate implementation.
@@ -79,7 +96,6 @@ class PpapiThread : public ChildThread,
const ppapi::proxy::ResourceMessageReplyParams& reply_params,
const IPC::Message& nested_msg);
void OnMsgSetNetworkState(bool online);
- void OnPluginDispatcherMessageReceived(const IPC::Message& msg);
// Sets up the channel to the given renderer. On success, returns true and
// fills the given ChannelHandle with the information from the new channel.
@@ -130,6 +146,8 @@ class PpapiThread : public ChildThread,
base::win::ScopedHandle peer_handle_;
#endif
+ DispatcherMessageListener dispatcher_message_listener_;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread);
};