| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PLUGIN_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
| 6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // resource. Guaranteed non-NULL. | 156 // resource. Guaranteed non-NULL. |
| 157 thunk::PPB_Instance_API* GetInstanceAPI(); | 157 thunk::PPB_Instance_API* GetInstanceAPI(); |
| 158 thunk::ResourceCreationAPI* GetResourceCreationAPI(); | 158 thunk::ResourceCreationAPI* GetResourceCreationAPI(); |
| 159 | 159 |
| 160 // Returns the Preferences. | 160 // Returns the Preferences. |
| 161 const Preferences& preferences() const { return preferences_; } | 161 const Preferences& preferences() const { return preferences_; } |
| 162 | 162 |
| 163 uint32 plugin_dispatcher_id() const { return plugin_dispatcher_id_; } | 163 uint32 plugin_dispatcher_id() const { return plugin_dispatcher_id_; } |
| 164 bool incognito() const { return incognito_; } | 164 bool incognito() const { return incognito_; } |
| 165 | 165 |
| 166 // Dispatches the given resource message to the appropriate resource in the | |
| 167 // plugin process. This should be wired to the various channels that messages | |
| 168 // come in from various other processes. | |
| 169 static void DispatchResourceReply( | |
| 170 const ppapi::proxy::ResourceMessageReplyParams& reply_params, | |
| 171 const IPC::Message& nested_msg); | |
| 172 | |
| 173 private: | 166 private: |
| 174 friend class PluginDispatcherTest; | 167 friend class PluginDispatcherTest; |
| 175 | 168 |
| 176 // Notifies all live instances that they're now closed. This is used when | 169 // Notifies all live instances that they're now closed. This is used when |
| 177 // a renderer crashes or some other error is received. | 170 // a renderer crashes or some other error is received. |
| 178 void ForceFreeAllInstances(); | 171 void ForceFreeAllInstances(); |
| 179 | 172 |
| 180 // IPC message handlers. | 173 // IPC message handlers. |
| 181 void OnMsgResourceReply( | |
| 182 const ppapi::proxy::ResourceMessageReplyParams& reply_params, | |
| 183 const IPC::Message& nested_msg); | |
| 184 void OnMsgSupportsInterface(const std::string& interface_name, bool* result); | 174 void OnMsgSupportsInterface(const std::string& interface_name, bool* result); |
| 185 void OnMsgSetPreferences(const Preferences& prefs); | 175 void OnMsgSetPreferences(const Preferences& prefs); |
| 186 | 176 |
| 187 // Internal backed for DispatchResourceReply. | |
| 188 static void LockedDispatchResourceReply( | |
| 189 const ppapi::proxy::ResourceMessageReplyParams& reply_params, | |
| 190 const IPC::Message& nested_msg); | |
| 191 | |
| 192 virtual bool SendMessage(IPC::Message* msg); | 177 virtual bool SendMessage(IPC::Message* msg); |
| 193 | 178 |
| 194 PluginDelegate* plugin_delegate_; | 179 PluginDelegate* plugin_delegate_; |
| 195 | 180 |
| 196 // Contains all the plugin interfaces we've queried. The mapped value will | 181 // Contains all the plugin interfaces we've queried. The mapped value will |
| 197 // be the pointer to the interface pointer supplied by the plugin if it's | 182 // be the pointer to the interface pointer supplied by the plugin if it's |
| 198 // supported, or NULL if it's not supported. This allows us to cache failures | 183 // supported, or NULL if it's not supported. This allows us to cache failures |
| 199 // and not req-query if a plugin doesn't support the interface. | 184 // and not req-query if a plugin doesn't support the interface. |
| 200 typedef base::hash_map<std::string, const void*> InterfaceMap; | 185 typedef base::hash_map<std::string, const void*> InterfaceMap; |
| 201 InterfaceMap plugin_interfaces_; | 186 InterfaceMap plugin_interfaces_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 217 // A filter for sending messages from threads other than the main thread. | 202 // A filter for sending messages from threads other than the main thread. |
| 218 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; | 203 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; |
| 219 | 204 |
| 220 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); | 205 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); |
| 221 }; | 206 }; |
| 222 | 207 |
| 223 } // namespace proxy | 208 } // namespace proxy |
| 224 } // namespace ppapi | 209 } // namespace ppapi |
| 225 | 210 |
| 226 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 211 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
| OLD | NEW |