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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, 877 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
878 OnShutdownRequest) 878 OnShutdownRequest)
879 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, 879 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone,
880 OnDumpHandlesDone) 880 OnDumpHandlesDone)
881 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, 881 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged,
882 SuddenTerminationChanged) 882 SuddenTerminationChanged)
883 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, 883 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
884 OnUserMetricsRecordAction) 884 OnUserMetricsRecordAction)
885 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) 885 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS)
886 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) 886 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML)
887 IPC_MESSAGE_HANDLER(ViewHostMsg_SendPostMessage, OnSendPostMessage)
887 IPC_MESSAGE_UNHANDLED_ERROR() 888 IPC_MESSAGE_UNHANDLED_ERROR()
888 IPC_END_MESSAGE_MAP_EX() 889 IPC_END_MESSAGE_MAP_EX()
889 890
890 if (!msg_is_ok) { 891 if (!msg_is_ok) {
891 // The message had a handler, but its de-serialization failed. 892 // The message had a handler, but its de-serialization failed.
892 // We consider this a capital crime. Kill the renderer if we have one. 893 // We consider this a capital crime. Kill the renderer if we have one.
893 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer."; 894 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer.";
894 content::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); 895 content::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH"));
895 ReceivedBadMessage(); 896 ReceivedBadMessage();
896 } 897 }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { 1304 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) {
1304 // Only honor the request if appropriate persmissions are granted. 1305 // Only honor the request if appropriate persmissions are granted.
1305 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) 1306 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path))
1306 content::GetContentClient()->browser()->OpenItem(path); 1307 content::GetContentClient()->browser()->OpenItem(path);
1307 } 1308 }
1308 1309
1309 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { 1310 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) {
1310 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> 1311 content::GetContentClient()->browser()->GetMHTMLGenerationManager()->
1311 MHTMLGenerated(job_id, data_size); 1312 MHTMLGenerated(job_id, data_size);
1312 } 1313 }
1314
1315 void RenderProcessHostImpl::OnSendPostMessage(
1316 int64 content_frame_id,
1317 const ViewMsg_PostMessage_Params& params) {
1318 DLOG(WARNING) << "OnSendPostMessage";
awong 2011/12/21 01:56:07 I assume we'll sweep through and clean up some DLO
1319 content::FrameMap& frame_mapper = GetBrowserContext()->frame_mapper();
1320 content::ContentFrame* frame =
1321 frame_mapper.FindFrame(content_frame_id);
1322
1323 // Until we remove the proxy when a frame is closed, there might be a proxy
1324 // 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?
1325 if (!frame)
1326 return;
1327
1328 RenderViewHost *rvh = RenderViewHost::FromID(frame->current_process_host_id(),
1329 frame->current_route_id());
1330
1331 // TODO(supersat): Temporary workaround for frames not being removed from
1332 // the mapper properly.
awong 2011/12/21 01:56:07 Can we state the condition on which this should be
1333 if (!rvh) {
1334 return;
1335 }
1336
1337 rvh->Send(new ViewMsg_PostMessage(rvh->routing_id(),
1338 frame->current_frame_id(),
1339 params));
1340 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698