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
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_ipc_RandomAccessStreamUtils_h
8 #define mozilla_ipc_RandomAccessStreamUtils_h
13 class nsIInterfaceRequestor
;
14 class nsIRandomAccessStream
;
24 template <typename V
, typename E
>
29 class RandomAccessStreamParams
;
31 // Serialize an nsIRandomAccessStream to be sent over IPC infallibly.
32 RandomAccessStreamParams
SerializeRandomAccessStream(
33 MovingNotNull
<nsCOMPtr
<nsIRandomAccessStream
>> aStream
,
34 nsIInterfaceRequestor
* aCallbacks
);
36 Maybe
<RandomAccessStreamParams
> SerializeRandomAccessStream(
37 nsCOMPtr
<nsIRandomAccessStream
> aStream
, nsIInterfaceRequestor
* aCallbacks
);
39 // Deserialize an nsIRandomAccessStream received from an actor call. These
40 // methods work in both the child and parent.
41 Result
<MovingNotNull
<nsCOMPtr
<nsIRandomAccessStream
>>, bool>
42 DeserializeRandomAccessStream(RandomAccessStreamParams
& aStreamParams
);
44 Result
<nsCOMPtr
<nsIRandomAccessStream
>, bool> DeserializeRandomAccessStream(
45 Maybe
<RandomAccessStreamParams
>& aStreamParams
);
48 } // namespace mozilla
50 #endif // mozilla_ipc_RandomAccessStreamUtils_h