Chromium Code Reviews| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 virtual void LogWithSource(PP_Instance instance, | 66 virtual void LogWithSource(PP_Instance instance, |
| 67 PP_LogLevel level, | 67 PP_LogLevel level, |
| 68 const std::string& source, | 68 const std::string& source, |
| 69 const std::string& value) OVERRIDE; | 69 const std::string& value) OVERRIDE; |
| 70 virtual void BroadcastLogWithSource(PP_Module module, | 70 virtual void BroadcastLogWithSource(PP_Module module, |
| 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 virtual MessageLoopShared* GetCurrentMessageLoop() OVERRIDE; | 74 virtual MessageLoopShared* GetCurrentMessageLoop() OVERRIDE; |
| 75 base::TaskRunner* GetFileTaskRunner() OVERRIDE; | 75 base::TaskRunner* GetFileTaskRunner() OVERRIDE; |
| 76 virtual void MarkPluginIsActive() OVERRIDE; | |
| 76 | 77 |
| 77 // Returns the channel for sending to the browser. | 78 // Returns the channel for sending to the browser. |
| 78 IPC::Sender* GetBrowserSender(); | 79 IPC::Sender* GetBrowserSender(); |
| 79 | 80 |
| 80 // Returns the language code of the current UI language. | 81 // Returns the language code of the current UI language. |
| 81 std::string GetUILanguage(); | 82 std::string GetUILanguage(); |
| 82 | 83 |
| 83 // Sets the active url which is reported by breakpad. | 84 // Sets the active url which is reported by breakpad. |
| 84 void SetActiveURL(const std::string& url); | 85 void SetActiveURL(const std::string& url); |
| 85 | 86 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 // long as the plugin. | 122 // long as the plugin. |
| 122 MessageLoopResource* loop_for_main_thread(); | 123 MessageLoopResource* loop_for_main_thread(); |
| 123 | 124 |
| 124 // The embedder should call this function when the name of the plugin module | 125 // The embedder should call this function when the name of the plugin module |
| 125 // is known. This will be used for error logging. | 126 // is known. This will be used for error logging. |
| 126 void set_plugin_name(const std::string& name) { plugin_name_ = name; } | 127 void set_plugin_name(const std::string& name) { plugin_name_ = name; } |
| 127 | 128 |
| 128 // The embedder should call this function when the command line is known. | 129 // The embedder should call this function when the command line is known. |
| 129 void set_command_line(const std::string& c) { command_line_ = c; } | 130 void set_command_line(const std::string& c) { command_line_ = c; } |
| 130 | 131 |
| 132 // Interval to limit how many IPC messages are sent indicating that the plugin | |
| 133 // is active and should be kept alive. The value must be smaller than any | |
| 134 // threshold used to kill inactive plugins by the embedder host. | |
| 135 int keep_aliave_throttle_interval_milliseconds(); | |
|
yzshen1
2013/12/13 21:23:15
alive, please. And it seems you use keepalive with
yzshen1
2013/12/13 21:23:15
const for the method, please.
scheib
2013/12/14 00:07:41
Done.
scheib
2013/12/14 00:07:41
Done.
| |
| 136 void set_keep_aliave_throttle_interval_milliseconds(int i); | |
| 137 | |
| 131 private: | 138 private: |
| 132 class BrowserSender; | 139 class BrowserSender; |
| 133 | 140 |
| 134 // PpapiGlobals overrides. | 141 // PpapiGlobals overrides. |
| 135 virtual bool IsPluginGlobals() const OVERRIDE; | 142 virtual bool IsPluginGlobals() const OVERRIDE; |
| 136 | 143 |
| 144 // Releases the throttle on sending keepalive IPC messages. | |
| 145 void OnReleaseKeepaliveThrottle(); | |
|
yzshen1
2013/12/13 21:23:15
It seems better to comment that "Locks the proxy l
scheib
2013/12/14 00:07:41
Done.
| |
| 146 | |
| 137 static PluginGlobals* plugin_globals_; | 147 static PluginGlobals* plugin_globals_; |
| 138 | 148 |
| 139 PluginProxyDelegate* plugin_proxy_delegate_; | 149 PluginProxyDelegate* plugin_proxy_delegate_; |
| 140 PluginResourceTracker plugin_resource_tracker_; | 150 PluginResourceTracker plugin_resource_tracker_; |
| 141 PluginVarTracker plugin_var_tracker_; | 151 PluginVarTracker plugin_var_tracker_; |
| 142 scoped_refptr<CallbackTracker> callback_tracker_; | 152 scoped_refptr<CallbackTracker> callback_tracker_; |
| 143 | 153 |
| 144 scoped_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_; | 154 scoped_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_; |
| 145 // Note that loop_for_main_thread's constructor sets msg_loop_slot_, so it | 155 // Note that loop_for_main_thread's constructor sets msg_loop_slot_, so it |
| 146 // must be initialized after msg_loop_slot_ (hence the order here). | 156 // must be initialized after msg_loop_slot_ (hence the order here). |
| 147 scoped_refptr<MessageLoopResource> loop_for_main_thread_; | 157 scoped_refptr<MessageLoopResource> loop_for_main_thread_; |
| 148 | 158 |
| 149 // Name of the plugin used for error logging. This will be empty until | 159 // Name of the plugin used for error logging. This will be empty until |
| 150 // set_plugin_name is called. | 160 // set_plugin_name is called. |
| 151 std::string plugin_name_; | 161 std::string plugin_name_; |
| 152 | 162 |
| 153 // Command line for the plugin. This will be empty until set_command_line is | 163 // Command line for the plugin. This will be empty until set_command_line is |
| 154 // called. | 164 // called. |
| 155 std::string command_line_; | 165 std::string command_line_; |
| 156 | 166 |
| 157 scoped_ptr<BrowserSender> browser_sender_; | 167 scoped_ptr<BrowserSender> browser_sender_; |
| 158 | 168 |
| 159 // Thread for performing potentially blocking file operations. It's created | 169 // Thread for performing potentially blocking file operations. It's created |
| 160 // lazily, since it might not be needed. | 170 // lazily, since it might not be needed. |
| 161 scoped_ptr<base::Thread> file_thread_; | 171 scoped_ptr<base::Thread> file_thread_; |
| 162 | 172 |
| 173 // Indicates activity by the plugin. Used to monitor when a plugin can be | |
| 174 // shutdown due to idleness. Current needs do not require differentiating | |
| 175 // between idle state between multiple instances, if any are active they are | |
| 176 // all considered active. | |
| 177 bool plugin_recently_active_; | |
| 178 | |
| 179 int keep_aliave_throttle_interval_milliseconds_; | |
|
yzshen1
2013/12/13 21:23:15
alive, please.
(You are using auto-completion for
scheib
2013/12/14 00:07:41
Done.
| |
| 180 | |
| 181 // Member variables should appear before the WeakPtrFactory, see weak_ptr.h. | |
| 182 base::WeakPtrFactory<PluginGlobals> weak_factory_; | |
| 183 | |
| 163 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); | 184 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); |
| 164 }; | 185 }; |
| 165 | 186 |
| 166 } // namespace proxy | 187 } // namespace proxy |
| 167 } // namespace ppapi | 188 } // namespace ppapi |
| 168 | 189 |
| 169 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 190 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
| OLD | NEW |