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

Side by Side Diff: chrome/browser/extensions/extension_message_service.cc

Issue 2870060: Try to fix a valgrind leak. (Closed)
Patch Set: Created 10 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_message_service.h" 5 #include "chrome/browser/extensions/extension_message_service.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/singleton.h" 8 #include "base/singleton.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 const MessagePort& port = IS_OPENER_PORT_ID(dest_port_id) ? 467 const MessagePort& port = IS_OPENER_PORT_ID(dest_port_id) ?
468 iter->second->opener : iter->second->receiver; 468 iter->second->opener : iter->second->receiver;
469 469
470 DispatchOnMessage(port, message, dest_port_id); 470 DispatchOnMessage(port, message, dest_port_id);
471 } 471 }
472 472
473 void ExtensionMessageService::DispatchEventToRenderers( 473 void ExtensionMessageService::DispatchEventToRenderers(
474 const std::string& event_name, const std::string& event_args, 474 const std::string& event_name, const std::string& event_args,
475 bool has_incognito_data, const GURL& event_url) { 475 bool has_incognito_data, const GURL& event_url) {
476 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); 476 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI);
477 ListenerMap::iterator it = listeners_.find(event_name);
478 if (it == listeners_.end())
479 return;
477 480
478 std::set<int>& pids = listeners_[event_name]; 481 std::set<int>& pids = it->second;
479 482
480 // Send the event only to renderers that are listening for it. 483 // Send the event only to renderers that are listening for it.
481 for (std::set<int>::iterator pid = pids.begin(); pid != pids.end(); ++pid) { 484 for (std::set<int>::iterator pid = pids.begin(); pid != pids.end(); ++pid) {
482 RenderProcessHost* renderer = RenderProcessHost::FromID(*pid); 485 RenderProcessHost* renderer = RenderProcessHost::FromID(*pid);
483 if (!renderer) 486 if (!renderer)
484 continue; 487 continue;
485 if (!ChildProcessSecurityPolicy::GetInstance()-> 488 if (!ChildProcessSecurityPolicy::GetInstance()->
486 HasExtensionBindings(*pid)) { 489 HasExtensionBindings(*pid)) {
487 // Don't send browser-level events to unprivileged processes. 490 // Don't send browser-level events to unprivileged processes.
488 continue; 491 continue;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 569
567 if (current->second->opener.sender == sender) { 570 if (current->second->opener.sender == sender) {
568 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), 571 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first),
569 notify_other_port); 572 notify_other_port);
570 } else if (current->second->receiver.sender == sender) { 573 } else if (current->second->receiver.sender == sender) {
571 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), 574 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first),
572 notify_other_port); 575 notify_other_port);
573 } 576 }
574 } 577 }
575 } 578 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698