OLD | NEW |
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_PPAPI_PLUGIN_PPAPI_THREAD_H_ | 5 #ifndef CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
6 #define CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ | 6 #define CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/process.h" |
10 #include "base/scoped_native_library.h" | 11 #include "base/scoped_native_library.h" |
11 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
13 #include "chrome/common/child_thread.h" | 14 #include "chrome/common/child_thread.h" |
14 | 15 |
15 class FilePath; | 16 class FilePath; |
16 | 17 |
17 namespace IPC { | 18 namespace IPC { |
18 struct ChannelHandle; | 19 struct ChannelHandle; |
19 } | 20 } |
20 | 21 |
21 namespace pp { | 22 namespace pp { |
22 namespace proxy { | 23 namespace proxy { |
23 class PluginDispatcher; | 24 class PluginDispatcher; |
24 } | 25 } |
25 } | 26 } |
26 | 27 |
27 class PpapiThread : public ChildThread { | 28 class PpapiThread : public ChildThread { |
28 public: | 29 public: |
29 PpapiThread(); | 30 PpapiThread(); |
30 ~PpapiThread(); | 31 ~PpapiThread(); |
31 | 32 |
32 private: | 33 private: |
33 // ChildThread overrides. | 34 // ChildThread overrides. |
34 virtual void OnMessageReceived(const IPC::Message& msg); | 35 virtual void OnMessageReceived(const IPC::Message& msg); |
35 | 36 |
36 // Message handlers. | 37 // Message handlers. |
37 void OnLoadPlugin(const FilePath& path, int renderer_id); | 38 void OnLoadPlugin(base::ProcessHandle renderer_handle, |
| 39 const FilePath& path, |
| 40 int renderer_id); |
38 | 41 |
39 bool LoadPluginLib(const FilePath& path); | 42 bool LoadPluginLib(base::ProcessHandle host_process_handle, |
| 43 const FilePath& path); |
40 | 44 |
41 // Sets up the channel to the given renderer. On success, returns true and | 45 // Sets up the channel to the given renderer. On success, returns true and |
42 // fills the given ChannelHandle with the information from the new channel. | 46 // fills the given ChannelHandle with the information from the new channel. |
43 bool SetupRendererChannel(int renderer_id, | 47 bool SetupRendererChannel(int renderer_id, |
44 IPC::ChannelHandle* handle); | 48 IPC::ChannelHandle* handle); |
45 | 49 |
46 #if defined(OS_POSIX) | 50 #if defined(OS_POSIX) |
47 // Close the plugin process' copy of the renderer's side of the plugin | 51 // Close the plugin process' copy of the renderer's side of the plugin |
48 // channel. This can be called after the renderer is known to have its own | 52 // channel. This can be called after the renderer is known to have its own |
49 // copy of renderer_fd_. | 53 // copy of renderer_fd_. |
50 void CloseRendererFD(); | 54 void CloseRendererFD(); |
51 #endif | 55 #endif |
52 | 56 |
53 base::ScopedNativeLibrary library_; | 57 base::ScopedNativeLibrary library_; |
54 | 58 |
55 scoped_ptr<pp::proxy::PluginDispatcher> dispatcher_; | 59 scoped_ptr<pp::proxy::PluginDispatcher> dispatcher_; |
56 | 60 |
57 #if defined(OS_POSIX) | 61 #if defined(OS_POSIX) |
58 // FD for the renderer end of the socket. It is closed when the IPC layer | 62 // FD for the renderer end of the socket. It is closed when the IPC layer |
59 // indicates that the channel is connected, proving that the renderer has | 63 // indicates that the channel is connected, proving that the renderer has |
60 // access to its side of the socket. | 64 // access to its side of the socket. |
61 int renderer_fd_; | 65 int renderer_fd_; |
62 #endif | 66 #endif |
63 | 67 |
64 DISALLOW_COPY_AND_ASSIGN(PpapiThread); | 68 DISALLOW_COPY_AND_ASSIGN(PpapiThread); |
65 }; | 69 }; |
66 | 70 |
67 #endif // CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ | 71 #endif // CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
OLD | NEW |