RandomAccessStreamUtils.h (1561B)
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/. */ 6 7 #ifndef mozilla_ipc_RandomAccessStreamUtils_h 8 #define mozilla_ipc_RandomAccessStreamUtils_h 9 10 template <class T> 11 class nsCOMPtr; 12 13 class nsIInterfaceRequestor; 14 class nsIRandomAccessStream; 15 16 namespace mozilla { 17 18 template <class T> 19 class Maybe; 20 21 template <typename T> 22 class MovingNotNull; 23 24 template <typename V, typename E> 25 class Result; 26 27 namespace ipc { 28 29 class RandomAccessStreamParams; 30 31 // Serialize an nsIRandomAccessStream to be sent over IPC infallibly. 32 RandomAccessStreamParams SerializeRandomAccessStream( 33 MovingNotNull<nsCOMPtr<nsIRandomAccessStream>> aStream, 34 nsIInterfaceRequestor* aCallbacks); 35 36 Maybe<RandomAccessStreamParams> SerializeRandomAccessStream( 37 nsCOMPtr<nsIRandomAccessStream> aStream, nsIInterfaceRequestor* aCallbacks); 38 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); 43 44 Result<nsCOMPtr<nsIRandomAccessStream>, bool> DeserializeRandomAccessStream( 45 Maybe<RandomAccessStreamParams>& aStreamParams); 46 47 } // namespace ipc 48 } // namespace mozilla 49 50 #endif // mozilla_ipc_RandomAccessStreamUtils_h