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

Unified Diff: ipc/ipc_message.cc

Issue 1330563002: Reland #1 "ipc: Add a new field num_brokered_attachments to the message header." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and add missing ampersand. 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
« no previous file with comments | « ipc/ipc_message.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message.cc
diff --git a/ipc/ipc_message.cc b/ipc/ipc_message.cc
index 07d5d254759a23d208829d86d924c5e207a56ce3..e9e1dcbab24c57abb49ab7a180a298d3f0b83447 100644
--- a/ipc/ipc_message.cc
+++ b/ipc/ipc_message.cc
@@ -46,6 +46,9 @@ Message::~Message() {
Message::Message() : base::Pickle(sizeof(Header)) {
header()->routing = header()->type = 0;
header()->flags = GetRefNumUpper24();
+#if USE_ATTACHMENT_BROKER
+ header()->num_brokered_attachments = 0;
+#endif
#if defined(OS_POSIX)
header()->num_fds = 0;
header()->pad = 0;
@@ -59,6 +62,9 @@ Message::Message(int32 routing_id, uint32 type, PriorityValue priority)
header()->type = type;
DCHECK((priority & 0xffffff00) == 0);
header()->flags = priority | GetRefNumUpper24();
+#if USE_ATTACHMENT_BROKER
+ header()->num_brokered_attachments = 0;
+#endif
#if defined(OS_POSIX)
header()->num_fds = 0;
header()->pad = 0;
@@ -131,6 +137,12 @@ bool Message::WriteAttachment(scoped_refptr<MessageAttachment> attachment) {
// We write the index of the descriptor so that we don't have to
// keep the current descriptor as extra decoding state when deserialising.
WriteInt(attachment_set()->size());
+
+#if USE_ATTACHMENT_BROKER
+ if (attachment->GetType() == MessageAttachment::TYPE_BROKERABLE_ATTACHMENT)
+ header()->num_brokered_attachments += 1;
+#endif
+
return attachment_set()->AddAttachment(attachment);
}
« no previous file with comments | « ipc/ipc_message.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698