Coverage Report

Created: 2018-09-25 14:53

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