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 WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ | 6 #define CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "content/renderer/pepper/host_var_tracker.h" |
9 #include "ppapi/shared_impl/callback_tracker.h" | 10 #include "ppapi/shared_impl/callback_tracker.h" |
10 #include "ppapi/shared_impl/ppapi_globals.h" | 11 #include "ppapi/shared_impl/ppapi_globals.h" |
11 #include "ppapi/shared_impl/resource_tracker.h" | 12 #include "ppapi/shared_impl/resource_tracker.h" |
12 #include "ppapi/shared_impl/var_tracker.h" | 13 #include "ppapi/shared_impl/var_tracker.h" |
13 #include "webkit/plugins/ppapi/host_var_tracker.h" | |
14 #include "webkit/plugins/webkit_plugins_export.h" | |
15 | 14 |
16 namespace webkit { | 15 namespace webkit { |
17 namespace ppapi { | 16 namespace ppapi { |
18 | 17 |
19 class PluginInstanceImpl; | 18 class PluginInstanceImpl; |
20 class PluginModule; | 19 class PluginModule; |
21 | 20 |
22 class HostGlobals : public ::ppapi::PpapiGlobals { | 21 class HostGlobals : public ::ppapi::PpapiGlobals { |
23 public: | 22 public: |
24 HostGlobals(); | 23 HostGlobals(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 82 |
84 // Called when a plugin instance was deleted and should no longer be tracked. | 83 // Called when a plugin instance was deleted and should no longer be tracked. |
85 // The given handle should be one generated by AddInstance. | 84 // The given handle should be one generated by AddInstance. |
86 void InstanceDeleted(PP_Instance instance); | 85 void InstanceDeleted(PP_Instance instance); |
87 | 86 |
88 void InstanceCrashed(PP_Instance instance); | 87 void InstanceCrashed(PP_Instance instance); |
89 | 88 |
90 // Returns a pointer to the plugin instance object associated with the given | 89 // Returns a pointer to the plugin instance object associated with the given |
91 // instance handle. The return value will be NULL if the handle is invalid or | 90 // instance handle. The return value will be NULL if the handle is invalid or |
92 // if the instance has crashed. | 91 // if the instance has crashed. |
93 WEBKIT_PLUGINS_EXPORT PluginInstanceImpl* GetInstance(PP_Instance instance); | 92 PluginInstanceImpl* GetInstance(PP_Instance instance); |
94 | 93 |
95 private: | 94 private: |
96 // PpapiGlobals overrides. | 95 // PpapiGlobals overrides. |
97 virtual bool IsHostGlobals() const OVERRIDE; | 96 virtual bool IsHostGlobals() const OVERRIDE; |
98 | 97 |
99 WEBKIT_PLUGINS_EXPORT static HostGlobals* host_globals_; | 98 static HostGlobals* host_globals_; |
100 | 99 |
101 ::ppapi::ResourceTracker resource_tracker_; | 100 ::ppapi::ResourceTracker resource_tracker_; |
102 HostVarTracker host_var_tracker_; | 101 HostVarTracker host_var_tracker_; |
103 | 102 |
104 // Tracks all live instances and their associated object. | 103 // Tracks all live instances and their associated object. |
105 typedef std::map<PP_Instance, PluginInstanceImpl*> InstanceMap; | 104 typedef std::map<PP_Instance, PluginInstanceImpl*> InstanceMap; |
106 InstanceMap instance_map_; | 105 InstanceMap instance_map_; |
107 | 106 |
108 // Tracks all live modules. The pointers are non-owning, the PluginModule | 107 // Tracks all live modules. The pointers are non-owning, the PluginModule |
109 // destructor will notify us when the module is deleted. | 108 // destructor will notify us when the module is deleted. |
110 typedef std::map<PP_Module, PluginModule*> ModuleMap; | 109 typedef std::map<PP_Module, PluginModule*> ModuleMap; |
111 ModuleMap module_map_; | 110 ModuleMap module_map_; |
112 | 111 |
113 DISALLOW_COPY_AND_ASSIGN(HostGlobals); | 112 DISALLOW_COPY_AND_ASSIGN(HostGlobals); |
114 }; | 113 }; |
115 | 114 |
116 } // namespace ppapi | 115 } // namespace ppapi |
117 } // namespace webkit | 116 } // namespace webkit |
118 | 117 |
119 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ | 118 #endif // CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_ |
OLD | NEW |