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

Unified Diff: chrome/browser/extensions/api/messaging/extension_message_port.cc

Issue 2529213002: Delete TODO-comment about guest process/frame IDs in MessageService::OpenChannelImpl (Closed)
Patch Set: Created 4 years, 1 month 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
Index: chrome/browser/extensions/api/messaging/extension_message_port.cc
diff --git a/chrome/browser/extensions/api/messaging/extension_message_port.cc b/chrome/browser/extensions/api/messaging/extension_message_port.cc
index 2e7f595275062100631e5b98fd508baff4370863..71caf4e71e912d5de596ef0aedf57ab175c109fe 100644
--- a/chrome/browser/extensions/api/messaging/extension_message_port.cc
+++ b/chrome/browser/extensions/api/messaging/extension_message_port.cc
@@ -13,6 +13,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
+#include "content/public/common/child_process_host.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/process_manager_observer.h"
@@ -196,8 +197,9 @@ void ExtensionMessagePort::DispatchOnConnect(
const std::string& channel_name,
std::unique_ptr<base::DictionaryValue> source_tab,
int source_frame_id,
- int guest_process_id,
- int guest_render_frame_routing_id,
+ bool include_guest_process_info,
+ int source_process_id,
+ int source_render_frame_routing_id,
const std::string& source_extension_id,
const std::string& target_extension_id,
const GURL& source_url,
@@ -213,8 +215,17 @@ void ExtensionMessagePort::DispatchOnConnect(
info.target_id = target_extension_id;
info.source_id = source_extension_id;
info.source_url = source_url;
- info.guest_process_id = guest_process_id;
- info.guest_render_frame_routing_id = guest_render_frame_routing_id;
+ info.guest_process_id = include_guest_process_info
dcheng 2016/11/27 01:08:18 I thought we try not to plumb process ID informati
+ ? source_process_id
+ : content::ChildProcessHost::kInvalidUniqueID;
+ info.source_render_frame_routing_id = source_render_frame_routing_id;
+ // As an optimization, SendToPort will broadcast messages targeting extensions
+ // to the extension process instead of its individual frames. As a result, if
+ // the sender is also in the extension process, it will also be notified. This
+ // flag (together with |source_render_frame_routing_id|) is used to avoid
+ // unnecessarily dispatching onConnect to the sending frame in this case.
+ info.source_is_in_same_process =
+ extension_process_ && extension_process_->GetID() == source_process_id;
SendToPort(base::MakeUnique<ExtensionMsg_DispatchOnConnect>(
MSG_ROUTING_NONE, port_id_, channel_name, source, info, tls_channel_id));

Powered by Google App Engine
This is Rietveld 408576698