Chromium Code Reviews| Index: ppapi/proxy/plugin_globals.h |
| diff --git a/ppapi/proxy/plugin_globals.h b/ppapi/proxy/plugin_globals.h |
| index ffcf01e016e51cd08721fc7db76b026dbb54b142..e6b35c09986eb36e4355fac92744bb5608855dca 100644 |
| --- a/ppapi/proxy/plugin_globals.h |
| +++ b/ppapi/proxy/plugin_globals.h |
| @@ -6,6 +6,7 @@ |
| #define PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
| #include "base/compiler_specific.h" |
| +#include "base/synchronization/lock.h" |
| #include "ppapi/proxy/plugin_resource_tracker.h" |
| #include "ppapi/proxy/plugin_var_tracker.h" |
| #include "ppapi/proxy/ppapi_proxy_export.h" |
| @@ -20,12 +21,17 @@ class PluginProxyDelegate; |
| class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { |
| public: |
| PluginGlobals(); |
| + PluginGlobals(PpapiGlobals::ForTest); |
| virtual ~PluginGlobals(); |
| // Getter for the global singleton. Generally, you should use |
| // PpapiGlobals::Get() when possible. Use this only when you need some |
| // plugin-specific functionality. |
| - inline static PluginGlobals* Get() { return plugin_globals_; } |
| + inline static PluginGlobals* Get() { |
| + if (plugin_globals_) |
| + return plugin_globals_; |
| + return static_cast<PluginGlobals*>(PpapiGlobals::Get()); |
|
piman
2012/01/11 19:23:25
Could we add a way to DCHECK that the cast is safe
dmichael (off chromium)
2012/01/12 04:42:23
Good ideas. Done.
|
| + } |
| // PpapiGlobals implementation. |
| virtual ResourceTracker* GetResourceTracker() OVERRIDE; |
| @@ -35,6 +41,7 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { |
| virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, |
| ApiID id) OVERRIDE; |
| virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; |
| + virtual base::Lock* GetProxyLock() OVERRIDE; |
| // Getters for the plugin-specific versions. |
| PluginResourceTracker* plugin_resource_tracker() { |
| @@ -59,6 +66,7 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { |
| PluginResourceTracker plugin_resource_tracker_; |
| PluginVarTracker plugin_var_tracker_; |
| scoped_refptr<CallbackTracker> callback_tracker_; |
| + base::Lock proxy_lock_; |
| DISALLOW_COPY_AND_ASSIGN(PluginGlobals); |
| }; |