| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 int GetLazyKeepaliveCount(const extensions::Extension* extension); | 116 int GetLazyKeepaliveCount(const extensions::Extension* extension); |
| 117 int IncrementLazyKeepaliveCount(const extensions::Extension* extension); | 117 int IncrementLazyKeepaliveCount(const extensions::Extension* extension); |
| 118 int DecrementLazyKeepaliveCount(const extensions::Extension* extension); | 118 int DecrementLazyKeepaliveCount(const extensions::Extension* extension); |
| 119 | 119 |
| 120 void IncrementLazyKeepaliveCountForView( | 120 void IncrementLazyKeepaliveCountForView( |
| 121 content::RenderViewHost* render_view_host); | 121 content::RenderViewHost* render_view_host); |
| 122 | 122 |
| 123 // Notifies an extension that it won't be unloaded after all if it is in the |
| 124 // process of being unloaded. |
| 125 void CancelSuspend(const extensions::Extension* extension); |
| 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. |
| 128 void OnUnloadAck(const std::string& extension_id); | 132 void OnUnloadAck(const std::string& extension_id); |
| 129 | 133 |
| 130 // Tracks network requests for a given RenderViewHost, used to know | 134 // Tracks network requests for a given RenderViewHost, used to know |
| 131 // when network activity is idle for lazy background pages. | 135 // when network activity is idle for lazy background pages. |
| 132 void OnNetworkRequestStarted(content::RenderViewHost* render_view_host); | 136 void OnNetworkRequestStarted(content::RenderViewHost* render_view_host); |
| (...skipping 45 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 |