Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1141)

Unified Diff: chrome/browser/extensions/extension_message_service.cc

Issue 3597016: Expands the chrome.experimental.processes extension API.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_processes_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_processes_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698