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

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

Issue 283313002: Ensure that any IPC sent from a child process that couldn't be deserialized causes that p… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 years, 7 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/renderer_host/render_process_host_impl.cc
===================================================================
--- content/browser/renderer_host/render_process_host_impl.cc (revision 270662)
+++ content/browser/renderer_host/render_process_host_impl.cc (working copy)
@@ -1308,8 +1308,7 @@
mark_child_process_activity_time();
if (msg.routing_id() == MSG_ROUTING_CONTROL) {
// Dispatch control messages.
- bool msg_is_ok = true;
- IPC_BEGIN_MESSAGE_MAP_EX(RenderProcessHostImpl, msg, msg_is_ok)
+ IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
OnShutdownRequest)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone,
@@ -1322,15 +1321,8 @@
// Adding single handlers for your service here is fine, but once your
// service needs more than one handler, please extract them into a new
// message filter and add that filter to CreateMessageFilters().
- IPC_END_MESSAGE_MAP_EX()
+ IPC_END_MESSAGE_MAP()
- if (!msg_is_ok) {
- // The message had a handler, but its de-serialization failed.
- // We consider this a capital crime. Kill the renderer if we have one.
- LOG(ERROR) << "bad message " << msg.type() << " terminating renderer.";
- RecordAction(base::UserMetricsAction("BadMessageTerminate_BRPH"));
- ReceivedBadMessage();
- }
return true;
}
@@ -1347,11 +1339,10 @@
// If this is a SwapBuffers, we need to ack it if we're not going to handle
// it so that the GPU process doesn't get stuck in unscheduled state.
- bool msg_is_ok = true;
- IPC_BEGIN_MESSAGE_MAP_EX(RenderProcessHostImpl, msg, msg_is_ok)
+ IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg)
IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped,
OnCompositorSurfaceBuffersSwappedNoHost)
- IPC_END_MESSAGE_MAP_EX()
+ IPC_END_MESSAGE_MAP()
return true;
}
return listener->OnMessageReceived(msg);
@@ -1372,6 +1363,14 @@
ProcessDied(true /* already_dead */);
}
+void RenderProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) {
+ // Message de-serialization failed. We consider this a capital crime. Kill the
+ // renderer if we have one.
+ LOG(ERROR) << "bad message " << message.type() << " terminating renderer.";
+ RecordAction(base::UserMetricsAction("BadMessageTerminate_BRPH"));
+ ReceivedBadMessage();
+}
+
BrowserContext* RenderProcessHostImpl::GetBrowserContext() const {
return browser_context_;
}

Powered by Google App Engine
This is Rietveld 408576698