1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/glue/nsIIPCSerializableInputStream.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef mozilla_ipc_nsIIPCSerializableInputStream_h 1.9 +#define mozilla_ipc_nsIIPCSerializableInputStream_h 1.10 + 1.11 +#include "nsISupports.h" 1.12 +#include "mozilla/Attributes.h" 1.13 + 1.14 +struct nsTArrayDefaultAllocator; 1.15 +template <class> class nsTArray; 1.16 + 1.17 +namespace mozilla { 1.18 +namespace ipc { 1.19 + 1.20 +class FileDescriptor; 1.21 +class InputStreamParams; 1.22 + 1.23 +} // namespace ipc 1.24 +} // namespace mozilla 1.25 + 1.26 +#define NS_IIPCSERIALIZABLEINPUTSTREAM_IID \ 1.27 + {0xb0211b14, 0xea6d, 0x40d4, {0x87, 0xb5, 0x7b, 0xe3, 0xdf, 0xac, 0x09, 0xd1}} 1.28 + 1.29 +class NS_NO_VTABLE nsIIPCSerializableInputStream : public nsISupports 1.30 +{ 1.31 +public: 1.32 + typedef nsTArray<mozilla::ipc::FileDescriptor> 1.33 + FileDescriptorArray; 1.34 + 1.35 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIPCSERIALIZABLEINPUTSTREAM_IID) 1.36 + 1.37 + virtual void 1.38 + Serialize(mozilla::ipc::InputStreamParams& aParams, 1.39 + FileDescriptorArray& aFileDescriptors) = 0; 1.40 + 1.41 + virtual bool 1.42 + Deserialize(const mozilla::ipc::InputStreamParams& aParams, 1.43 + const FileDescriptorArray& aFileDescriptors) = 0; 1.44 +}; 1.45 + 1.46 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream, 1.47 + NS_IIPCSERIALIZABLEINPUTSTREAM_IID) 1.48 + 1.49 +#define NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM \ 1.50 + virtual void \ 1.51 + Serialize(mozilla::ipc::InputStreamParams&, \ 1.52 + FileDescriptorArray&) MOZ_OVERRIDE; \ 1.53 + \ 1.54 + virtual bool \ 1.55 + Deserialize(const mozilla::ipc::InputStreamParams&, \ 1.56 + const FileDescriptorArray&) MOZ_OVERRIDE; 1.57 + 1.58 +#define NS_FORWARD_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \ 1.59 + virtual void \ 1.60 + Serialize(mozilla::ipc::InputStreamParams& aParams, \ 1.61 + FileDescriptorArray& aFileDescriptors) MOZ_OVERRIDE \ 1.62 + { \ 1.63 + _to Serialize(aParams, aFileDescriptors); \ 1.64 + } \ 1.65 + \ 1.66 + virtual bool \ 1.67 + Deserialize(const mozilla::ipc::InputStreamParams& aParams, \ 1.68 + const FileDescriptorArray& aFileDescriptors) MOZ_OVERRIDE \ 1.69 + { \ 1.70 + return _to Deserialize(aParams, aFileDescriptors); \ 1.71 + } 1.72 + 1.73 +#define NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \ 1.74 + virtual void \ 1.75 + Serialize(mozilla::ipc::InputStreamParams& aParams, \ 1.76 + FileDescriptorArray& aFileDescriptors) MOZ_OVERRIDE \ 1.77 + { \ 1.78 + if (_to) { \ 1.79 + _to->Serialize(aParams, aFileDescriptors); \ 1.80 + } \ 1.81 + } \ 1.82 + \ 1.83 + virtual bool \ 1.84 + Deserialize(const mozilla::ipc::InputStreamParams& aParams, \ 1.85 + const FileDescriptorArray& aFileDescriptors) MOZ_OVERRIDE \ 1.86 + { \ 1.87 + return _to ? _to->Deserialize(aParams, aFileDescriptors) : false; \ 1.88 + } 1.89 + 1.90 +#endif // mozilla_ipc_nsIIPCSerializableInputStream_h