Index: chrome/browser/profiles/profile_destroyer.cc |
diff --git a/chrome/browser/profiles/profile_destroyer.cc b/chrome/browser/profiles/profile_destroyer.cc |
index fcf5f10790015fd00f7bc65ccb7f9c1885f3f46a..ef2f51396baad971941bfa12ead522f2a60a6f2c 100644 |
--- a/chrome/browser/profiles/profile_destroyer.cc |
+++ b/chrome/browser/profiles/profile_destroyer.cc |
@@ -8,6 +8,8 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/message_loop.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/common/chrome_notification_types.h" |
+#include "content/public/browser/notification_service.h" |
#include "content/public/browser/notification_source.h" |
#include "content/public/browser/notification_types.h" |
#include "content/public/browser/render_process_host.h" |
@@ -24,6 +26,11 @@ std::vector<ProfileDestroyer*>* ProfileDestroyer::pending_destroyers_ = NULL; |
// static |
void ProfileDestroyer::DestroyProfileWhenAppropriate(Profile* const profile) { |
DCHECK(profile); |
+ content::NotificationService::current()->Notify( |
Yoyo Zhou
2012/07/25 18:13:00
I wanted to put this in the ProfileDestroyer initi
|
+ chrome::NOTIFICATION_PROFILE_DESTROYED, |
+ content::Source<Profile>(profile), |
+ content::NotificationService::NoDetails()); |
+ |
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 +92,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 +133,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, |
Yoyo Zhou
2012/07/25 18:13:00
It turns out the current implementation doesn't re
|
+ source); |
DCHECK(num_hosts_ > 0); |
--num_hosts_; |
if (num_hosts_ == 0) { |