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

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: Some cleanup 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..078155fbdc16ca61062ae9bd9d126be11693685d 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,30 @@ 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";
awong 2011/12/21 01:56:07 I assume we'll sweep through and clean up some DLO
+ 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.
awong 2011/12/21 01:56:07 Should there be a TODO here as well?
+ if (!frame)
+ return;
+
+ RenderViewHost *rvh = RenderViewHost::FromID(frame->current_process_host_id(),
+ frame->current_route_id());
+
+ // TODO(supersat): Temporary workaround for frames not being removed from
+ // the mapper properly.
awong 2011/12/21 01:56:07 Can we state the condition on which this should be
+ if (!rvh) {
+ return;
+ }
+
+ rvh->Send(new ViewMsg_PostMessage(rvh->routing_id(),
+ frame->current_frame_id(),
+ params));
+}

Powered by Google App Engine
This is Rietveld 408576698