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 CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 content::RenderViewHost* render_view_host); | 106 content::RenderViewHost* render_view_host); |
107 | 107 |
108 // Returns true if the (lazy) background host for the given extension has | 108 // Returns true if the (lazy) background host for the given extension has |
109 // already been sent the unload event and is shutting down. | 109 // already been sent the unload event and is shutting down. |
110 bool IsBackgroundHostClosing(const std::string& extension_id); | 110 bool IsBackgroundHostClosing(const std::string& extension_id); |
111 | 111 |
112 // Getter and setter for the lazy background page's keepalive count. This is | 112 // Getter and setter for the lazy background page's keepalive count. This is |
113 // the count of how many outstanding "things" are keeping the page alive. | 113 // the count of how many outstanding "things" are keeping the page alive. |
114 // When this reaches 0, we will begin the process of shutting down the page. | 114 // When this reaches 0, we will begin the process of shutting down the page. |
115 // "Things" include pending events, resource loads, and API calls. | 115 // "Things" include pending events, resource loads, and API calls. |
116 // The |cancel_suspend| option defaults to false and indicates whether | |
benwells
2012/07/20 10:57:00
I'd prefer |cancel_suspend| to be a non-optional e
| |
117 // incrementing the keepalive count should prevent it from being suspended. | |
116 int GetLazyKeepaliveCount(const extensions::Extension* extension); | 118 int GetLazyKeepaliveCount(const extensions::Extension* extension); |
117 int IncrementLazyKeepaliveCount(const extensions::Extension* extension); | 119 int IncrementLazyKeepaliveCount(const extensions::Extension* extension); |
120 int IncrementLazyKeepaliveCount(const extensions::Extension* extension, | |
121 bool cancel_suspend); | |
118 int DecrementLazyKeepaliveCount(const extensions::Extension* extension); | 122 int DecrementLazyKeepaliveCount(const extensions::Extension* extension); |
119 | 123 |
120 void IncrementLazyKeepaliveCountForView( | 124 void IncrementLazyKeepaliveCountForView( |
121 content::RenderViewHost* render_view_host); | 125 content::RenderViewHost* render_view_host); |
122 | 126 |
123 // Handles a response to the ShouldUnload message, used for lazy background | 127 // Handles a response to the ShouldUnload message, used for lazy background |
124 // pages. | 128 // pages. |
125 void OnShouldUnloadAck(const std::string& extension_id, int sequence_id); | 129 void OnShouldUnloadAck(const std::string& extension_id, int sequence_id); |
126 | 130 |
127 // Same as above, for the Unload message. | 131 // Same as above, for the Unload message. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 | 182 |
179 // Ensure browser object is not null except for certain situations. | 183 // Ensure browser object is not null except for certain situations. |
180 void EnsureBrowserWhenRequired(Browser* browser, | 184 void EnsureBrowserWhenRequired(Browser* browser, |
181 chrome::ViewType view_type); | 185 chrome::ViewType view_type); |
182 | 186 |
183 // These are called when the extension transitions between idle and active. | 187 // These are called when the extension transitions between idle and active. |
184 // They control the process of closing the background page when idle. | 188 // They control the process of closing the background page when idle. |
185 void OnLazyBackgroundPageIdle(const std::string& extension_id, | 189 void OnLazyBackgroundPageIdle(const std::string& extension_id, |
186 int sequence_id); | 190 int sequence_id); |
187 void OnLazyBackgroundPageActive(const std::string& extension_id); | 191 void OnLazyBackgroundPageActive(const std::string& extension_id); |
188 void CloseLazyBackgroundPageNow(const std::string& extension_id); | 192 void CloseLazyBackgroundPageNow(const std::string& extension_id, |
193 int sequence_id); | |
189 | 194 |
190 // Updates a potentially-registered RenderViewHost once it has been | 195 // Updates a potentially-registered RenderViewHost once it has been |
191 // associated with a WebContents. This allows us to gather information that | 196 // associated with a WebContents. This allows us to gather information that |
192 // was not available when the host was first registered. | 197 // was not available when the host was first registered. |
193 void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host); | 198 void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host); |
194 | 199 |
195 // Clears background page data for this extension. | 200 // Clears background page data for this extension. |
196 void ClearBackgroundPageData(const std::string& extension_id); | 201 void ClearBackgroundPageData(const std::string& extension_id); |
197 | 202 |
198 BackgroundPageDataMap background_page_data_; | 203 BackgroundPageDataMap background_page_data_; |
199 | 204 |
200 // The time to delay between an extension becoming idle and | 205 // The time to delay between an extension becoming idle and |
201 // sending a ShouldUnload message; read from command-line switch. | 206 // sending a ShouldUnload message; read from command-line switch. |
202 base::TimeDelta event_page_idle_time_; | 207 base::TimeDelta event_page_idle_time_; |
203 | 208 |
204 // The time to delay between sending a ShouldUnload message and | 209 // The time to delay between sending a ShouldUnload message and |
205 // sending a Unload message; read from command-line switch. | 210 // sending a Unload message; read from command-line switch. |
206 base::TimeDelta event_page_unloading_time_; | 211 base::TimeDelta event_page_unloading_time_; |
207 | 212 |
208 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; | 213 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; |
209 | 214 |
210 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 215 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
211 }; | 216 }; |
212 | 217 |
213 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 218 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
OLD | NEW |