diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-17 07:05:49 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-17 07:05:49 +0000 |
commit | 2db9e7b656a6361bb02ef9e950fa20893a8b57ac (patch) | |
tree | 72ec74450c79dbc80fb38f0f285587f989c6ce6a /extensions/browser/process_manager_delegate.h | |
parent | 0fdadd2b77d86406046dbd3bf1e4b8b097d1c503 (diff) | |
download | chromium_src-2db9e7b656a6361bb02ef9e950fa20893a8b57ac.zip chromium_src-2db9e7b656a6361bb02ef9e950fa20893a8b57ac.tar.gz chromium_src-2db9e7b656a6361bb02ef9e950fa20893a8b57ac.tar.bz2 |
Refactor code that defers extension background page loading
src/extensions depends on chrome::NOTIFICATION_PROFILE_CREATED to support deferred loading of extension background pages when the profile isn't ready yet. This is a layering violation.
* Remove Chrome concepts like "browser window ready" and "profile created" from ProcessManager. Introduce ProcessManagerDelegate with a general concept of deferring background page loading.
* Consolidate all the tricky Chrome-specific background page loading rules into ChromeProcessManagerDelegate. This keeps all the rules in one place. Annotate each block of special case code with the bug that inspired it.
* Extend unit test coverage for ProcessManager.
This will make it easier to eliminate chrome::NOTIFICATION_PROFILE_DESTROYED in ProcessManager in a later CL.
BUG=392658
TEST=unit_tests ProcessManagerTest, browser_tests ProcessManagerBrowserTest, manual
Review URL: https://codereview.chromium.org/381283002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283678 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/browser/process_manager_delegate.h')
-rw-r--r-- | extensions/browser/process_manager_delegate.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/extensions/browser/process_manager_delegate.h b/extensions/browser/process_manager_delegate.h new file mode 100644 index 0000000..7cc48c0 --- /dev/null +++ b/extensions/browser/process_manager_delegate.h @@ -0,0 +1,34 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef EXTENSIONS_BROWSER_PROCESS_MANAGER_DELEGATE_H_ +#define EXTENSIONS_BROWSER_PROCESS_MANAGER_DELEGATE_H_ + +namespace content { +class BrowserContext; +}; + +namespace extensions { + +// Customization of ProcessManager for the extension system embedder. +class ProcessManagerDelegate { + public: + virtual ~ProcessManagerDelegate() {} + + // Returns true if the embedder allows background pages for the given + // |context|. + virtual bool IsBackgroundPageAllowed( + content::BrowserContext* context) const = 0; + + // Returns true if the embedder wishes to defer starting up the renderers for + // extension background pages. If the embedder returns true it must call + // ProcessManager::MaybeCreateStartupBackgroundHosts() when it is ready. See + // ChromeProcessManagerDelegate for examples of how this is useful. + virtual bool DeferCreatingStartupBackgroundHosts( + content::BrowserContext* context) const = 0; +}; + +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_DELEGATE_H_ |