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 // Determines whether ExtensionHost creation for background hosts is to be |
| 138 // deferred until CreateDeferredBackgroundHosts is called. If |defer| is |
| 139 // true, then it will be deferred. |
| 140 void DeferBackgroundHostCreation(bool defer); |
| 141 |
| 142 // Cause any background ExtensionHosts that were deferred to be created. |
| 143 void CreateDeferredBackgroundHosts(); |
| 144 |
137 protected: | 145 protected: |
138 explicit ExtensionProcessManager(Profile* profile); | 146 explicit ExtensionProcessManager(Profile* profile); |
139 | 147 |
140 // Called just after |host| is created so it can be registered in our lists. | 148 // Called just after |host| is created so it can be registered in our lists. |
141 void OnExtensionHostCreated(extensions::ExtensionHost* host, | 149 void OnExtensionHostCreated(extensions::ExtensionHost* host, |
142 bool is_background); | 150 bool is_background); |
143 | 151 |
144 // Called on browser shutdown to close our extension hosts. | 152 // Called on browser shutdown to close our extension hosts. |
145 void CloseBackgroundHosts(); | 153 void CloseBackgroundHosts(); |
146 | 154 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 BackgroundPageDataMap background_page_data_; | 220 BackgroundPageDataMap background_page_data_; |
213 | 221 |
214 // The time to delay between an extension becoming idle and | 222 // The time to delay between an extension becoming idle and |
215 // sending a ShouldSuspend message; read from command-line switch. | 223 // sending a ShouldSuspend message; read from command-line switch. |
216 base::TimeDelta event_page_idle_time_; | 224 base::TimeDelta event_page_idle_time_; |
217 | 225 |
218 // The time to delay between sending a ShouldSuspend message and | 226 // The time to delay between sending a ShouldSuspend message and |
219 // sending a Suspend message; read from command-line switch. | 227 // sending a Suspend message; read from command-line switch. |
220 base::TimeDelta event_page_suspending_time_; | 228 base::TimeDelta event_page_suspending_time_; |
221 | 229 |
| 230 // If true, then creation of background hosts is suspended until |
| 231 // CreateDeferredBackgroundHosts is called. |
| 232 bool defer_background_host_creation_; |
| 233 |
222 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; | 234 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; |
223 | 235 |
224 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; | 236 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; |
225 | 237 |
226 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 238 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
227 }; | 239 }; |
228 | 240 |
229 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 241 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
OLD | NEW |