tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

FetchStreamUtils.h (1775B)


      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/. */
      4 
      5 #ifndef _mozilla_dom_fetch_FetchStreamUtils_h
      6 #define _mozilla_dom_fetch_FetchStreamUtils_h
      7 
      8 #include <cstdint>
      9 
     10 #include "mozilla/NotNull.h"
     11 #include "mozilla/dom/FetchTypes.h"
     12 #include "nsIInputStream.h"
     13 
     14 namespace mozilla {
     15 
     16 namespace ipc {
     17 class PBackgroundParent;
     18 }
     19 
     20 namespace dom {
     21 
     22 // Convert a ParentToParentStream received over IPC to an nsIInputStream. Can
     23 // only be called in the parent process.
     24 NotNull<nsCOMPtr<nsIInputStream>> ToInputStream(
     25    const ParentToParentStream& aStream);
     26 
     27 // Convert a ParentToChildStream received over IPC to an nsIInputStream. Can
     28 // only be called in a content process.
     29 NotNull<nsCOMPtr<nsIInputStream>> ToInputStream(
     30    const ParentToChildStream& aStream);
     31 
     32 // Serialize an nsIInputStream for IPC inside the parent process. Can only be
     33 // called in the parent process.
     34 ParentToParentStream ToParentToParentStream(
     35    const NotNull<nsCOMPtr<nsIInputStream>>& aStream, int64_t aStreamSize);
     36 
     37 // Serialize an nsIInputStream for IPC from the parent process to a content
     38 // process. Can only be called in the parent process.
     39 ParentToChildStream ToParentToChildStream(
     40    const NotNull<nsCOMPtr<nsIInputStream>>& aStream, int64_t aStreamSize,
     41    bool aSerializeAsLazy = true);
     42 
     43 // Convert a ParentToParentStream to a ParentToChildStream. Can only be called
     44 // in the parent process.
     45 ParentToChildStream ToParentToChildStream(const ParentToParentStream& aStream,
     46                                          int64_t aStreamSize);
     47 
     48 }  // namespace dom
     49 
     50 }  // namespace mozilla
     51 
     52 #endif  // _mozilla_dom_fetch_FetchStreamUtils_h