/src/mozilla-central/netwerk/base/nsStreamLoader.h
Line | Count | Source (jump to first uncovered line) |
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/. */ |
5 | | |
6 | | #ifndef nsStreamLoader_h__ |
7 | | #define nsStreamLoader_h__ |
8 | | |
9 | | #include "nsIThreadRetargetableStreamListener.h" |
10 | | #include "nsIStreamLoader.h" |
11 | | #include "nsCOMPtr.h" |
12 | | #include "mozilla/Attributes.h" |
13 | | #include "mozilla/Vector.h" |
14 | | |
15 | | class nsIRequest; |
16 | | |
17 | | namespace mozilla { |
18 | | namespace net { |
19 | | |
20 | | class nsStreamLoader final : public nsIStreamLoader |
21 | | , public nsIThreadRetargetableStreamListener |
22 | | { |
23 | | public: |
24 | | NS_DECL_THREADSAFE_ISUPPORTS |
25 | | NS_DECL_NSISTREAMLOADER |
26 | | NS_DECL_NSIREQUESTOBSERVER |
27 | | NS_DECL_NSISTREAMLISTENER |
28 | | NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER |
29 | | |
30 | | nsStreamLoader(); |
31 | | |
32 | | static nsresult |
33 | | Create(nsISupports *aOuter, REFNSIID aIID, void **aResult); |
34 | | |
35 | | protected: |
36 | 0 | ~nsStreamLoader() = default; |
37 | | |
38 | | static nsresult WriteSegmentFun(nsIInputStream *, void *, const char *, |
39 | | uint32_t, uint32_t, uint32_t *); |
40 | | |
41 | | // Utility method to free mData, if present, and update other state to |
42 | | // reflect that no data has been allocated. |
43 | | void ReleaseData(); |
44 | | |
45 | | nsCOMPtr<nsIStreamLoaderObserver> mObserver; |
46 | | nsCOMPtr<nsISupports> mContext; // the observer's context |
47 | | nsCOMPtr<nsIRequest> mRequest; |
48 | | nsCOMPtr<nsIRequestObserver> mRequestObserver; |
49 | | |
50 | | // Buffer to accumulate incoming data. We preallocate if contentSize is |
51 | | // available. |
52 | | mozilla::Vector<uint8_t, 0> mData; |
53 | | }; |
54 | | |
55 | | } // namespace net |
56 | | } // namespace mozilla |
57 | | |
58 | | #endif // nsStreamLoader_h__ |