OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
| 6 #define CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/scoped_native_library.h" |
| 11 #include "base/scoped_ptr.h" |
| 12 #include "build/build_config.h" |
| 13 #include "chrome/common/child_thread.h" |
| 14 |
| 15 class FilePath; |
| 16 |
| 17 namespace IPC { |
| 18 class ChannelHandle; |
| 19 } |
| 20 |
| 21 namespace pp { |
| 22 namespace proxy { |
| 23 class PluginDispatcher; |
| 24 } |
| 25 } |
| 26 |
| 27 class PpapiThread : public ChildThread { |
| 28 public: |
| 29 PpapiThread(); |
| 30 ~PpapiThread(); |
| 31 |
| 32 private: |
| 33 // ChildThread overrides. |
| 34 virtual void OnMessageReceived(const IPC::Message& msg); |
| 35 |
| 36 // Message handlers. |
| 37 void OnLoadPlugin(const FilePath& path, int renderer_id); |
| 38 |
| 39 bool LoadPluginLib(const FilePath& path); |
| 40 |
| 41 // 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. |
| 43 bool SetupRendererChannel(int renderer_id, |
| 44 IPC::ChannelHandle* handle); |
| 45 |
| 46 #if defined(OS_POSIX) |
| 47 // 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 |
| 49 // copy of renderer_fd_. |
| 50 void CloseRendererFD(); |
| 51 #endif |
| 52 |
| 53 base::ScopedNativeLibrary library_; |
| 54 |
| 55 scoped_ptr<pp::proxy::PluginDispatcher> dispatcher_; |
| 56 |
| 57 #if defined(OS_POSIX) |
| 58 // 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 |
| 60 // access to its side of the socket. |
| 61 int renderer_fd_; |
| 62 #endif |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(PpapiThread); |
| 65 }; |
| 66 |
| 67 #endif // CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ |
OLD | NEW |