Backed out 2 changesets (bug 1733498) for causing perma Localised repacks build busta...
[gecko.git] / dom / fetch / FetchStreamUtils.h
blob066d31c2802b6371498cb4e3c02a0456813557c0
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef _mozilla_dom_fetch_FetchStreamUtils_h
6 #define _mozilla_dom_fetch_FetchStreamUtils_h
8 #include "mozilla/AlreadyAddRefed.h"
9 #include "mozilla/NotNull.h"
10 #include "mozilla/dom/FetchTypes.h"
12 #include "nsIInputStream.h"
14 #include <cstdint>
16 namespace mozilla {
18 namespace ipc {
19 class PBackgroundParent;
22 namespace dom {
24 // Convert a ParentToParentStream received over IPC to an nsIInputStream. Can
25 // only be called in the parent process.
26 NotNull<nsCOMPtr<nsIInputStream>> ToInputStream(
27 const ParentToParentStream& aStream);
29 // Convert a ParentToChildStream received over IPC to an nsIInputStream. Can
30 // only be called in a content process.
31 NotNull<nsCOMPtr<nsIInputStream>> ToInputStream(
32 const ParentToChildStream& aStream);
34 // Serialize an nsIInputStream for IPC inside the parent process. Can only be
35 // called in the parent process.
36 ParentToParentStream ToParentToParentStream(
37 const NotNull<nsCOMPtr<nsIInputStream>>& aStream, int64_t aStreamSize);
39 // Serialize an nsIInputStream for IPC from the parent process to a content
40 // process. Can only be called in the parent process.
41 ParentToChildStream ToParentToChildStream(
42 const NotNull<nsCOMPtr<nsIInputStream>>& aStream, int64_t aStreamSize,
43 bool aSerializeAsLazy = true);
45 // Convert a ParentToParentStream to a ParentToChildStream. Can only be called
46 // in the parent process.
47 ParentToChildStream ToParentToChildStream(const ParentToParentStream& aStream,
48 int64_t aStreamSize);
50 } // namespace dom
52 } // namespace mozilla
54 #endif // _mozilla_dom_fetch_FetchStreamUtils_h