Bug 1526591 - Remove devtools.inspector.shapesHighlighter.enabled pref. r=rcaliman
[gecko.git] / netwerk / base / nsStreamLoader.h
blobe98f0027022c268c4e7c3f99470e15ce560c0200
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsStreamLoader_h__
7 #define nsStreamLoader_h__
9 #include "nsIThreadRetargetableStreamListener.h"
10 #include "nsIStreamLoader.h"
11 #include "nsCOMPtr.h"
12 #include "mozilla/Attributes.h"
13 #include "mozilla/Vector.h"
15 class nsIRequest;
17 namespace mozilla {
18 namespace net {
20 class nsStreamLoader final : public nsIStreamLoader,
21 public nsIThreadRetargetableStreamListener {
22 public:
23 NS_DECL_THREADSAFE_ISUPPORTS
24 NS_DECL_NSISTREAMLOADER
25 NS_DECL_NSIREQUESTOBSERVER
26 NS_DECL_NSISTREAMLISTENER
27 NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
29 nsStreamLoader();
31 static nsresult Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
33 protected:
34 ~nsStreamLoader() = default;
36 static nsresult WriteSegmentFun(nsIInputStream *, void *, const char *,
37 uint32_t, uint32_t, uint32_t *);
39 // Utility method to free mData, if present, and update other state to
40 // reflect that no data has been allocated.
41 void ReleaseData();
43 nsCOMPtr<nsIStreamLoaderObserver> mObserver;
44 nsCOMPtr<nsISupports> mContext; // the observer's context
45 nsCOMPtr<nsIRequest> mRequest;
46 nsCOMPtr<nsIRequestObserver> mRequestObserver;
48 // Buffer to accumulate incoming data. We preallocate if contentSize is
49 // available.
50 mozilla::Vector<uint8_t, 0> mData;
53 } // namespace net
54 } // namespace mozilla
56 #endif // nsStreamLoader_h__