Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 "nsIStreamLoader.h"
10 #include "nsCOMPtr.h"
11 #include "mozilla/Attributes.h"
13 class nsIRequest;
15 class nsStreamLoader MOZ_FINAL : public nsIStreamLoader
16 {
17 public:
18 NS_DECL_ISUPPORTS
19 NS_DECL_NSISTREAMLOADER
20 NS_DECL_NSIREQUESTOBSERVER
21 NS_DECL_NSISTREAMLISTENER
23 nsStreamLoader();
24 ~nsStreamLoader();
26 static nsresult
27 Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
29 protected:
30 static NS_METHOD WriteSegmentFun(nsIInputStream *, void *, const char *,
31 uint32_t, uint32_t, uint32_t *);
33 // Utility method to free mData, if present, and update other state to
34 // reflect that no data has been allocated.
35 void ReleaseData();
37 nsCOMPtr<nsIStreamLoaderObserver> mObserver;
38 nsCOMPtr<nsISupports> mContext; // the observer's context
39 nsCOMPtr<nsIRequest> mRequest;
41 uint8_t *mData; // buffer to accumulate incoming data
42 uint32_t mAllocated; // allocated size of data buffer (we preallocate if
43 // contentSize is available)
44 uint32_t mLength; // actual length of data in buffer
45 // (must be <= mAllocated)
46 };
48 #endif // nsStreamLoader_h__