1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_ipc_nsIIPCSerializableInputStream_h
8 #define mozilla_ipc_nsIIPCSerializableInputStream_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/Maybe.h"
12 #include "nsISupports.h"
13 #include "nsTArrayForwardDeclare.h"
19 class InputStreamParams
;
20 class ChildToParentStreamActorManager
;
21 class ParentToChildStreamActorManager
;
25 } // namespace mozilla
27 #define NS_IIPCSERIALIZABLEINPUTSTREAM_IID \
29 0xb0211b14, 0xea6d, 0x40d4, { \
30 0x87, 0xb5, 0x7b, 0xe3, 0xdf, 0xac, 0x09, 0xd1 \
34 class NS_NO_VTABLE nsIIPCSerializableInputStream
: public nsISupports
{
36 typedef nsTArray
<mozilla::ipc::FileDescriptor
> FileDescriptorArray
;
38 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIPCSERIALIZABLEINPUTSTREAM_IID
)
40 virtual void Serialize(
41 mozilla::ipc::InputStreamParams
& aParams
,
42 FileDescriptorArray
& aFileDescriptors
, bool aDelayedStart
,
43 uint32_t aMaxSize
, uint32_t* aSizeUsed
,
44 mozilla::ipc::ParentToChildStreamActorManager
* aManager
) = 0;
46 virtual void Serialize(
47 mozilla::ipc::InputStreamParams
& aParams
,
48 FileDescriptorArray
& aFileDescriptors
, bool aDelayedStart
,
49 uint32_t aMaxSize
, uint32_t* aSizeUsed
,
50 mozilla::ipc::ChildToParentStreamActorManager
* aManager
) = 0;
52 virtual bool Deserialize(const mozilla::ipc::InputStreamParams
& aParams
,
53 const FileDescriptorArray
& aFileDescriptors
) = 0;
56 NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream
,
57 NS_IIPCSERIALIZABLEINPUTSTREAM_IID
)
59 #define NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM \
60 virtual void Serialize( \
61 mozilla::ipc::InputStreamParams&, FileDescriptorArray&, bool, uint32_t, \
62 uint32_t*, mozilla::ipc::ParentToChildStreamActorManager*) override; \
64 virtual void Serialize( \
65 mozilla::ipc::InputStreamParams&, FileDescriptorArray&, bool, uint32_t, \
66 uint32_t*, mozilla::ipc::ChildToParentStreamActorManager*) override; \
68 virtual bool Deserialize(const mozilla::ipc::InputStreamParams&, \
69 const FileDescriptorArray&) override;
71 #define NS_FORWARD_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
72 virtual void Serialize( \
73 mozilla::ipc::InputStreamParams& aParams, \
74 FileDescriptorArray& aFileDescriptors, bool aDelayedStart, \
75 uint32_t aMaxSize, uint32_t* aSizeUsed, \
76 mozilla::ipc::ParentToChildStreamActorManager* aManager) override { \
77 _to Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
78 aSizeUsed, aManager); \
81 virtual void Serialize( \
82 mozilla::ipc::InputStreamParams& aParams, \
83 FileDescriptorArray& aFileDescriptors, bool aDelayedStart, \
84 uint32_t aMaxSize, uint32_t* aSizeUsed, \
85 mozilla::ipc::ChildToParentStreamActorManager* aManager) override { \
86 _to Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
87 aSizeUsed, aManager); \
90 virtual bool Deserialize(const mozilla::ipc::InputStreamParams& aParams, \
91 const FileDescriptorArray& aFileDescriptors) \
93 return _to Deserialize(aParams, aFileDescriptors); \
96 #define NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
97 virtual void Serialize( \
98 mozilla::ipc::InputStreamParams& aParams, \
99 FileDescriptorArray& aFileDescriptors, bool aDelayedStart, \
100 uint32_t aMaxSize, uint32_t* aSizeUsed, \
101 mozilla::ipc::ParentToChildStreamActorManager* aManager) override { \
103 _to->Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
104 aSizeUsed, aManager); \
108 virtual void Serialize( \
109 mozilla::ipc::InputStreamParams& aParams, \
110 FileDescriptorArray& aFileDescriptors, bool aDelayedStart, \
111 uint32_t aMaxSize, uint32_t* aSizeUsed, \
112 mozilla::ipc::ChildToParentStreamActorManager* aManager) override { \
114 _to->Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
115 aSizeUsed, aManager); \
119 virtual bool Deserialize(const mozilla::ipc::InputStreamParams& aParams, \
120 const FileDescriptorArray& aFileDescriptors) \
122 return _to ? _to->Deserialize(aParams, aFileDescriptors) : false; \
125 #endif // mozilla_ipc_nsIIPCSerializableInputStream_h