Index: ipc/ipc_channel.cc |
diff --git a/ipc/ipc_channel.cc b/ipc/ipc_channel.cc |
index ac09c5ab1ef1d00b31c4f3a2e7b0a260673dbfbe..89505cb5f76e40ebae0075197c95b3199a0f7fbf 100644 |
--- a/ipc/ipc_channel.cc |
+++ b/ipc/ipc_channel.cc |
@@ -41,4 +41,26 @@ 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(void* buffer, size_t length) |
+ : message_(nullptr), buffer_(buffer), length_(length) {} |
+ |
+Channel::OutputElement::~OutputElement() { |
+ free(buffer_); |
+} |
+ |
+size_t Channel::OutputElement::size() const { |
+ if (message_) |
+ return message_->size(); |
+ return length_; |
+} |
+ |
+const void* Channel::OutputElement::data() const { |
+ if (message_) |
+ return message_->data(); |
+ return buffer_; |
+} |
+ |
} // namespace IPC |