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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ 5 #ifndef CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
6 #define CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ 6 #define CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <queue>
10
9 #include "base/basictypes.h" 11 #include "base/basictypes.h"
10 #include "base/file_path.h" 12 #include "base/file_path.h"
11 #include "chrome/browser/browser_child_process_host.h" 13 #include "chrome/browser/browser_child_process_host.h"
12 14
13 class RenderMessageFilter;
14
15 class PpapiPluginProcessHost : public BrowserChildProcessHost { 15 class PpapiPluginProcessHost : public BrowserChildProcessHost {
16 public: 16 public:
17 explicit PpapiPluginProcessHost(RenderMessageFilter* filter); 17 class Client {
18 public:
19 // Gets the information about the renderer that's requesting the channel.
20 virtual void GetChannelInfo(base::ProcessHandle* renderer_handle,
21 int* renderer_id) = 0;
22
23 // Called when the channel is asynchronously opened to the plugin or on
24 // error. On error, the parameters should be:
25 // base::kNullProcessHandle
26 // IPC::ChannelHandle()
27 virtual void OnChannelOpened(base::ProcessHandle plugin_process_handle,
28 const IPC::ChannelHandle& channel_handle) = 0;
29 };
30
31 // You must call init before doing anything else.
32 explicit PpapiPluginProcessHost();
18 virtual ~PpapiPluginProcessHost(); 33 virtual ~PpapiPluginProcessHost();
19 34
20 void Init(const FilePath& path, IPC::Message* reply_msg); 35 // Actually launches the process with the given plugin path. Returns true
36 // on success (the process was spawned).
37 bool Init(const FilePath& path);
38
39 // Opens a new channel to the plugin. The client will be notified when the
40 // channel is ready or if there's an error.
41 void OpenChannelToPlugin(Client* client);
42
43 const FilePath& plugin_path() const { return plugin_path_; }
44
45 // The client pointer must remain valid until its callback is issued.
21 46
22 private: 47 private:
48
49 void RequestPluginChannel(Client* client);
50
23 virtual bool CanShutdown(); 51 virtual bool CanShutdown();
24 virtual void OnProcessLaunched(); 52 virtual void OnProcessLaunched();
25 53
26 virtual bool OnMessageReceived(const IPC::Message& msg); 54 virtual bool OnMessageReceived(const IPC::Message& msg);
27 virtual void OnChannelConnected(int32 peer_pid); 55 virtual void OnChannelConnected(int32 peer_pid);
28 virtual void OnChannelError(); 56 virtual void OnChannelError();
29 57
58 void CancelRequests();
59
30 // IPC message handlers. 60 // IPC message handlers.
31 void OnPluginLoaded(const IPC::ChannelHandle& handle); 61 void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle);
32 62
33 // Sends the reply_msg_ to the renderer with the given channel info. 63 // Channel requests that we are waiting to send to the plugin process once
34 void ReplyToRenderer(base::ProcessHandle plugin_handle, 64 // the channel is opened.
35 const IPC::ChannelHandle& channel_handle); 65 std::vector<Client*> pending_requests_;
36 66
37 RenderMessageFilter* filter_; 67 // Channel requests that we have already sent to the plugin process, but
68 // haven't heard back about yet.
69 std::queue<Client*> sent_requests_;
38 70
39 // Path to the plugin library. 71 // Path to the plugin library.
40 FilePath plugin_path_; 72 FilePath plugin_path_;
41 73
42 // When we're waiting for initialization of the plugin, this contains the
43 // reply message for the renderer to tell it that it can continue.
44 scoped_ptr<IPC::Message> reply_msg_;
45
46 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost); 74 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost);
47 }; 75 };
48 76
49 #endif // CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ 77 #endif // CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
50 78
OLDNEW
« 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