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_HOST_GLOBALS_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "ppapi/shared_impl/ppapi_globals.h" | 9 #include "ppapi/shared_impl/ppapi_globals.h" |
10 #include "ppapi/shared_impl/var_tracker.h" | 10 #include "ppapi/shared_impl/var_tracker.h" |
11 #include "webkit/plugins/ppapi/host_resource_tracker.h" | 11 #include "webkit/plugins/ppapi/host_resource_tracker.h" |
12 #include "webkit/plugins/ppapi/host_var_tracker.h" | 12 #include "webkit/plugins/ppapi/host_var_tracker.h" |
| 13 #include "webkit/plugins/webkit_plugins_export.h" |
13 | 14 |
14 namespace webkit { | 15 namespace webkit { |
15 namespace ppapi { | 16 namespace ppapi { |
16 | 17 |
17 class PluginInstance; | 18 class PluginInstance; |
18 class PluginModule; | 19 class PluginModule; |
19 | 20 |
20 class HostGlobals : public ::ppapi::PpapiGlobals { | 21 class HostGlobals : public ::ppapi::PpapiGlobals { |
21 public: | 22 public: |
22 HostGlobals(); | 23 HostGlobals(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 65 |
65 // Called when a plugin instance was deleted and should no longer be tracked. | 66 // Called when a plugin instance was deleted and should no longer be tracked. |
66 // The given handle should be one generated by AddInstance. | 67 // The given handle should be one generated by AddInstance. |
67 void InstanceDeleted(PP_Instance instance); | 68 void InstanceDeleted(PP_Instance instance); |
68 | 69 |
69 void InstanceCrashed(PP_Instance instance); | 70 void InstanceCrashed(PP_Instance instance); |
70 | 71 |
71 // Returns a pointer to the plugin instance object associated with the given | 72 // Returns a pointer to the plugin instance object associated with the given |
72 // instance handle. The return value will be NULL if the handle is invalid or | 73 // instance handle. The return value will be NULL if the handle is invalid or |
73 // if the instance has crashed. | 74 // if the instance has crashed. |
74 PluginInstance* GetInstance(PP_Instance instance); | 75 WEBKIT_PLUGINS_EXPORT PluginInstance* GetInstance(PP_Instance instance); |
75 | 76 |
76 private: | 77 private: |
77 // Per-instance data we track. | 78 // Per-instance data we track. |
78 struct InstanceData; | 79 struct InstanceData; |
79 | 80 |
80 static HostGlobals* host_globals_; | 81 WEBKIT_PLUGINS_EXPORT static HostGlobals* host_globals_; |
81 | 82 |
82 HostResourceTracker host_resource_tracker_; | 83 HostResourceTracker host_resource_tracker_; |
83 HostVarTracker host_var_tracker_; | 84 HostVarTracker host_var_tracker_; |
84 | 85 |
85 // Tracks all live instances and their associated data. | 86 // Tracks all live instances and their associated data. |
86 typedef std::map<PP_Instance, linked_ptr<InstanceData> > InstanceMap; | 87 typedef std::map<PP_Instance, linked_ptr<InstanceData> > InstanceMap; |
87 InstanceMap instance_map_; | 88 InstanceMap instance_map_; |
88 | 89 |
89 // Tracks all live modules. The pointers are non-owning, the PluginModule | 90 // Tracks all live modules. The pointers are non-owning, the PluginModule |
90 // destructor will notify us when the module is deleted. | 91 // destructor will notify us when the module is deleted. |
91 typedef std::map<PP_Module, PluginModule*> ModuleMap; | 92 typedef std::map<PP_Module, PluginModule*> ModuleMap; |
92 ModuleMap module_map_; | 93 ModuleMap module_map_; |
93 | 94 |
94 DISALLOW_COPY_AND_ASSIGN(HostGlobals); | 95 DISALLOW_COPY_AND_ASSIGN(HostGlobals); |
95 }; | 96 }; |
96 | 97 |
97 } // namespace ppapi | 98 } // namespace ppapi |
98 } // namespace webkit | 99 } // namespace webkit |
99 | 100 |
100 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ | 101 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ |
OLD | NEW |