summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-25 05:24:37 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-25 05:24:37 +0000
commit9602db41e8152f6dd3f2a27460b7db5a5783087c (patch)
tree2ca095245c96e6f3b189bc949edae167e30839d6 /extensions
parenta83a71cab8c73e00a1e12ce23579620a966c107a (diff)
downloadchromium_src-9602db41e8152f6dd3f2a27460b7db5a5783087c.zip
chromium_src-9602db41e8152f6dd3f2a27460b7db5a5783087c.tar.gz
chromium_src-9602db41e8152f6dd3f2a27460b7db5a5783087c.tar.bz2
Remove chrome::NOTIFICATION_PROFILE_DESTROYED usage from src/extensions
The extensions module should not be listening to Chrome notifications. Move the observation to ChromeProcessManagerDelegate. BUG=396083 TEST=browser_tests ProcessManager* and unit_tests ProcessManager* Review URL: https://codereview.chromium.org/415933003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions')
-rw-r--r--extensions/browser/process_manager.cc30
-rw-r--r--extensions/browser/process_manager.h6
-rw-r--r--extensions/browser/process_manager_unittest.cc13
3 files changed, 11 insertions, 38 deletions
diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc
index 72fbd2c..d111d62 100644
--- a/extensions/browser/process_manager.cc
+++ b/extensions/browser/process_manager.cc
@@ -263,12 +263,6 @@ ProcessManager::ProcessManager(BrowserContext* context,
content::NotificationService::AllSources());
registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
content::NotificationService::AllSources());
- registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
- content::Source<BrowserContext>(context));
- if (context->IsOffTheRecord()) {
- registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
- content::Source<BrowserContext>(original_context));
- }
// Note: event_page_idle_time_ must be sufficiently larger (e.g. 2x) than
// kKeepaliveThrottleIntervalInSeconds in ppapi/proxy/plugin_globals.
@@ -633,6 +627,14 @@ void ProcessManager::CancelSuspend(const Extension* extension) {
}
}
+void ProcessManager::CloseBackgroundHosts() {
+ for (ExtensionHostSet::iterator iter = background_hosts_.begin();
+ iter != background_hosts_.end();) {
+ ExtensionHostSet::iterator current = iter++;
+ delete *current;
+ }
+}
+
content::BrowserContext* ProcessManager::GetBrowserContext() const {
return site_instance_->GetBrowserContext();
}
@@ -745,14 +747,6 @@ void ProcessManager::Observe(int type,
break;
}
- case chrome::NOTIFICATION_PROFILE_DESTROYED: {
- // Close background hosts when the last browser is closed so that they
- // have time to shutdown various objects on different threads. Our
- // destructor is called too late in the shutdown sequence.
- CloseBackgroundHosts();
- break;
- }
-
default:
NOTREACHED();
}
@@ -854,14 +848,6 @@ void ProcessManager::CloseBackgroundHost(ExtensionHost* host) {
CHECK(background_hosts_.find(host) == background_hosts_.end());
}
-void ProcessManager::CloseBackgroundHosts() {
- for (ExtensionHostSet::iterator iter = background_hosts_.begin();
- iter != background_hosts_.end(); ) {
- ExtensionHostSet::iterator current = iter++;
- delete *current;
- }
-}
-
void ProcessManager::UnregisterExtension(const std::string& extension_id) {
// The lazy_keepalive_count may be greater than zero at this point because
// RenderViewHosts are still alive. During extension reloading, they will
diff --git a/extensions/browser/process_manager.h b/extensions/browser/process_manager.h
index e3c6bcf..a5422bc7 100644
--- a/extensions/browser/process_manager.h
+++ b/extensions/browser/process_manager.h
@@ -128,6 +128,9 @@ class ProcessManager : public content::NotificationObserver {
// loaded.
void MaybeCreateStartupBackgroundHosts();
+ // Called on shutdown to close our extension hosts.
+ void CloseBackgroundHosts();
+
// Gets the BrowserContext associated with site_instance_ and all other
// related SiteInstances.
content::BrowserContext* GetBrowserContext() const;
@@ -165,9 +168,6 @@ class ProcessManager : public content::NotificationObserver {
content::BrowserContext* original_context,
ExtensionRegistry* registry);
- // Called on browser shutdown to close our extension hosts.
- void CloseBackgroundHosts();
-
// content::NotificationObserver:
virtual void Observe(int type,
const content::NotificationSource& source,
diff --git a/extensions/browser/process_manager_unittest.cc b/extensions/browser/process_manager_unittest.cc
index f42e227..121f110 100644
--- a/extensions/browser/process_manager_unittest.cc
+++ b/extensions/browser/process_manager_unittest.cc
@@ -169,23 +169,10 @@ TEST_F(ProcessManagerTest, ExtensionNotificationRegistration) {
chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
incognito_context()));
- // Some notifications are observed for both incognito and original.
- EXPECT_TRUE(IsRegistered(manager2.get(),
- chrome::NOTIFICATION_PROFILE_DESTROYED,
- original_context()));
- EXPECT_TRUE(IsRegistered(manager2.get(),
- chrome::NOTIFICATION_PROFILE_DESTROYED,
- incognito_context()));
-
// Some are not observed at all.
EXPECT_FALSE(IsRegistered(manager2.get(),
chrome::NOTIFICATION_EXTENSIONS_READY,
original_context()));
-
- // This notification is observed for incognito contexts only.
- EXPECT_TRUE(IsRegistered(manager2.get(),
- chrome::NOTIFICATION_PROFILE_DESTROYED,
- incognito_context()));
}
// Test that startup background hosts are created when the extension system