Index: chrome/browser/extensions/extension_message_service.cc |
=================================================================== |
--- chrome/browser/extensions/extension_message_service.cc (revision 61514) |
+++ chrome/browser/extensions/extension_message_service.cc (working copy) |
@@ -10,6 +10,8 @@ |
#include "base/values.h" |
#include "chrome/browser/child_process_security_policy.h" |
#include "chrome/browser/extensions/extension_process_manager.h" |
+#include "chrome/browser/extensions/extension_processes_api.h" |
+#include "chrome/browser/extensions/extension_processes_api_constants.h" |
#include "chrome/browser/extensions/extension_tabs_module.h" |
#include "chrome/browser/profile.h" |
#include "chrome/browser/renderer_host/render_process_host.h" |
@@ -174,10 +176,22 @@ |
extension_devtools_manager_->AddEventListener(event_name, |
render_process_id); |
} |
+ |
+ // We lazily tell the TaskManager to start updating when listeners to the |
+ // processes.onUpdated event arrive. |
+ if (event_name.compare(extension_processes_api_constants::kOnUpdated) == 0) { |
+ ExtensionProcessesEventRouter::GetInstance()->ListenerAdded(); |
+ } |
} |
void ExtensionMessageService::RemoveEventListener(const std::string& event_name, |
int render_process_id) { |
+ // If a processes.onUpdated event listener is removed (or a process with one |
+ // exits), then we let the TaskManager know that it has one fewer listener. |
+ if (event_name.compare(extension_processes_api_constants::kOnUpdated) == 0) { |
+ ExtensionProcessesEventRouter::GetInstance()->ListenerRemoved(); |
+ } |
+ |
// The RenderProcessHost may be destroyed. See AddEventListener. |
RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id); |
if (!rph || rph->ListenersIterator().IsAtEnd()) |