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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 // Tracks network requests for a given RenderViewHost, used to know | 128 // Tracks network requests for a given RenderViewHost, used to know |
129 // when network activity is idle for lazy background pages. | 129 // when network activity is idle for lazy background pages. |
130 void OnNetworkRequestStarted(content::RenderViewHost* render_view_host); | 130 void OnNetworkRequestStarted(content::RenderViewHost* render_view_host); |
131 void OnNetworkRequestDone(content::RenderViewHost* render_view_host); | 131 void OnNetworkRequestDone(content::RenderViewHost* render_view_host); |
132 | 132 |
133 // Prevents |extension|'s background page from being closed and sends the | 133 // Prevents |extension|'s background page from being closed and sends the |
134 // onSuspendCanceled() event to it. | 134 // onSuspendCanceled() event to it. |
135 void CancelSuspend(const extensions::Extension* extension); | 135 void CancelSuspend(const extensions::Extension* extension); |
136 | 136 |
| 137 // If |defer| is true background host creation is to be deferred until this is |
| 138 // called again with |defer| set to false, at which point all deferred |
| 139 // background hosts will be created. Defaults to false. |
| 140 void DeferBackgroundHostCreation(bool defer); |
| 141 |
137 protected: | 142 protected: |
138 explicit ExtensionProcessManager(Profile* profile); | 143 explicit ExtensionProcessManager(Profile* profile); |
139 | 144 |
140 // Called just after |host| is created so it can be registered in our lists. | 145 // Called just after |host| is created so it can be registered in our lists. |
141 void OnExtensionHostCreated(extensions::ExtensionHost* host, | 146 void OnExtensionHostCreated(extensions::ExtensionHost* host, |
142 bool is_background); | 147 bool is_background); |
143 | 148 |
144 // Called on browser shutdown to close our extension hosts. | 149 // Called on browser shutdown to close our extension hosts. |
145 void CloseBackgroundHosts(); | 150 void CloseBackgroundHosts(); |
146 | 151 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 BackgroundPageDataMap background_page_data_; | 217 BackgroundPageDataMap background_page_data_; |
213 | 218 |
214 // The time to delay between an extension becoming idle and | 219 // The time to delay between an extension becoming idle and |
215 // sending a ShouldSuspend message; read from command-line switch. | 220 // sending a ShouldSuspend message; read from command-line switch. |
216 base::TimeDelta event_page_idle_time_; | 221 base::TimeDelta event_page_idle_time_; |
217 | 222 |
218 // The time to delay between sending a ShouldSuspend message and | 223 // The time to delay between sending a ShouldSuspend message and |
219 // sending a Suspend message; read from command-line switch. | 224 // sending a Suspend message; read from command-line switch. |
220 base::TimeDelta event_page_suspending_time_; | 225 base::TimeDelta event_page_suspending_time_; |
221 | 226 |
| 227 // If true, then creation of background hosts is suspended. |
| 228 bool defer_background_host_creation_; |
| 229 |
222 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; | 230 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; |
223 | 231 |
224 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; | 232 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; |
225 | 233 |
226 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 234 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
227 }; | 235 }; |
228 | 236 |
229 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 237 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
OLD | NEW |