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

Unified Diff: extensions/browser/process_manager.h

Issue 381283002: Refactor code that defers extension background page loading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: larger DeferLoadingBackgroundHosts Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/process_manager.h
diff --git a/extensions/browser/process_manager.h b/extensions/browser/process_manager.h
index 664c9420fde504a05d071e6de9a9a232722b57fa..6acc267ca68e2a0711b846db04eb761de754215e 100644
--- a/extensions/browser/process_manager.h
+++ b/extensions/browser/process_manager.h
@@ -125,6 +125,14 @@ class ProcessManager : public content::NotificationObserver {
// Ensures background hosts are loaded for a new browser window.
void OnBrowserWindowReady();
+ // Notifies the ProcessManager that a BrowserContext is fully initialized.
+ // A BrowserContext might be initialized asynchronously (in parallel with
+ // extension system startup). The ProcessManager needs to know when that
+ // initialization is complete so it can load deferred background pages.
+ // (See NOTIFICATION_PROFILE_CREATED in Chrome and IsContextValid() in
+ // ExtensionsBrowserClient).
+ void OnBrowserContextValid(content::BrowserContext* context);
+
// Gets the BrowserContext associated with site_instance_ and all other
// related SiteInstances.
content::BrowserContext* GetBrowserContext() const;
@@ -144,6 +152,10 @@ class ProcessManager : public content::NotificationObserver {
content::BrowserContext* original_context,
ProcessManager* original_manager);
+ bool startup_background_hosts_created_for_test() const {
+ return startup_background_hosts_created_;
+ }
+
protected:
// If |context| is incognito pass the master context as |original_context|.
// Otherwise pass the same context for both.
@@ -158,9 +170,8 @@ class ProcessManager : public content::NotificationObserver {
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // Load all background pages once the profile data is ready and the pages
- // should be loaded.
- void CreateBackgroundHostsForProfileStartup();
+ // Loads all background pages for a BrowserContext if everything is ready.
+ void MaybeCreateBackgroundHostsForStartup();
content::NotificationRegistrar registrar_;

Powered by Google App Engine
This is Rietveld 408576698