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

Unified Diff: ipc/ipc_message.h

Issue 883093003: IPC::Message Refactoring: Move POSIX specific bits to PlatformFileAttachment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing Windows build error Created 5 years, 11 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 | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_message.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message.h
diff --git a/ipc/ipc_message.h b/ipc/ipc_message.h
index 09d335cb0b1582289ce5467dd9ba8c8b654c45dc..2d677aa67b396ad16dae85986ba3449d3c56ab6c 100644
--- a/ipc/ipc_message.h
+++ b/ipc/ipc_message.h
@@ -8,7 +8,8 @@
#include <string>
#include "base/basictypes.h"
-#include "base/files/file.h"
+#include "base/debug/trace_event.h"
+#include "base/memory/ref_counted.h"
#include "base/pickle.h"
#include "base/trace_event/trace_event.h"
#include "ipc/ipc_export.h"
@@ -17,15 +18,12 @@
#define IPC_MESSAGE_LOG_ENABLED
#endif
-#if defined(OS_POSIX)
-#include "base/memory/ref_counted.h"
-#endif
-
namespace IPC {
//------------------------------------------------------------------------------
struct LogData;
+class MessageAttachment;
class MessageAttachmentSet;
class IPC_EXPORT Message : public Pickle {
@@ -169,21 +167,15 @@ class IPC_EXPORT Message : public Pickle {
return Pickle::FindNext(sizeof(Header), range_start, range_end);
}
-#if defined(OS_POSIX)
- // On POSIX, a message supports reading / writing FileDescriptor objects.
- // This is used to pass a file descriptor to the peer of an IPC channel.
-
- // Add a descriptor to the end of the set. Returns false if the set is full.
- bool WriteFile(base::ScopedFD descriptor);
- bool WriteBorrowingFile(const base::PlatformFile& descriptor);
-
- // Get a file descriptor from the message. Returns false on error.
- // iter: a Pickle iterator to the current location in the message.
- bool ReadFile(PickleIterator* iter, base::ScopedFD* file) const;
-
- // Returns true if there are any file descriptors in this message.
- bool HasFileDescriptors() const;
-#endif
+ // WriteAttachment appends |attachment| to the end of the set. It returns
+ // false iff the set is full.
+ bool WriteAttachment(scoped_refptr<MessageAttachment> attachment);
+ // ReadAttachment parses an attachment given the parsing state |iter| and
+ // writes it to |*attachment|. It returns true on success.
+ bool ReadAttachment(PickleIterator* iter,
+ scoped_refptr<MessageAttachment>* attachment) const;
+ // Returns true if there are any attachment in this message.
+ bool HasAttachments() const;
#ifdef IPC_MESSAGE_LOG_ENABLED
// Adds the outgoing time from Time::Now() at the end of the message and sets
« no previous file with comments | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698