| 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 CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_ | 6 #define CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "content/renderer/pepper/host_var_tracker.h" | 9 #include "content/renderer/pepper/host_var_tracker.h" |
| 10 #include "ppapi/shared_impl/callback_tracker.h" | 10 #include "ppapi/shared_impl/callback_tracker.h" |
| 11 #include "ppapi/shared_impl/ppapi_globals.h" | 11 #include "ppapi/shared_impl/ppapi_globals.h" |
| 12 #include "ppapi/shared_impl/resource_tracker.h" | 12 #include "ppapi/shared_impl/resource_tracker.h" |
| 13 #include "ppapi/shared_impl/var_tracker.h" | 13 #include "ppapi/shared_impl/var_tracker.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 class PepperPluginInstanceImpl; | 17 class PepperPluginInstanceImpl; |
| 18 class PluginModule; | 18 class PluginModule; |
| 19 | 19 |
| 20 class HostGlobals : public ppapi::PpapiGlobals { | 20 class HostGlobals : public ppapi::PpapiGlobals { |
| 21 public: | 21 public: |
| 22 HostGlobals(); | 22 HostGlobals(); |
| 23 explicit HostGlobals(ppapi::PpapiGlobals::PerThreadForTest); | |
| 24 virtual ~HostGlobals(); | 23 virtual ~HostGlobals(); |
| 25 | 24 |
| 26 // Getter for the global singleton. Generally, you should use | 25 // Getter for the global singleton. Generally, you should use |
| 27 // PpapiGlobals::Get() when possible. Use this only when you need some | 26 // PpapiGlobals::Get() when possible. Use this only when you need some |
| 28 // host-specific functionality. | 27 // host-specific functionality. |
| 29 inline static HostGlobals* Get() { | 28 inline static HostGlobals* Get() { |
| 30 DCHECK(PpapiGlobals::Get()->IsHostGlobals()); | 29 DCHECK(PpapiGlobals::Get()->IsHostGlobals()); |
| 31 return static_cast<HostGlobals*>(PpapiGlobals::Get()); | 30 return static_cast<HostGlobals*>(PpapiGlobals::Get()); |
| 32 } | 31 } |
| 33 | 32 |
| 34 // PpapiGlobals implementation. | 33 // PpapiGlobals implementation. |
| 35 virtual ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; | 34 virtual ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; |
| 36 virtual ppapi::VarTracker* GetVarTracker() OVERRIDE; | 35 virtual ppapi::VarTracker* GetVarTracker() OVERRIDE; |
| 37 virtual ppapi::CallbackTracker* GetCallbackTrackerForInstance( | 36 virtual ppapi::CallbackTracker* GetCallbackTrackerForInstance( |
| 38 PP_Instance instance) OVERRIDE; | 37 PP_Instance instance) OVERRIDE; |
| 39 virtual ppapi::thunk::PPB_Instance_API* GetInstanceAPI( | 38 virtual ppapi::thunk::PPB_Instance_API* GetInstanceAPI( |
| 40 PP_Instance instance) OVERRIDE; | 39 PP_Instance instance) OVERRIDE; |
| 41 virtual ppapi::thunk::ResourceCreationAPI* GetResourceCreationAPI( | 40 virtual ppapi::thunk::ResourceCreationAPI* GetResourceCreationAPI( |
| 42 PP_Instance instance) OVERRIDE; | 41 PP_Instance instance) OVERRIDE; |
| 43 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; | 42 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; |
| 44 virtual std::string GetCmdLine() OVERRIDE; | 43 virtual std::string GetCmdLine() OVERRIDE; |
| 45 virtual void PreCacheFontForFlash(const void* logfontw) OVERRIDE; | 44 virtual void PreCacheFontForFlash(const void* logfontw) OVERRIDE; |
| 46 virtual base::Lock* GetProxyLock() OVERRIDE; | |
| 47 virtual void LogWithSource(PP_Instance instance, | 45 virtual void LogWithSource(PP_Instance instance, |
| 48 PP_LogLevel level, | 46 PP_LogLevel level, |
| 49 const std::string& source, | 47 const std::string& source, |
| 50 const std::string& value) OVERRIDE; | 48 const std::string& value) OVERRIDE; |
| 51 virtual void BroadcastLogWithSource(PP_Module module, | 49 virtual void BroadcastLogWithSource(PP_Module module, |
| 52 PP_LogLevel level, | 50 PP_LogLevel level, |
| 53 const std::string& source, | 51 const std::string& source, |
| 54 const std::string& value) OVERRIDE; | 52 const std::string& value) OVERRIDE; |
| 55 virtual ppapi::MessageLoopShared* GetCurrentMessageLoop() OVERRIDE; | 53 virtual ppapi::MessageLoopShared* GetCurrentMessageLoop() OVERRIDE; |
| 56 virtual base::TaskRunner* GetFileTaskRunner(PP_Instance instance) OVERRIDE; | 54 virtual base::TaskRunner* GetFileTaskRunner(PP_Instance instance) OVERRIDE; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // destructor will notify us when the module is deleted. | 105 // destructor will notify us when the module is deleted. |
| 108 typedef std::map<PP_Module, PluginModule*> ModuleMap; | 106 typedef std::map<PP_Module, PluginModule*> ModuleMap; |
| 109 ModuleMap module_map_; | 107 ModuleMap module_map_; |
| 110 | 108 |
| 111 DISALLOW_COPY_AND_ASSIGN(HostGlobals); | 109 DISALLOW_COPY_AND_ASSIGN(HostGlobals); |
| 112 }; | 110 }; |
| 113 | 111 |
| 114 } // namespace content | 112 } // namespace content |
| 115 | 113 |
| 116 #endif // CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_ | 114 #endif // CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_ |
| OLD | NEW |