| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 void LogWithSource(PP_Instance instance, | 70 void LogWithSource(PP_Instance instance, |
| 71 PP_LogLevel level, | 71 PP_LogLevel level, |
| 72 const std::string& source, | 72 const std::string& source, |
| 73 const std::string& value) override; | 73 const std::string& value) override; |
| 74 void BroadcastLogWithSource(PP_Module module, | 74 void BroadcastLogWithSource(PP_Module module, |
| 75 PP_LogLevel level, | 75 PP_LogLevel level, |
| 76 const std::string& source, | 76 const std::string& source, |
| 77 const std::string& value) override; | 77 const std::string& value) override; |
| 78 MessageLoopShared* GetCurrentMessageLoop() override; | 78 MessageLoopShared* GetCurrentMessageLoop() override; |
| 79 base::TaskRunner* GetFileTaskRunner() override; | 79 base::TaskRunner* GetFileTaskRunner() override; |
| 80 void MarkPluginIsActive() override; | |
| 81 | 80 |
| 82 // Returns the channel for sending to the browser. | 81 // Returns the channel for sending to the browser. |
| 83 IPC::Sender* GetBrowserSender(); | 82 IPC::Sender* GetBrowserSender(); |
| 84 | 83 |
| 85 base::TaskRunner* ipc_task_runner() { return ipc_task_runner_.get(); } | 84 base::TaskRunner* ipc_task_runner() { return ipc_task_runner_.get(); } |
| 86 | 85 |
| 87 // Returns the language code of the current UI language. | 86 // Returns the language code of the current UI language. |
| 88 std::string GetUILanguage(); | 87 std::string GetUILanguage(); |
| 89 | 88 |
| 90 // Sets the active url which is reported by breakpad. | 89 // Sets the active url which is reported by breakpad. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 141 } |
| 143 | 142 |
| 144 UDPSocketFilter* udp_socket_filter() const { | 143 UDPSocketFilter* udp_socket_filter() const { |
| 145 return udp_socket_filter_.get(); | 144 return udp_socket_filter_.get(); |
| 146 } | 145 } |
| 147 // Add any necessary ResourceMessageFilters to the PluginMessageFilter so | 146 // Add any necessary ResourceMessageFilters to the PluginMessageFilter so |
| 148 // that they can receive and handle appropriate messages on the IO thread. | 147 // that they can receive and handle appropriate messages on the IO thread. |
| 149 void RegisterResourceMessageFilters( | 148 void RegisterResourceMessageFilters( |
| 150 ppapi::proxy::PluginMessageFilter* plugin_filter); | 149 ppapi::proxy::PluginMessageFilter* plugin_filter); |
| 151 | 150 |
| 152 // Interval to limit how many IPC messages are sent indicating that the plugin | |
| 153 // is active and should be kept alive. The value must be smaller than any | |
| 154 // threshold used to kill inactive plugins by the embedder host. | |
| 155 void set_keepalive_throttle_interval_milliseconds(unsigned i); | |
| 156 | |
| 157 private: | 151 private: |
| 158 class BrowserSender; | 152 class BrowserSender; |
| 159 | 153 |
| 160 // PpapiGlobals overrides. | 154 // PpapiGlobals overrides. |
| 161 bool IsPluginGlobals() const override; | 155 bool IsPluginGlobals() const override; |
| 162 | 156 |
| 163 // Locks the proxy lock and releases the throttle on keepalive IPC messages. | |
| 164 void OnReleaseKeepaliveThrottle(); | |
| 165 | |
| 166 static PluginGlobals* plugin_globals_; | 157 static PluginGlobals* plugin_globals_; |
| 167 | 158 |
| 168 PluginProxyDelegate* plugin_proxy_delegate_; | 159 PluginProxyDelegate* plugin_proxy_delegate_; |
| 169 PluginResourceTracker plugin_resource_tracker_; | 160 PluginResourceTracker plugin_resource_tracker_; |
| 170 PluginVarTracker plugin_var_tracker_; | 161 PluginVarTracker plugin_var_tracker_; |
| 171 scoped_refptr<CallbackTracker> callback_tracker_; | 162 scoped_refptr<CallbackTracker> callback_tracker_; |
| 172 | 163 |
| 173 std::unique_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_; | 164 std::unique_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_; |
| 174 // Note that loop_for_main_thread's constructor sets msg_loop_slot_, so it | 165 // Note that loop_for_main_thread's constructor sets msg_loop_slot_, so it |
| 175 // must be initialized after msg_loop_slot_ (hence the order here). | 166 // must be initialized after msg_loop_slot_ (hence the order here). |
| (...skipping 12 matching lines...) Expand all Loading... |
| 188 scoped_refptr<base::TaskRunner> ipc_task_runner_; | 179 scoped_refptr<base::TaskRunner> ipc_task_runner_; |
| 189 | 180 |
| 190 // Thread for performing potentially blocking file operations. It's created | 181 // Thread for performing potentially blocking file operations. It's created |
| 191 // lazily, since it might not be needed. | 182 // lazily, since it might not be needed. |
| 192 std::unique_ptr<base::Thread> file_thread_; | 183 std::unique_ptr<base::Thread> file_thread_; |
| 193 | 184 |
| 194 scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_; | 185 scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_; |
| 195 | 186 |
| 196 scoped_refptr<UDPSocketFilter> udp_socket_filter_; | 187 scoped_refptr<UDPSocketFilter> udp_socket_filter_; |
| 197 | 188 |
| 198 // Indicates activity by the plugin. Used to monitor when a plugin can be | |
| 199 // shutdown due to idleness. Current needs do not require differentiating | |
| 200 // between idle state between multiple instances, if any are active they are | |
| 201 // all considered active. | |
| 202 bool plugin_recently_active_; | |
| 203 | |
| 204 unsigned keepalive_throttle_interval_milliseconds_; | |
| 205 | |
| 206 // Member variables should appear before the WeakPtrFactory, see weak_ptr.h. | 189 // Member variables should appear before the WeakPtrFactory, see weak_ptr.h. |
| 207 base::WeakPtrFactory<PluginGlobals> weak_factory_; | 190 base::WeakPtrFactory<PluginGlobals> weak_factory_; |
| 208 | 191 |
| 209 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); | 192 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); |
| 210 }; | 193 }; |
| 211 | 194 |
| 212 } // namespace proxy | 195 } // namespace proxy |
| 213 } // namespace ppapi | 196 } // namespace ppapi |
| 214 | 197 |
| 215 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 198 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
| OLD | NEW |