| 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 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 class PluginMessageFilter; | 37 class PluginMessageFilter; |
| 38 class PluginProxyDelegate; | 38 class PluginProxyDelegate; |
| 39 class ResourceReplyThreadRegistrar; | 39 class ResourceReplyThreadRegistrar; |
| 40 class UDPSocketFilter; | 40 class UDPSocketFilter; |
| 41 | 41 |
| 42 class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { | 42 class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { |
| 43 public: | 43 public: |
| 44 explicit PluginGlobals(const scoped_refptr<base::TaskRunner>& task_runner); | 44 explicit PluginGlobals(const scoped_refptr<base::TaskRunner>& task_runner); |
| 45 PluginGlobals(PpapiGlobals::PerThreadForTest, | 45 PluginGlobals(PpapiGlobals::PerThreadForTest, |
| 46 const scoped_refptr<base::TaskRunner>& task_runner); | 46 const scoped_refptr<base::TaskRunner>& task_runner); |
| 47 virtual ~PluginGlobals(); | 47 ~PluginGlobals() override; |
| 48 | 48 |
| 49 // Getter for the global singleton. Generally, you should use | 49 // Getter for the global singleton. Generally, you should use |
| 50 // PpapiGlobals::Get() when possible. Use this only when you need some | 50 // PpapiGlobals::Get() when possible. Use this only when you need some |
| 51 // plugin-specific functionality. | 51 // plugin-specific functionality. |
| 52 inline static PluginGlobals* Get() { | 52 inline static PluginGlobals* Get() { |
| 53 // Explicitly crash if this is the wrong process type, we want to get | 53 // Explicitly crash if this is the wrong process type, we want to get |
| 54 // crash reports. | 54 // crash reports. |
| 55 CHECK(PpapiGlobals::Get()->IsPluginGlobals()); | 55 CHECK(PpapiGlobals::Get()->IsPluginGlobals()); |
| 56 return static_cast<PluginGlobals*>(PpapiGlobals::Get()); | 56 return static_cast<PluginGlobals*>(PpapiGlobals::Get()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // PpapiGlobals implementation. | 59 // PpapiGlobals implementation. |
| 60 virtual ResourceTracker* GetResourceTracker() override; | 60 ResourceTracker* GetResourceTracker() override; |
| 61 virtual VarTracker* GetVarTracker() override; | 61 VarTracker* GetVarTracker() override; |
| 62 virtual CallbackTracker* GetCallbackTrackerForInstance( | 62 CallbackTracker* GetCallbackTrackerForInstance(PP_Instance instance) override; |
| 63 thunk::PPB_Instance_API* GetInstanceAPI(PP_Instance instance) override; |
| 64 thunk::ResourceCreationAPI* GetResourceCreationAPI( |
| 63 PP_Instance instance) override; | 65 PP_Instance instance) override; |
| 64 virtual thunk::PPB_Instance_API* GetInstanceAPI( | 66 PP_Module GetModuleForInstance(PP_Instance instance) override; |
| 65 PP_Instance instance) override; | 67 std::string GetCmdLine() override; |
| 66 virtual thunk::ResourceCreationAPI* GetResourceCreationAPI( | 68 void PreCacheFontForFlash(const void* logfontw) override; |
| 67 PP_Instance instance) override; | 69 void LogWithSource(PP_Instance instance, |
| 68 virtual PP_Module GetModuleForInstance(PP_Instance instance) override; | 70 PP_LogLevel level, |
| 69 virtual std::string GetCmdLine() override; | 71 const std::string& source, |
| 70 virtual void PreCacheFontForFlash(const void* logfontw) override; | 72 const std::string& value) override; |
| 71 virtual void LogWithSource(PP_Instance instance, | 73 void BroadcastLogWithSource(PP_Module module, |
| 72 PP_LogLevel level, | 74 PP_LogLevel level, |
| 73 const std::string& source, | 75 const std::string& source, |
| 74 const std::string& value) override; | 76 const std::string& value) override; |
| 75 virtual void BroadcastLogWithSource(PP_Module module, | 77 MessageLoopShared* GetCurrentMessageLoop() override; |
| 76 PP_LogLevel level, | |
| 77 const std::string& source, | |
| 78 const std::string& value) override; | |
| 79 virtual MessageLoopShared* GetCurrentMessageLoop() override; | |
| 80 base::TaskRunner* GetFileTaskRunner() override; | 78 base::TaskRunner* GetFileTaskRunner() override; |
| 81 virtual void MarkPluginIsActive() override; | 79 void MarkPluginIsActive() override; |
| 82 | 80 |
| 83 // Returns the channel for sending to the browser. | 81 // Returns the channel for sending to the browser. |
| 84 IPC::Sender* GetBrowserSender(); | 82 IPC::Sender* GetBrowserSender(); |
| 85 | 83 |
| 86 base::TaskRunner* ipc_task_runner() { return ipc_task_runner_.get(); } | 84 base::TaskRunner* ipc_task_runner() { return ipc_task_runner_.get(); } |
| 87 | 85 |
| 88 // Returns the language code of the current UI language. | 86 // Returns the language code of the current UI language. |
| 89 std::string GetUILanguage(); | 87 std::string GetUILanguage(); |
| 90 | 88 |
| 91 // Sets the active url which is reported by breakpad. | 89 // Sets the active url which is reported by breakpad. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 150 |
| 153 // Interval to limit how many IPC messages are sent indicating that the plugin | 151 // Interval to limit how many IPC messages are sent indicating that the plugin |
| 154 // is active and should be kept alive. The value must be smaller than any | 152 // is active and should be kept alive. The value must be smaller than any |
| 155 // threshold used to kill inactive plugins by the embedder host. | 153 // threshold used to kill inactive plugins by the embedder host. |
| 156 void set_keepalive_throttle_interval_milliseconds(unsigned i); | 154 void set_keepalive_throttle_interval_milliseconds(unsigned i); |
| 157 | 155 |
| 158 private: | 156 private: |
| 159 class BrowserSender; | 157 class BrowserSender; |
| 160 | 158 |
| 161 // PpapiGlobals overrides. | 159 // PpapiGlobals overrides. |
| 162 virtual bool IsPluginGlobals() const override; | 160 bool IsPluginGlobals() const override; |
| 163 | 161 |
| 164 // Locks the proxy lock and releases the throttle on keepalive IPC messages. | 162 // Locks the proxy lock and releases the throttle on keepalive IPC messages. |
| 165 void OnReleaseKeepaliveThrottle(); | 163 void OnReleaseKeepaliveThrottle(); |
| 166 | 164 |
| 167 static PluginGlobals* plugin_globals_; | 165 static PluginGlobals* plugin_globals_; |
| 168 | 166 |
| 169 PluginProxyDelegate* plugin_proxy_delegate_; | 167 PluginProxyDelegate* plugin_proxy_delegate_; |
| 170 PluginResourceTracker plugin_resource_tracker_; | 168 PluginResourceTracker plugin_resource_tracker_; |
| 171 PluginVarTracker plugin_var_tracker_; | 169 PluginVarTracker plugin_var_tracker_; |
| 172 scoped_refptr<CallbackTracker> callback_tracker_; | 170 scoped_refptr<CallbackTracker> callback_tracker_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // Member variables should appear before the WeakPtrFactory, see weak_ptr.h. | 205 // Member variables should appear before the WeakPtrFactory, see weak_ptr.h. |
| 208 base::WeakPtrFactory<PluginGlobals> weak_factory_; | 206 base::WeakPtrFactory<PluginGlobals> weak_factory_; |
| 209 | 207 |
| 210 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); | 208 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); |
| 211 }; | 209 }; |
| 212 | 210 |
| 213 } // namespace proxy | 211 } // namespace proxy |
| 214 } // namespace ppapi | 212 } // namespace ppapi |
| 215 | 213 |
| 216 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 214 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
| OLD | NEW |