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