Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: chrome/browser/extensions/extension_process_manager.h

Issue 10272019: Add an arbitrary delay before unloading lazy background pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_process_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h"
16 #include "base/time.h"
15 #include "content/public/common/view_type.h" 17 #include "content/public/common/view_type.h"
16 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
18 20
19 class Browser; 21 class Browser;
20 class Extension; 22 class Extension;
21 class ExtensionHost; 23 class ExtensionHost;
22 class GURL; 24 class GURL;
23 class Profile; 25 class Profile;
24 26
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 177
176 // Close the given |host| iff it's a background page. 178 // Close the given |host| iff it's a background page.
177 void CloseBackgroundHost(ExtensionHost* host); 179 void CloseBackgroundHost(ExtensionHost* host);
178 180
179 // Ensure browser object is not null except for certain situations. 181 // Ensure browser object is not null except for certain situations.
180 void EnsureBrowserWhenRequired(Browser* browser, 182 void EnsureBrowserWhenRequired(Browser* browser,
181 content::ViewType view_type); 183 content::ViewType view_type);
182 184
183 // These are called when the extension transitions between idle and active. 185 // These are called when the extension transitions between idle and active.
184 // They control the process of closing the background page when idle. 186 // They control the process of closing the background page when idle.
185 void OnLazyBackgroundPageIdle(const std::string& extension_id); 187 void OnLazyBackgroundPageIdle(const std::string& extension_id,
188 int sequence_id);
186 void OnLazyBackgroundPageActive(const std::string& extension_id); 189 void OnLazyBackgroundPageActive(const std::string& extension_id);
190 void CloseLazyBackgroundPageNow(const std::string& extension_id);
187 191
188 // Updates a potentially-registered RenderViewHost once it has been 192 // Updates a potentially-registered RenderViewHost once it has been
189 // associated with a WebContents. This allows us to gather information that 193 // associated with a WebContents. This allows us to gather information that
190 // was not available when the host was first registered. 194 // was not available when the host was first registered.
191 void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host); 195 void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host);
192 196
193 BackgroundPageDataMap background_page_data_; 197 BackgroundPageDataMap background_page_data_;
194 198
199 // The time to delay between an extension becoming idle and
200 // sending a ShouldUnload message; read from command-line switch.
201 base::TimeDelta event_page_idle_time_;
202
203 // The time to delay between sending a ShouldUnload message and
204 // sending a Unload message; read from command-line switch.
205 base::TimeDelta event_page_unloading_time_;
206
207 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_;
208
195 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); 209 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager);
196 }; 210 };
197 211
198 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ 212 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_process_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698