Chromium Code Reviews| 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_) |
|
Tom Sepez
2015/09/10 15:41:05
nit: I'd use the ? operator here and below, just b
erikchen
2015/09/10 18:43:59
I switched to the ternary operator, and moved the
|
| + return message_->size(); |
| + return length_; |
| +} |
| + |
| +const void* Channel::OutputElement::data() const { |
| + if (message_) |
|
Tom Sepez
2015/09/10 15:41:05
do you want to assert that there isn't both messag
erikchen
2015/09/10 18:43:59
Given that that assertion is enforced by the const
|
| + return message_->data(); |
| + return buffer_; |
| +} |
| + |
| } // namespace IPC |