netwerk/base/src/nsStreamLoader.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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__

mercurial