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

Unified Diff: ipc/ipc_channel.h

Issue 1309003003: ipc: Add the inner class OutputElement to Channel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_add_header3
Patch Set: Fix typo. 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 | « no previous file | ipc/ipc_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel.h
diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h
index c74d084baac5a23099037e49594acbd594862c1b..552f2c07e982123b033e6b43f27df3e05c9694b7 100644
--- a/ipc/ipc_channel.h
+++ b/ipc/ipc_channel.h
@@ -240,6 +240,27 @@ class IPC_EXPORT Channel : public Endpoint {
// process such that it acts similar to if it was exec'd, for tests.
static void NotifyProcessForkedForTesting();
#endif
+
+ protected:
+ // An OutputElement is a wrapper around a Message or raw buffer while it is
+ // waiting to be passed to the system's underlying IPC mechanism.
+ class OutputElement {
+ public:
+ // Takes ownership of message.
+ OutputElement(Message* message);
+ // Takes ownership of the buffer. |buffer| is freed via free(), so it
+ // must be malloced.
+ OutputElement(void* buffer, size_t length);
+ ~OutputElement();
+ size_t size() const { return message_ ? message_->size() : length_; }
+ const void* data() const { return message_ ? message_->data() : buffer_; }
+ const Message* get_message() const { return message_.get(); }
+
+ private:
+ scoped_ptr<const Message> message_;
+ void* buffer_;
+ size_t length_;
+ };
};
#if defined(OS_POSIX)
« no previous file with comments | « no previous file | ipc/ipc_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698