| 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/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" |
| 11 #include "ppapi/shared_impl/resource_tracker.h" | 11 #include "ppapi/shared_impl/resource_tracker.h" |
| 12 #include "ppapi/shared_impl/var_tracker.h" | 12 #include "ppapi/shared_impl/var_tracker.h" |
| 13 #include "webkit/plugins/ppapi/host_var_tracker.h" | 13 #include "webkit/plugins/ppapi/host_var_tracker.h" |
| 14 #include "webkit/plugins/webkit_plugins_export.h" | 14 #include "webkit/plugins/webkit_plugins_export.h" |
| 15 | 15 |
| 16 namespace webkit { | 16 namespace webkit { |
| 17 namespace ppapi { | 17 namespace ppapi { |
| 18 | 18 |
| 19 class PluginInstance; | 19 class PluginInstance; |
| 20 class PluginModule; | 20 class PluginModule; |
| 21 | 21 |
| 22 class HostGlobals : public ::ppapi::PpapiGlobals { | 22 class HostGlobals : public ::ppapi::PpapiGlobals { |
| 23 public: | 23 public: |
| 24 HostGlobals(); | 24 HostGlobals(); |
| 25 HostGlobals(::ppapi::PpapiGlobals::ForTest); |
| 25 virtual ~HostGlobals(); | 26 virtual ~HostGlobals(); |
| 26 | 27 |
| 27 // Getter for the global singleton. Generally, you should use | 28 // Getter for the global singleton. Generally, you should use |
| 28 // PpapiGlobals::Get() when possible. Use this only when you need some | 29 // PpapiGlobals::Get() when possible. Use this only when you need some |
| 29 // host-specific functionality. | 30 // host-specific functionality. |
| 30 inline static HostGlobals* Get() { return host_globals_; } | 31 inline static HostGlobals* Get() { |
| 32 if (host_globals_) |
| 33 return host_globals_; |
| 34 return static_cast<HostGlobals*>(PpapiGlobals::Get()); |
| 35 } |
| 31 | 36 |
| 32 // PpapiGlobals implementation. | 37 // PpapiGlobals implementation. |
| 33 virtual ::ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; | 38 virtual ::ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; |
| 34 virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE; | 39 virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE; |
| 35 virtual ::ppapi::CallbackTracker* GetCallbackTrackerForInstance( | 40 virtual ::ppapi::CallbackTracker* GetCallbackTrackerForInstance( |
| 36 PP_Instance instance) OVERRIDE; | 41 PP_Instance instance) OVERRIDE; |
| 37 virtual ::ppapi::FunctionGroupBase* GetFunctionAPI( | 42 virtual ::ppapi::FunctionGroupBase* GetFunctionAPI( |
| 38 PP_Instance inst, | 43 PP_Instance inst, |
| 39 ::ppapi::ApiID id) OVERRIDE; | 44 ::ppapi::ApiID id) OVERRIDE; |
| 40 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; | 45 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; |
| 46 virtual base::Lock* GetProxyLock() OVERRIDE; |
| 41 | 47 |
| 42 HostVarTracker* host_var_tracker() { | 48 HostVarTracker* host_var_tracker() { |
| 43 return &host_var_tracker_; | 49 return &host_var_tracker_; |
| 44 } | 50 } |
| 45 | 51 |
| 46 // PP_Modules ---------------------------------------------------------------- | 52 // PP_Modules ---------------------------------------------------------------- |
| 47 | 53 |
| 48 // Adds a new plugin module to the list of tracked module, and returns a new | 54 // Adds a new plugin module to the list of tracked module, and returns a new |
| 49 // module handle to identify it. | 55 // module handle to identify it. |
| 50 PP_Module AddModule(PluginModule* module); | 56 PP_Module AddModule(PluginModule* module); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 typedef std::map<PP_Module, PluginModule*> ModuleMap; | 98 typedef std::map<PP_Module, PluginModule*> ModuleMap; |
| 93 ModuleMap module_map_; | 99 ModuleMap module_map_; |
| 94 | 100 |
| 95 DISALLOW_COPY_AND_ASSIGN(HostGlobals); | 101 DISALLOW_COPY_AND_ASSIGN(HostGlobals); |
| 96 }; | 102 }; |
| 97 | 103 |
| 98 } // namespace ppapi | 104 } // namespace ppapi |
| 99 } // namespace webkit | 105 } // namespace webkit |
| 100 | 106 |
| 101 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ | 107 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ |
| OLD | NEW |