OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
6 #define EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 6 #define EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 content::BrowserContext* GetBrowserContext() const; | 141 content::BrowserContext* GetBrowserContext() const; |
142 | 142 |
143 // Sets callbacks for testing keepalive impulse behavior. | 143 // Sets callbacks for testing keepalive impulse behavior. |
144 typedef base::Callback<void(const std::string& extension_id)> | 144 typedef base::Callback<void(const std::string& extension_id)> |
145 ImpulseCallbackForTesting; | 145 ImpulseCallbackForTesting; |
146 void SetKeepaliveImpulseCallbackForTesting( | 146 void SetKeepaliveImpulseCallbackForTesting( |
147 const ImpulseCallbackForTesting& callback); | 147 const ImpulseCallbackForTesting& callback); |
148 void SetKeepaliveImpulseDecrementCallbackForTesting( | 148 void SetKeepaliveImpulseDecrementCallbackForTesting( |
149 const ImpulseCallbackForTesting& callback); | 149 const ImpulseCallbackForTesting& callback); |
150 | 150 |
| 151 // Sets the time in milliseconds that an extension event page can |
| 152 // be idle before it is shut down; must be > 0. |
| 153 static void SetEventPageIdleTimeForTesting(unsigned idle_time_msec); |
| 154 |
| 155 // Sets the time in milliseconds that an extension event page has |
| 156 // between being notified of its impending unload and that unload |
| 157 // happening. |
| 158 static void SetEventPageSuspendingTimeForTesting( |
| 159 unsigned suspending_time_msec); |
| 160 |
151 // Creates a non-incognito instance for tests. |registry| allows unit tests | 161 // Creates a non-incognito instance for tests. |registry| allows unit tests |
152 // to inject an ExtensionRegistry that is not managed by the usual | 162 // to inject an ExtensionRegistry that is not managed by the usual |
153 // BrowserContextKeyedServiceFactory system. | 163 // BrowserContextKeyedServiceFactory system. |
154 static ProcessManager* CreateForTesting(content::BrowserContext* context, | 164 static ProcessManager* CreateForTesting(content::BrowserContext* context, |
155 ExtensionRegistry* registry); | 165 ExtensionRegistry* registry); |
156 | 166 |
157 // Creates an incognito-context instance for tests. | 167 // Creates an incognito-context instance for tests. |
158 static ProcessManager* CreateIncognitoForTesting( | 168 static ProcessManager* CreateIncognitoForTesting( |
159 content::BrowserContext* incognito_context, | 169 content::BrowserContext* incognito_context, |
160 content::BrowserContext* original_context, | 170 content::BrowserContext* original_context, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 251 |
242 void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached); | 252 void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached); |
243 | 253 |
244 // Contains all active extension-related RenderViewHost instances for all | 254 // Contains all active extension-related RenderViewHost instances for all |
245 // extensions. We also keep a cache of the host's view type, because that | 255 // extensions. We also keep a cache of the host's view type, because that |
246 // information is not accessible at registration/deregistration time. | 256 // information is not accessible at registration/deregistration time. |
247 ExtensionRenderViews all_extension_views_; | 257 ExtensionRenderViews all_extension_views_; |
248 | 258 |
249 BackgroundPageDataMap background_page_data_; | 259 BackgroundPageDataMap background_page_data_; |
250 | 260 |
251 // The time to delay between an extension becoming idle and | |
252 // sending a ShouldSuspend message; read from command-line switch. | |
253 base::TimeDelta event_page_idle_time_; | |
254 | |
255 // The time to delay between sending a ShouldSuspend message and | |
256 // sending a Suspend message; read from command-line switch. | |
257 base::TimeDelta event_page_suspending_time_; | |
258 | |
259 // True if we have created the startup set of background hosts. | 261 // True if we have created the startup set of background hosts. |
260 bool startup_background_hosts_created_; | 262 bool startup_background_hosts_created_; |
261 | 263 |
262 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; | 264 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; |
263 | 265 |
264 ImpulseCallbackForTesting keepalive_impulse_callback_for_testing_; | 266 ImpulseCallbackForTesting keepalive_impulse_callback_for_testing_; |
265 ImpulseCallbackForTesting keepalive_impulse_decrement_callback_for_testing_; | 267 ImpulseCallbackForTesting keepalive_impulse_decrement_callback_for_testing_; |
266 | 268 |
267 ObserverList<ProcessManagerObserver> observer_list_; | 269 ObserverList<ProcessManagerObserver> observer_list_; |
268 | 270 |
(...skipping 14 matching lines...) Expand all Loading... |
283 | 285 |
284 // Must be last member, see doc on WeakPtrFactory. | 286 // Must be last member, see doc on WeakPtrFactory. |
285 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; | 287 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; |
286 | 288 |
287 DISALLOW_COPY_AND_ASSIGN(ProcessManager); | 289 DISALLOW_COPY_AND_ASSIGN(ProcessManager); |
288 }; | 290 }; |
289 | 291 |
290 } // namespace extensions | 292 } // namespace extensions |
291 | 293 |
292 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 294 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
OLD | NEW |