summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/extension_messages_unittest.cc4
-rw-r--r--chrome/common/ipc_message_utils.h11
2 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/extensions/extension_messages_unittest.cc b/chrome/browser/extensions/extension_messages_unittest.cc
index 009d574..8f830dd 100644
--- a/chrome/browser/extensions/extension_messages_unittest.cc
+++ b/chrome/browser/extensions/extension_messages_unittest.cc
@@ -47,7 +47,7 @@ TEST_F(RenderViewTest, ExtensionMessagesOpenChannel) {
ASSERT_TRUE(alert_msg);
void* iter = IPC::SyncMessage::GetDataIterator(alert_msg);
ViewHostMsg_RunJavaScriptMessage::SendParam alert_param;
- IPC::ReadParam(alert_msg, &iter, &alert_param);
+ ASSERT_TRUE(IPC::ReadParam(alert_msg, &iter, &alert_param));
EXPECT_EQ(L"content got: 42", alert_param.a);
}
@@ -90,6 +90,6 @@ TEST_F(RenderViewTest, ExtensionMessagesOnConnect) {
ASSERT_TRUE(alert_msg);
void* iter = IPC::SyncMessage::GetDataIterator(alert_msg);
ViewHostMsg_RunJavaScriptMessage::SendParam alert_param;
- IPC::ReadParam(alert_msg, &iter, &alert_param);
+ ASSERT_TRUE(IPC::ReadParam(alert_msg, &iter, &alert_param));
EXPECT_EQ(L"got: 42", alert_param.a);
}
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index 8e4e8a5..3438e52 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -121,7 +121,8 @@ static inline void WriteParam(Message* m, const P& p) {
}
template <class P>
-static inline bool ReadParam(const Message* m, void** iter, P* p) {
+static inline bool WARN_UNUSED_RESULT ReadParam(const Message* m, void** iter,
+ P* p) {
return ParamTraits<P>::Read(m, iter, p);
}
@@ -1267,8 +1268,8 @@ class MessageWithReply : public SyncMessage {
if (msg->is_sync()) {
SendParam p;
void* iter = SyncMessage::GetDataIterator(msg);
- ReadParam(msg, &iter, &p);
- LogParam(p, l);
+ if (ReadParam(msg, &iter, &p))
+ LogParam(p, l);
#if defined(IPC_MESSAGE_LOG_ENABLED)
const std::wstring& output_params = msg->output_params();
@@ -1282,8 +1283,8 @@ class MessageWithReply : public SyncMessage {
// can finally log the message.
typename ReplyParam::ValueTuple p;
void* iter = SyncMessage::GetDataIterator(msg);
- ReadParam(msg, &iter, &p);
- LogParam(p, l);
+ if (ReadParam(msg, &iter, &p))
+ LogParam(p, l);
}
}