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

Unified Diff: ipc/ipc_message.h

Issue 1345353004: Resize IPC input buffer to fit the next message. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests and address comments Created 5 years, 3 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: ipc/ipc_message.h
diff --git a/ipc/ipc_message.h b/ipc/ipc_message.h
index 64909df187bb0d33f86f9bb56c5724cdc6dbb1f8..4b82a629deb2e65cbf6613710000f2f5ccfe7fa3 100644
--- a/ipc/ipc_message.h
+++ b/ipc/ipc_message.h
@@ -9,6 +9,7 @@
#include <string>
+#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/pickle.h"
#include "base/trace_event/trace_event.h"
@@ -168,10 +169,14 @@ class IPC_EXPORT Message : public base::Pickle {
// The static method FindNext() returns several pieces of information, which
// are aggregated into an instance of this struct.
- struct NextMessageInfo {
+ struct IPC_EXPORT NextMessageInfo {
NextMessageInfo();
~NextMessageInfo();
+ // Total message size. Always valid if |message_found| is true.
+ // If |message_found| is false but we could determine message size
+ // from the header, this field is non-zero. Otherwise it's zero.
+ size_t message_size;
// Whether an entire message was found in the given memory range.
bool message_found;
// Only filled in if |message_found| is true.
@@ -307,6 +312,9 @@ class IPC_EXPORT Message : public base::Pickle {
mutable LogData* log_data_;
mutable bool dont_log_;
#endif
+
+ FRIEND_TEST_ALL_PREFIXES(IPCMessageTest, FindNext);
+ FRIEND_TEST_ALL_PREFIXES(IPCMessageTest, FindNextOverflow);
};
//------------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698