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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 24733002: Enable sending MessagePorts to a different renderer (Chromium side) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index b2f016960d8ecda8aba7f805a636894b444577dc..59c0c913bd222f1b54d873d264f1dddc724bdd4d 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -34,6 +34,8 @@
#include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/host_zoom_map_impl.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
+#include "content/browser/message_port_message_filter.h"
+#include "content/browser/message_port_service.h"
#include "content/browser/power_save_blocker_impl.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
@@ -3358,6 +3360,21 @@ void WebContentsImpl::RouteMessageEvent(
ViewMsg_PostMessage_Params new_params(params);
+ if (!params.message_port_ids.empty()) {
+ MessagePortMessageFilter* message_port_message_filter =
+ static_cast<RenderProcessHostImpl*>(GetRenderProcessHost())
+ ->message_port_message_filter();
+ std::vector<int> new_routing_ids(params.message_port_ids.size());
+ for (size_t i = 0; i < params.message_port_ids.size(); ++i) {
+ new_routing_ids[i] = message_port_message_filter->GetNextRoutingID();
+ MessagePortService::GetInstance()->UpdateMessagePort(
+ params.message_port_ids[i],
+ message_port_message_filter,
+ new_routing_ids[i]);
+ }
+ new_params.new_routing_ids = new_routing_ids;
+ }
+
// If there is a source_routing_id, translate it to the routing ID for
// the equivalent swapped out RVH in the target process. If we need
// to create a swapped out RVH for the source tab, we create its opener
« no previous file with comments | « content/browser/renderer_host/render_view_host_manager_browsertest.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698