summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-22 21:18:00 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-22 21:18:00 +0000
commit04f94eb6d9cd8e0049a2decc7e96cba24d6903a1 (patch)
treec31b7445aa4f8e53fa697c8a50b5de9c9ae2ca43 /chrome/browser
parent6a92c40fa37885c89d805ee0054e46666b865f89 (diff)
downloadchromium_src-04f94eb6d9cd8e0049a2decc7e96cba24d6903a1.zip
chromium_src-04f94eb6d9cd8e0049a2decc7e96cba24d6903a1.tar.gz
chromium_src-04f94eb6d9cd8e0049a2decc7e96cba24d6903a1.tar.bz2
Fix an assert caused by trying to add duplicate observers for multiple workers.
Review URL: http://codereview.chromium.org/87072 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14243 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/worker_host/worker_service.cc16
1 files changed, 5 insertions, 11 deletions
diff --git a/chrome/browser/worker_host/worker_service.cc b/chrome/browser/worker_host/worker_service.cc
index 04d9d8d..49e25bc 100644
--- a/chrome/browser/worker_host/worker_service.cc
+++ b/chrome/browser/worker_host/worker_service.cc
@@ -26,6 +26,11 @@ WorkerService* WorkerService::GetInstance() {
}
WorkerService::WorkerService() : next_worker_route_id_(0) {
+ // Receive a notification if the message filter is deleted.
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN,
+ NotificationService::AllSources());
}
WorkerService::~WorkerService() {
@@ -59,12 +64,6 @@ bool WorkerService::CreateDedicatedWorker(const GURL &url,
worker->CreateWorker(url, render_view_route_id, ++next_worker_route_id_,
renderer_route_id, filter);
- // Receive a notification if the message filter is deleted.
- NotificationService::current()->AddObserver(
- this,
- NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN,
- Source<ResourceMessageFilter>(filter));
-
return true;
}
@@ -138,9 +137,4 @@ void WorkerService::Observe(NotificationType type,
WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter);
worker->RendererShutdown(filter);
}
-
- NotificationService::current()->RemoveObserver(
- this,
- NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN,
- Source<ResourceMessageFilter>(filter));
}