ipc/glue/nsIIPCSerializableInputStream.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef mozilla_ipc_nsIIPCSerializableInputStream_h
michael@0 6 #define mozilla_ipc_nsIIPCSerializableInputStream_h
michael@0 7
michael@0 8 #include "nsISupports.h"
michael@0 9 #include "mozilla/Attributes.h"
michael@0 10
michael@0 11 struct nsTArrayDefaultAllocator;
michael@0 12 template <class> class nsTArray;
michael@0 13
michael@0 14 namespace mozilla {
michael@0 15 namespace ipc {
michael@0 16
michael@0 17 class FileDescriptor;
michael@0 18 class InputStreamParams;
michael@0 19
michael@0 20 } // namespace ipc
michael@0 21 } // namespace mozilla
michael@0 22
michael@0 23 #define NS_IIPCSERIALIZABLEINPUTSTREAM_IID \
michael@0 24 {0xb0211b14, 0xea6d, 0x40d4, {0x87, 0xb5, 0x7b, 0xe3, 0xdf, 0xac, 0x09, 0xd1}}
michael@0 25
michael@0 26 class NS_NO_VTABLE nsIIPCSerializableInputStream : public nsISupports
michael@0 27 {
michael@0 28 public:
michael@0 29 typedef nsTArray<mozilla::ipc::FileDescriptor>
michael@0 30 FileDescriptorArray;
michael@0 31
michael@0 32 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIPCSERIALIZABLEINPUTSTREAM_IID)
michael@0 33
michael@0 34 virtual void
michael@0 35 Serialize(mozilla::ipc::InputStreamParams& aParams,
michael@0 36 FileDescriptorArray& aFileDescriptors) = 0;
michael@0 37
michael@0 38 virtual bool
michael@0 39 Deserialize(const mozilla::ipc::InputStreamParams& aParams,
michael@0 40 const FileDescriptorArray& aFileDescriptors) = 0;
michael@0 41 };
michael@0 42
michael@0 43 NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream,
michael@0 44 NS_IIPCSERIALIZABLEINPUTSTREAM_IID)
michael@0 45
michael@0 46 #define NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM \
michael@0 47 virtual void \
michael@0 48 Serialize(mozilla::ipc::InputStreamParams&, \
michael@0 49 FileDescriptorArray&) MOZ_OVERRIDE; \
michael@0 50 \
michael@0 51 virtual bool \
michael@0 52 Deserialize(const mozilla::ipc::InputStreamParams&, \
michael@0 53 const FileDescriptorArray&) MOZ_OVERRIDE;
michael@0 54
michael@0 55 #define NS_FORWARD_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
michael@0 56 virtual void \
michael@0 57 Serialize(mozilla::ipc::InputStreamParams& aParams, \
michael@0 58 FileDescriptorArray& aFileDescriptors) MOZ_OVERRIDE \
michael@0 59 { \
michael@0 60 _to Serialize(aParams, aFileDescriptors); \
michael@0 61 } \
michael@0 62 \
michael@0 63 virtual bool \
michael@0 64 Deserialize(const mozilla::ipc::InputStreamParams& aParams, \
michael@0 65 const FileDescriptorArray& aFileDescriptors) MOZ_OVERRIDE \
michael@0 66 { \
michael@0 67 return _to Deserialize(aParams, aFileDescriptors); \
michael@0 68 }
michael@0 69
michael@0 70 #define NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
michael@0 71 virtual void \
michael@0 72 Serialize(mozilla::ipc::InputStreamParams& aParams, \
michael@0 73 FileDescriptorArray& aFileDescriptors) MOZ_OVERRIDE \
michael@0 74 { \
michael@0 75 if (_to) { \
michael@0 76 _to->Serialize(aParams, aFileDescriptors); \
michael@0 77 } \
michael@0 78 } \
michael@0 79 \
michael@0 80 virtual bool \
michael@0 81 Deserialize(const mozilla::ipc::InputStreamParams& aParams, \
michael@0 82 const FileDescriptorArray& aFileDescriptors) MOZ_OVERRIDE \
michael@0 83 { \
michael@0 84 return _to ? _to->Deserialize(aParams, aFileDescriptors) : false; \
michael@0 85 }
michael@0 86
michael@0 87 #endif // mozilla_ipc_nsIIPCSerializableInputStream_h

mercurial