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 PPAPI_PROXY_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_DISPATCHER_H_ |
6 #define PPAPI_PROXY_DISPATCHER_H_ | 6 #define PPAPI_PROXY_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/linked_ptr.h" | 12 #include "base/linked_ptr.h" |
13 #include "base/process.h" | 13 #include "base/process.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "ipc/ipc_channel.h" | 15 #include "ipc/ipc_channel.h" |
16 #include "ipc/ipc_channel_handle.h" | 16 #include "ipc/ipc_channel_handle.h" |
17 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
18 #include "ipc/ipc_platform_file.h" | |
18 #include "ppapi/c/pp_module.h" | 19 #include "ppapi/c/pp_module.h" |
19 #include "ppapi/proxy/callback_tracker.h" | 20 #include "ppapi/proxy/callback_tracker.h" |
20 #include "ppapi/proxy/interface_id.h" | 21 #include "ppapi/proxy/interface_id.h" |
21 #include "ppapi/proxy/interface_proxy.h" | 22 #include "ppapi/proxy/interface_proxy.h" |
22 #include "ppapi/proxy/plugin_var_tracker.h" | 23 #include "ppapi/proxy/plugin_var_tracker.h" |
23 | 24 |
24 class MessageLoop; | 25 class MessageLoop; |
25 struct PPB_Var_Deprecated; | 26 struct PPB_Var_Deprecated; |
26 | 27 |
27 namespace base { | 28 namespace base { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 // browser side. | 77 // browser side. |
77 virtual bool IsPlugin() const = 0; | 78 virtual bool IsPlugin() const = 0; |
78 | 79 |
79 VarSerializationRules* serialization_rules() const { | 80 VarSerializationRules* serialization_rules() const { |
80 return serialization_rules_.get(); | 81 return serialization_rules_.get(); |
81 } | 82 } |
82 | 83 |
83 // Wrapper for calling the local GetInterface function. | 84 // Wrapper for calling the local GetInterface function. |
84 const void* GetLocalInterface(const char* interface); | 85 const void* GetLocalInterface(const char* interface); |
85 | 86 |
86 // Returns the remote process' handle. For the host dispatcher, this will be | 87 // Shares a file handle (HANDLE / file descriptor) with the remote side. It |
87 // the plugin process, and for the plugin dispatcher, this will be the | 88 // returns a handle that should be sent in exactly one IPC message. Upon |
88 // renderer process. This is used for sharing memory and such and is | 89 // receipt, the remote side then owns that handle. Note: if sending the |
89 // guaranteed valid (unless the remote process has suddenly died). | 90 // message fails, the returned handle is properly closed by the IPC system. If |
90 base::ProcessHandle remote_process_handle() const { | 91 // close is set to true, the original handle is closed by this operation and |
91 return remote_process_handle_; | 92 // should not be used again. |
92 } | 93 IPC::PlatformFileForTransit ShareHandleWithRemote( |
94 base::PlatformFile handle, | |
95 bool close); | |
viettrungluu
2011/02/25 01:25:03
Let's call that parameter |should_close_handle|.
| |
93 | 96 |
94 // Called if the remote side is declaring to us which interfaces it supports | 97 // Called if the remote side is declaring to us which interfaces it supports |
95 // so we don't have to query for each one. We'll pre-create proxies for | 98 // so we don't have to query for each one. We'll pre-create proxies for |
96 // each of the given interfaces. | 99 // each of the given interfaces. |
97 | 100 |
98 // IPC::Message::Sender implementation. | 101 // IPC::Message::Sender implementation. |
99 virtual bool Send(IPC::Message* msg); | 102 virtual bool Send(IPC::Message* msg); |
100 | 103 |
101 // IPC::Channel::Listener implementation. | 104 // IPC::Channel::Listener implementation. |
102 virtual bool OnMessageReceived(const IPC::Message& msg); | 105 virtual bool OnMessageReceived(const IPC::Message& msg); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 | 157 |
155 scoped_ptr<VarSerializationRules> serialization_rules_; | 158 scoped_ptr<VarSerializationRules> serialization_rules_; |
156 | 159 |
157 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 160 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
158 }; | 161 }; |
159 | 162 |
160 } // namespace proxy | 163 } // namespace proxy |
161 } // namespace pp | 164 } // namespace pp |
162 | 165 |
163 #endif // PPAPI_PROXY_DISPATCHER_H_ | 166 #endif // PPAPI_PROXY_DISPATCHER_H_ |
OLD | NEW |