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

Unified Diff: chrome/browser/ppapi_plugin_process_host.h

Issue 6486034: Share PPAPI out-of-process plugins between renderer processes.... (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 | « chrome/browser/plugin_service_browsertest.cc ('k') | chrome/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ppapi_plugin_process_host.h
===================================================================
--- chrome/browser/ppapi_plugin_process_host.h (revision 74733)
+++ chrome/browser/ppapi_plugin_process_host.h (working copy)
@@ -6,20 +6,48 @@
#define CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
#pragma once
+#include <queue>
+
#include "base/basictypes.h"
#include "base/file_path.h"
#include "chrome/browser/browser_child_process_host.h"
-class RenderMessageFilter;
-
class PpapiPluginProcessHost : public BrowserChildProcessHost {
public:
- explicit PpapiPluginProcessHost(RenderMessageFilter* filter);
+ class Client {
+ public:
+ // Gets the information about the renderer that's requesting the channel.
+ virtual void GetChannelInfo(base::ProcessHandle* renderer_handle,
+ int* renderer_id) = 0;
+
+ // Called when the channel is asynchronously opened to the plugin or on
+ // error. On error, the parameters should be:
+ // base::kNullProcessHandle
+ // IPC::ChannelHandle()
+ virtual void OnChannelOpened(base::ProcessHandle plugin_process_handle,
+ const IPC::ChannelHandle& channel_handle) = 0;
+ };
+
+ // You must call init before doing anything else.
+ explicit PpapiPluginProcessHost();
virtual ~PpapiPluginProcessHost();
- void Init(const FilePath& path, IPC::Message* reply_msg);
+ // Actually launches the process with the given plugin path. Returns true
+ // on success (the process was spawned).
+ bool Init(const FilePath& path);
+ // Opens a new channel to the plugin. The client will be notified when the
+ // channel is ready or if there's an error.
+ void OpenChannelToPlugin(Client* client);
+
+ const FilePath& plugin_path() const { return plugin_path_; }
+
+ // The client pointer must remain valid until its callback is issued.
+
private:
+
+ void RequestPluginChannel(Client* client);
+
virtual bool CanShutdown();
virtual void OnProcessLaunched();
@@ -27,22 +55,22 @@
virtual void OnChannelConnected(int32 peer_pid);
virtual void OnChannelError();
+ void CancelRequests();
+
// IPC message handlers.
- void OnPluginLoaded(const IPC::ChannelHandle& handle);
+ void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle);
- // Sends the reply_msg_ to the renderer with the given channel info.
- void ReplyToRenderer(base::ProcessHandle plugin_handle,
- const IPC::ChannelHandle& channel_handle);
+ // Channel requests that we are waiting to send to the plugin process once
+ // the channel is opened.
+ std::vector<Client*> pending_requests_;
- RenderMessageFilter* filter_;
+ // Channel requests that we have already sent to the plugin process, but
+ // haven't heard back about yet.
+ std::queue<Client*> sent_requests_;
// Path to the plugin library.
FilePath plugin_path_;
- // When we're waiting for initialization of the plugin, this contains the
- // reply message for the renderer to tell it that it can continue.
- scoped_ptr<IPC::Message> reply_msg_;
-
DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost);
};
« no previous file with comments | « chrome/browser/plugin_service_browsertest.cc ('k') | chrome/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698