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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 8760024: Cross-process postMessage (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Current checkpoint Created 9 years 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/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 108514ab9659e979d8413bd0420beca7aa3b2ec0..60206d69f72aaa26af5a85cb66e9157acf656443 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -884,6 +884,7 @@ bool RenderProcessHostImpl::OnMessageReceived(const IPC::Message& msg) {
OnUserMetricsRecordAction)
IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS)
IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SendPostMessage, OnSendPostMessage)
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP_EX()
@@ -1310,3 +1311,33 @@ void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) {
content::GetContentClient()->browser()->GetMHTMLGenerationManager()->
MHTMLGenerated(job_id, data_size);
}
+
+void RenderProcessHostImpl::OnSendPostMessage(
+ int64 content_frame_id,
+ const ViewMsg_PostMessage_Params& params) {
+ DLOG(WARNING) << "OnSendPostMessage";
+ content::FrameMap* frame_mapper = GetBrowserContext()->frame_mapper();
+ content::ContentFrame* frame =
+ frame_mapper->FindFrame(content_frame_id);
+
+ // Until we remove the proxy when a frame is closed, there might be a proxy
+ // for a frame that no longer exists. If that's the case, just drop the msg.
+ if (!frame)
+ return;
+
+ const content::WebKitFrameIdentifier webkitFrameId =
+ frame->active_webkit_frame();
+
+ RenderViewHost *rvh = RenderViewHost::FromID(webkitFrameId.process_host_id,
+ webkitFrameId.route_id);
+
+ // TODO(supersat): Temporary workaround for frames not being removed from
+ // the mapper properly.
+ if (!rvh) {
+ return;
+ }
+
+ rvh->Send(new ViewMsg_PostMessage(rvh->routing_id(),
+ webkitFrameId.frame_id,
+ params));
+}
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698