| 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 PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
| 6 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 6 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "ppapi/proxy/plugin_resource_tracker.h" | 9 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 10 #include "ppapi/proxy/plugin_var_tracker.h" | 10 #include "ppapi/proxy/plugin_var_tracker.h" |
| 11 #include "ppapi/proxy/ppapi_proxy_export.h" | 11 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 12 #include "ppapi/shared_impl/callback_tracker.h" |
| 12 #include "ppapi/shared_impl/ppapi_globals.h" | 13 #include "ppapi/shared_impl/ppapi_globals.h" |
| 13 | 14 |
| 14 namespace ppapi { | 15 namespace ppapi { |
| 15 namespace proxy { | 16 namespace proxy { |
| 16 | 17 |
| 17 class PluginProxyDelegate; | 18 class PluginProxyDelegate; |
| 18 | 19 |
| 19 class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { | 20 class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { |
| 20 public: | 21 public: |
| 21 PluginGlobals(); | 22 PluginGlobals(); |
| 22 virtual ~PluginGlobals(); | 23 virtual ~PluginGlobals(); |
| 23 | 24 |
| 24 // Getter for the global singleton. Generally, you should use | 25 // Getter for the global singleton. Generally, you should use |
| 25 // PpapiGlobals::Get() when possible. Use this only when you need some | 26 // PpapiGlobals::Get() when possible. Use this only when you need some |
| 26 // plugin-specific functionality. | 27 // plugin-specific functionality. |
| 27 inline static PluginGlobals* Get() { return plugin_globals_; } | 28 inline static PluginGlobals* Get() { return plugin_globals_; } |
| 28 | 29 |
| 29 // PpapiGlobals implementation. | 30 // PpapiGlobals implementation. |
| 30 virtual ResourceTracker* GetResourceTracker() OVERRIDE; | 31 virtual ResourceTracker* GetResourceTracker() OVERRIDE; |
| 31 virtual VarTracker* GetVarTracker() OVERRIDE; | 32 virtual VarTracker* GetVarTracker() OVERRIDE; |
| 33 virtual CallbackTracker* GetCallbackTrackerForInstance( |
| 34 PP_Instance instance) OVERRIDE; |
| 32 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, | 35 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, |
| 33 ApiID id) OVERRIDE; | 36 ApiID id) OVERRIDE; |
| 34 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; | 37 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; |
| 35 | 38 |
| 36 // Getters for the plugin-specific versions. | 39 // Getters for the plugin-specific versions. |
| 37 PluginResourceTracker* plugin_resource_tracker() { | 40 PluginResourceTracker* plugin_resource_tracker() { |
| 38 return &plugin_resource_tracker_; | 41 return &plugin_resource_tracker_; |
| 39 } | 42 } |
| 40 PluginVarTracker* plugin_var_tracker() { | 43 PluginVarTracker* plugin_var_tracker() { |
| 41 return &plugin_var_tracker_; | 44 return &plugin_var_tracker_; |
| 42 } | 45 } |
| 43 | 46 |
| 44 // The embedder should call set_proxy_delegate during startup. | 47 // The embedder should call set_proxy_delegate during startup. |
| 45 PluginProxyDelegate* plugin_proxy_delegate() { | 48 PluginProxyDelegate* plugin_proxy_delegate() { |
| 46 return plugin_proxy_delegate_; | 49 return plugin_proxy_delegate_; |
| 47 } | 50 } |
| 48 void set_plugin_proxy_delegate(PluginProxyDelegate* d) { | 51 void set_plugin_proxy_delegate(PluginProxyDelegate* d) { |
| 49 plugin_proxy_delegate_ = d; | 52 plugin_proxy_delegate_ = d; |
| 50 } | 53 } |
| 51 | 54 |
| 52 private: | 55 private: |
| 53 static PluginGlobals* plugin_globals_; | 56 static PluginGlobals* plugin_globals_; |
| 54 | 57 |
| 55 PluginProxyDelegate* plugin_proxy_delegate_; | 58 PluginProxyDelegate* plugin_proxy_delegate_; |
| 56 PluginResourceTracker plugin_resource_tracker_; | 59 PluginResourceTracker plugin_resource_tracker_; |
| 57 PluginVarTracker plugin_var_tracker_; | 60 PluginVarTracker plugin_var_tracker_; |
| 61 scoped_refptr<CallbackTracker> callback_tracker_; |
| 58 | 62 |
| 59 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); | 63 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); |
| 60 }; | 64 }; |
| 61 | 65 |
| 62 } // namespace proxy | 66 } // namespace proxy |
| 63 } // namespace ppapi | 67 } // namespace ppapi |
| 64 | 68 |
| 65 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 69 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
| OLD | NEW |