2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-02-03 02:04:47 +03:00
|
|
|
|
|
|
|
#ifndef nsStreamLoader_h__
|
|
|
|
#define nsStreamLoader_h__
|
|
|
|
|
2014-11-24 21:28:54 +03:00
|
|
|
#include "nsIThreadRetargetableStreamListener.h"
|
2000-02-03 02:04:47 +03:00
|
|
|
#include "nsIStreamLoader.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2012-06-06 07:18:25 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-10-31 05:48:30 +03:00
|
|
|
#include "mozilla/Vector.h"
|
2000-02-03 02:04:47 +03:00
|
|
|
|
2013-09-22 07:04:57 +04:00
|
|
|
class nsIRequest;
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsStreamLoader final : public nsIStreamLoader,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsIThreadRetargetableStreamListener {
|
2000-02-03 02:04:47 +03:00
|
|
|
public:
|
2014-11-24 21:28:54 +03:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2000-02-03 02:04:47 +03:00
|
|
|
NS_DECL_NSISTREAMLOADER
|
2001-04-10 10:01:08 +04:00
|
|
|
NS_DECL_NSIREQUESTOBSERVER
|
2000-02-03 02:04:47 +03:00
|
|
|
NS_DECL_NSISTREAMLISTENER
|
2014-11-24 21:28:54 +03:00
|
|
|
NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
|
2000-02-03 02:04:47 +03:00
|
|
|
|
2009-09-17 14:14:25 +04:00
|
|
|
nsStreamLoader();
|
2000-02-03 02:04:47 +03:00
|
|
|
|
2019-05-01 11:47:10 +03:00
|
|
|
static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
2000-02-03 02:04:47 +03:00
|
|
|
|
|
|
|
protected:
|
2018-04-30 19:46:04 +03:00
|
|
|
~nsStreamLoader() = default;
|
2014-06-24 20:36:44 +04:00
|
|
|
|
2019-05-01 11:47:10 +03:00
|
|
|
static nsresult WriteSegmentFun(nsIInputStream*, void*, const char*, uint32_t,
|
|
|
|
uint32_t, uint32_t*);
|
2001-12-15 01:54:56 +03:00
|
|
|
|
2014-04-17 18:59:54 +04:00
|
|
|
// Utility method to free mData, if present, and update other state to
|
|
|
|
// reflect that no data has been allocated.
|
|
|
|
void ReleaseData();
|
|
|
|
|
2000-02-03 02:04:47 +03:00
|
|
|
nsCOMPtr<nsIStreamLoaderObserver> mObserver;
|
|
|
|
nsCOMPtr<nsISupports> mContext; // the observer's context
|
2001-02-21 23:38:08 +03:00
|
|
|
nsCOMPtr<nsIRequest> mRequest;
|
2015-05-04 17:17:47 +03:00
|
|
|
nsCOMPtr<nsIRequestObserver> mRequestObserver;
|
2009-09-17 14:14:25 +04:00
|
|
|
|
2014-10-31 05:48:30 +03:00
|
|
|
// Buffer to accumulate incoming data. We preallocate if contentSize is
|
|
|
|
// available.
|
|
|
|
mozilla::Vector<uint8_t, 0> mData;
|
2000-02-03 02:04:47 +03:00
|
|
|
};
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2000-02-03 02:04:47 +03:00
|
|
|
#endif // nsStreamLoader_h__
|