diff options
author | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-27 00:36:32 +0000 |
---|---|---|
committer | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-27 00:36:32 +0000 |
commit | a7c4c03a28b7736fc0974b6015fe6b2703a2f1bc (patch) | |
tree | 2eff8d78eedde371d0b6c4d84bd71a9c043d3bd1 /chrome/browser/profiles/profile_destroyer.cc | |
parent | 0563ebe449cde8c5930a103f58e6c00554b45ae5 (diff) | |
download | chromium_src-a7c4c03a28b7736fc0974b6015fe6b2703a2f1bc.zip chromium_src-a7c4c03a28b7736fc0974b6015fe6b2703a2f1bc.tar.gz chromium_src-a7c4c03a28b7736fc0974b6015fe6b2703a2f1bc.tar.bz2 |
Move PROFILE_DESTROYED notification to ProfileDestroyer and observe it in ExtensionProcessManager.
1. EPM was not observing the correct notification to shut down its ExtensionHosts.
2. PROFILE_DESTROYED has to be sent early enough that the EPM can shut down ExtensionHosts before the ProfileDestroyer checks that all renderers are gone.
BUG=138843
TEST=In Debug build, have a split mode incognito extension installed. Open and close an incognito window; no crash. Close the regular profile window; no crash.
TBR=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10824020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148674 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profiles/profile_destroyer.cc')
-rw-r--r-- | chrome/browser/profiles/profile_destroyer.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/chrome/browser/profiles/profile_destroyer.cc b/chrome/browser/profiles/profile_destroyer.cc index fcf5f10..59f7dd5 100644 --- a/chrome/browser/profiles/profile_destroyer.cc +++ b/chrome/browser/profiles/profile_destroyer.cc @@ -24,6 +24,8 @@ std::vector<ProfileDestroyer*>* ProfileDestroyer::pending_destroyers_ = NULL; // static void ProfileDestroyer::DestroyProfileWhenAppropriate(Profile* const profile) { DCHECK(profile); + profile->MaybeSendDestroyedNotification(); + std::vector<content::RenderProcessHost*> hosts; // Testing profiles can simply be deleted directly. Some tests don't setup // RenderProcessHost correctly and don't necessary run on the UI thread @@ -85,7 +87,7 @@ ProfileDestroyer::ProfileDestroyer( pending_destroyers_->push_back(this); for (size_t i = 0; i < hosts.size(); ++i) { registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, - content::Source<content::RenderProcessHost>(hosts[i])); + content::Source<content::RenderProcessHost>(hosts[i])); // For each of the notifications, we bump up our reference count. // It will go back to 0 and free us when all hosts are terminated. ++num_hosts_; @@ -126,6 +128,8 @@ void ProfileDestroyer::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); + registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, + source); DCHECK(num_hosts_ > 0); --num_hosts_; if (num_hosts_ == 0) { |