Bug 1867190 - Initialise the PHC allocate delay later r=glandium
[gecko.git] / dom / fetch / BodyExtractor.h
blob08e5210afcf0cf72e4579ee2eba879d7addd3e38
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_dom_BodyExtractor_h
8 #define mozilla_dom_BodyExtractor_h
10 #include "nsString.h"
12 class nsIInputStream;
13 class nsIGlobalObject;
15 namespace mozilla::dom {
17 class BodyExtractorBase {
18 public:
19 virtual nsresult GetAsStream(nsIInputStream** aResult,
20 uint64_t* aContentLength,
21 nsACString& aContentTypeWithCharset,
22 nsACString& aCharset) const = 0;
25 // The implementation versions of this template are:
26 // ArrayBuffer, ArrayBufferView, Blob, FormData,
27 // URLSearchParams, nsAString, Document, nsIInputStream.
28 template <typename Type>
29 class BodyExtractor final : public BodyExtractorBase {
30 Type* mBody;
32 public:
33 explicit BodyExtractor(Type* aBody) : mBody(aBody) {}
35 nsresult GetAsStream(nsIInputStream** aResult, uint64_t* aContentLength,
36 nsACString& aContentTypeWithCharset,
37 nsACString& aCharset) const override;
40 } // namespace mozilla::dom
42 #endif // mozilla_dom_BodyExtractor_h