Chromium Code Reviews| 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 |