OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/native_library.h" | 13 #include "base/native_library.h" |
14 #include "base/process.h" | 14 #include "base/process.h" |
15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
17 #include "base/weak_ptr.h" | 17 #include "base/weak_ptr.h" |
| 18 #include "ppapi/c/pp_bool.h" |
| 19 #include "ppapi/c/pp_instance.h" |
18 #include "ppapi/c/pp_module.h" | 20 #include "ppapi/c/pp_module.h" |
19 #include "ppapi/c/ppb.h" | 21 #include "ppapi/c/ppb.h" |
20 #include "webkit/plugins/ppapi/plugin_delegate.h" | 22 #include "webkit/plugins/ppapi/plugin_delegate.h" |
21 | 23 |
22 class FilePath; | 24 class FilePath; |
23 class MessageLoop; | 25 class MessageLoop; |
24 struct PPB_Core; | 26 struct PPB_Core; |
25 typedef void* NPIdentifier; | 27 typedef void* NPIdentifier; |
26 | 28 |
27 namespace base { | 29 namespace base { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // releases us in its destructor. | 121 // releases us in its destructor. |
120 void InstanceCreated(PluginInstance* instance); | 122 void InstanceCreated(PluginInstance* instance); |
121 void InstanceDeleted(PluginInstance* instance); | 123 void InstanceDeleted(PluginInstance* instance); |
122 | 124 |
123 scoped_refptr<CallbackTracker> GetCallbackTracker(); | 125 scoped_refptr<CallbackTracker> GetCallbackTracker(); |
124 | 126 |
125 // Called when running out of process and the plugin crashed. This will | 127 // Called when running out of process and the plugin crashed. This will |
126 // release relevant resources and update all affected instances. | 128 // release relevant resources and update all affected instances. |
127 void PluginCrashed(); | 129 void PluginCrashed(); |
128 | 130 |
| 131 // Reserves the given instance is unique within the plugin, checking for |
| 132 // collisions. See PPB_Proxy_Private for more information. |
| 133 // |
| 134 // The setter will set the callback which is set up when the proxy |
| 135 // initializes. The Reserve function will call the previously set callback if |
| 136 // it exists to validate the ID. If the callback has not been set (such as |
| 137 // for in-process plugins), the Reserve function will assume that the ID is |
| 138 // usable and will return true. |
| 139 void SetReserveInstanceIDCallback( |
| 140 PP_Bool (*reserve)(PP_Module, PP_Instance)); |
| 141 bool ReserveInstanceID(PP_Instance instance); |
| 142 |
129 private: | 143 private: |
130 // Calls the InitializeModule entrypoint. The entrypoint must have been | 144 // Calls the InitializeModule entrypoint. The entrypoint must have been |
131 // set and the plugin must not be out of process (we don't maintain | 145 // set and the plugin must not be out of process (we don't maintain |
132 // entrypoints in that case). | 146 // entrypoints in that case). |
133 bool InitializeModule(); | 147 bool InitializeModule(); |
134 | 148 |
135 PluginDelegate::ModuleLifetime* lifetime_delegate_; | 149 PluginDelegate::ModuleLifetime* lifetime_delegate_; |
136 | 150 |
137 // Tracker for completion callbacks, used mainly to ensure that all callbacks | 151 // Tracker for completion callbacks, used mainly to ensure that all callbacks |
138 // are properly aborted on module shutdown. | 152 // are properly aborted on module shutdown. |
(...skipping 21 matching lines...) Expand all Loading... |
160 EntryPoints entry_points_; | 174 EntryPoints entry_points_; |
161 | 175 |
162 // The name of the module. | 176 // The name of the module. |
163 const std::string name_; | 177 const std::string name_; |
164 | 178 |
165 // Non-owning pointers to all instances associated with this module. When | 179 // Non-owning pointers to all instances associated with this module. When |
166 // there are no more instances, this object should be deleted. | 180 // there are no more instances, this object should be deleted. |
167 typedef std::set<PluginInstance*> PluginInstanceSet; | 181 typedef std::set<PluginInstance*> PluginInstanceSet; |
168 PluginInstanceSet instances_; | 182 PluginInstanceSet instances_; |
169 | 183 |
| 184 PP_Bool (*reserve_instance_id_)(PP_Module, PP_Instance); |
| 185 |
170 DISALLOW_COPY_AND_ASSIGN(PluginModule); | 186 DISALLOW_COPY_AND_ASSIGN(PluginModule); |
171 }; | 187 }; |
172 | 188 |
173 } // namespace ppapi | 189 } // namespace ppapi |
174 } // namespace webkit | 190 } // namespace webkit |
175 | 191 |
176 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ | 192 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ |
OLD | NEW |