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

Unified Diff: ipc/ipc_channel.cc

Issue 1286253002: IPC: Add attachment brokering support to the message header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix more #ifs Created 5 years, 4 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_channel.cc
diff --git a/ipc/ipc_channel.cc b/ipc/ipc_channel.cc
index ac09c5ab1ef1d00b31c4f3a2e7b0a260673dbfbe..a495665d6f37cacaa71b0b73b59399683324049f 100644
--- a/ipc/ipc_channel.cc
+++ b/ipc/ipc_channel.cc
@@ -41,4 +41,29 @@ std::string Channel::GenerateUniqueRandomChannelID() {
base::RandInt(0, std::numeric_limits<int32>::max()));
}
+Channel::OutputElement::OutputElement(Message* message)
+ : message_(message), buffer_(nullptr), length_(0) {}
+
+Channel::OutputElement::OutputElement(const char* buffer, size_t length)
+ : message_(nullptr), buffer_(buffer), length_(length) {}
+
+Channel::OutputElement::~OutputElement() {
+ if (message_)
Tom Sepez 2015/08/17 18:29:39 no need to test before delete. just delete them.
erikchen 2015/08/18 05:59:46 Done on both counts.
+ delete message_;
+ if (buffer_)
+ delete buffer_;
+}
+
+size_t Channel::OutputElement::size() {
+ if (message_)
+ return message_->size();
+ return length_;
+}
+
+const void* Channel::OutputElement::data() {
+ if (message_)
+ return message_->data();
+ return buffer_;
+}
+
} // namespace IPC

Powered by Google App Engine
This is Rietveld 408576698