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

Unified Diff: ipc/ipc_channel_proxy.cc

Issue 975903002: Add a flag to dump IPC messages sent from the renderer to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove BUILD.gn changes, since the IPC fuzzer doesn't work with gn Created 5 years, 9 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
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | tools/ipc_fuzzer/dump/dump.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_proxy.cc
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc
index 37be200abc7a6ba254961ca23fd676ee580e27d1..66b66868cdb9394e59299c176a853abd57e2c8c8 100644
--- a/ipc/ipc_channel_proxy.cc
+++ b/ipc/ipc_channel_proxy.cc
@@ -252,7 +252,7 @@ void ChannelProxy::Context::AddFilter(MessageFilter* filter) {
// Called on the listener's thread
void ChannelProxy::Context::OnDispatchMessage(const Message& message) {
-#ifdef IPC_MESSAGE_LOG_ENABLED
+#if defined(IPC_MESSAGE_LOG_ENABLED)
Logging* logger = Logging::GetInstance();
std::string name;
logger->GetMessageText(message.type(), &name, &message, NULL);
@@ -337,12 +337,18 @@ scoped_ptr<ChannelProxy> ChannelProxy::Create(
ChannelProxy::ChannelProxy(Context* context)
: context_(context),
did_init_(false) {
+#if defined(ENABLE_IPC_FUZZER)
+ outgoing_message_filter_ = NULL;
+#endif
}
ChannelProxy::ChannelProxy(
Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner)
: context_(new Context(listener, ipc_task_runner)), did_init_(false) {
+#if defined(ENABLE_IPC_FUZZER)
+ outgoing_message_filter_ = NULL;
+#endif
}
ChannelProxy::~ChannelProxy() {
@@ -411,6 +417,14 @@ bool ChannelProxy::Send(Message* message) {
// TODO(alexeypa): add DCHECK(CalledOnValidThread()) here. Currently there are
// tests that call Send() from a wrong thread. See http://crbug.com/163523.
+#ifdef ENABLE_IPC_FUZZER
+ // In IPC fuzzing builds, it is possible to define a filter to apply to
+ // outgoing messages. It will either rewrite the message and return a new
+ // one, freeing the original, or return the message unchanged.
+ if (outgoing_message_filter())
+ message = outgoing_message_filter()->Rewrite(message);
+#endif
+
#ifdef IPC_MESSAGE_LOG_ENABLED
Logging::GetInstance()->OnSendMessage(message, context_->channel_id());
#endif
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | tools/ipc_fuzzer/dump/dump.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698