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

Unified Diff: chrome/browser/extensions/extension_system_factory.cc

Issue 118043003: Fix app_shell shutdown crash due to BrowserContextKeyedServices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScopedFactoryForTest (shutdown_crash) Created 6 years, 11 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: chrome/browser/extensions/extension_system_factory.cc
diff --git a/chrome/browser/extensions/extension_system_factory.cc b/chrome/browser/extensions/extension_system_factory.cc
index 3289e796ac1f8b8ea08ee2b21bd852e1438bf8ee..bfe1b513290a734fb6e958528687862c00b471a3 100644
--- a/chrome/browser/extensions/extension_system_factory.cc
+++ b/chrome/browser/extensions/extension_system_factory.cc
@@ -52,8 +52,7 @@ ExtensionSystemSharedFactory::BuildServiceInstanceFor(
content::BrowserContext* ExtensionSystemSharedFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
// Redirected in incognito.
- return extensions::ExtensionsBrowserClient::Get()->
- GetOriginalContext(context);
+ return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
}
// ExtensionSystemFactory
@@ -72,24 +71,21 @@ ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() {
ExtensionSystemFactory::ExtensionSystemFactory()
: BrowserContextKeyedServiceFactory(
"ExtensionSystem",
- BrowserContextDependencyManager::GetInstance()),
- custom_instance_(NULL) {
- DependsOn(ExtensionSystemSharedFactory::GetInstance());
+ BrowserContextDependencyManager::GetInstance()) {
+ DCHECK(ExtensionsBrowserClient::Get())
+ << "ExtensionSystemFactory must be initialized after BrowserProcess";
+ std::vector<BrowserContextKeyedServiceFactory*> dependencies =
+ ExtensionsBrowserClient::Get()->GetExtensionSystemDependencies();
+ for (size_t i = 0; i < dependencies.size(); ++i)
+ DependsOn(dependencies[i]);
}
ExtensionSystemFactory::~ExtensionSystemFactory() {
}
-void ExtensionSystemFactory::SetCustomInstance(
- ExtensionSystem* extension_system) {
- custom_instance_ = extension_system;
-}
-
BrowserContextKeyedService* ExtensionSystemFactory::BuildServiceInstanceFor(
- content::BrowserContext* profile) const {
- if (custom_instance_)
- return custom_instance_;
- return new ExtensionSystemImpl(static_cast<Profile*>(profile));
+ content::BrowserContext* context) const {
+ return ExtensionsBrowserClient::Get()->CreateExtensionSystem(context);
}
content::BrowserContext* ExtensionSystemFactory::GetBrowserContextToUse(
« no previous file with comments | « chrome/browser/extensions/extension_system_factory.h ('k') | extensions/browser/extensions_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698