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 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/callback_tracker.h" | 9 #include "ppapi/shared_impl/callback_tracker.h" |
10 #include "ppapi/shared_impl/ppapi_globals.h" | 10 #include "ppapi/shared_impl/ppapi_globals.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 inline static HostGlobals* Get() { | 31 inline static HostGlobals* Get() { |
32 DCHECK(PpapiGlobals::Get()->IsHostGlobals()); | 32 DCHECK(PpapiGlobals::Get()->IsHostGlobals()); |
33 return static_cast<HostGlobals*>(PpapiGlobals::Get()); | 33 return static_cast<HostGlobals*>(PpapiGlobals::Get()); |
34 } | 34 } |
35 | 35 |
36 // PpapiGlobals implementation. | 36 // PpapiGlobals implementation. |
37 virtual ::ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; | 37 virtual ::ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; |
38 virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE; | 38 virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE; |
39 virtual ::ppapi::CallbackTracker* GetCallbackTrackerForInstance( | 39 virtual ::ppapi::CallbackTracker* GetCallbackTrackerForInstance( |
40 PP_Instance instance) OVERRIDE; | 40 PP_Instance instance) OVERRIDE; |
41 virtual ::ppapi::FunctionGroupBase* GetFunctionAPI( | 41 virtual ::ppapi::thunk::PPB_Instance_API* GetInstanceAPI( |
42 PP_Instance inst, | 42 PP_Instance instance) OVERRIDE; |
43 ::ppapi::ApiID id) OVERRIDE; | 43 virtual ::ppapi::thunk::ResourceCreationAPI* GetResourceCreationAPI( |
| 44 PP_Instance instance) OVERRIDE; |
44 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; | 45 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; |
45 virtual std::string GetCmdLine() OVERRIDE; | 46 virtual std::string GetCmdLine() OVERRIDE; |
46 virtual void PreCacheFontForFlash(const void* logfontw) OVERRIDE; | 47 virtual void PreCacheFontForFlash(const void* logfontw) OVERRIDE; |
47 virtual base::Lock* GetProxyLock() OVERRIDE; | 48 virtual base::Lock* GetProxyLock() OVERRIDE; |
48 virtual void LogWithSource(PP_Instance instance, | 49 virtual void LogWithSource(PP_Instance instance, |
49 PP_LogLevel_Dev level, | 50 PP_LogLevel_Dev level, |
50 const std::string& source, | 51 const std::string& source, |
51 const std::string& value) OVERRIDE; | 52 const std::string& value) OVERRIDE; |
52 virtual void BroadcastLogWithSource(PP_Module module, | 53 virtual void BroadcastLogWithSource(PP_Module module, |
53 PP_LogLevel_Dev level, | 54 PP_LogLevel_Dev level, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 87 |
87 // Returns a pointer to the plugin instance object associated with the given | 88 // Returns a pointer to the plugin instance object associated with the given |
88 // instance handle. The return value will be NULL if the handle is invalid or | 89 // instance handle. The return value will be NULL if the handle is invalid or |
89 // if the instance has crashed. | 90 // if the instance has crashed. |
90 WEBKIT_PLUGINS_EXPORT PluginInstance* GetInstance(PP_Instance instance); | 91 WEBKIT_PLUGINS_EXPORT PluginInstance* GetInstance(PP_Instance instance); |
91 | 92 |
92 private: | 93 private: |
93 // PpapiGlobals overrides. | 94 // PpapiGlobals overrides. |
94 virtual bool IsHostGlobals() const OVERRIDE; | 95 virtual bool IsHostGlobals() const OVERRIDE; |
95 | 96 |
96 // Per-instance data we track. | |
97 struct InstanceData; | |
98 | |
99 WEBKIT_PLUGINS_EXPORT static HostGlobals* host_globals_; | 97 WEBKIT_PLUGINS_EXPORT static HostGlobals* host_globals_; |
100 | 98 |
101 ::ppapi::ResourceTracker resource_tracker_; | 99 ::ppapi::ResourceTracker resource_tracker_; |
102 HostVarTracker host_var_tracker_; | 100 HostVarTracker host_var_tracker_; |
103 | 101 |
104 // Tracks all live instances and their associated data. | 102 // Tracks all live instances and their associated object. |
105 typedef std::map<PP_Instance, linked_ptr<InstanceData> > InstanceMap; | 103 typedef std::map<PP_Instance, PluginInstance*> InstanceMap; |
106 InstanceMap instance_map_; | 104 InstanceMap instance_map_; |
107 | 105 |
108 // Tracks all live modules. The pointers are non-owning, the PluginModule | 106 // Tracks all live modules. The pointers are non-owning, the PluginModule |
109 // destructor will notify us when the module is deleted. | 107 // destructor will notify us when the module is deleted. |
110 typedef std::map<PP_Module, PluginModule*> ModuleMap; | 108 typedef std::map<PP_Module, PluginModule*> ModuleMap; |
111 ModuleMap module_map_; | 109 ModuleMap module_map_; |
112 | 110 |
113 DISALLOW_COPY_AND_ASSIGN(HostGlobals); | 111 DISALLOW_COPY_AND_ASSIGN(HostGlobals); |
114 }; | 112 }; |
115 | 113 |
116 } // namespace ppapi | 114 } // namespace ppapi |
117 } // namespace webkit | 115 } // namespace webkit |
118 | 116 |
119 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ | 117 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ |
OLD | NEW |