1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_MutableBlobStreamListener_h
8 #define mozilla_dom_MutableBlobStreamListener_h
10 #include "nsIStreamListener.h"
11 #include "nsIThreadRetargetableStreamListener.h"
12 #include "mozilla/dom/MutableBlobStorage.h"
19 class MutableBlobStreamListener final
: public nsIStreamListener
20 , public nsIThreadRetargetableStreamListener
23 NS_DECL_THREADSAFE_ISUPPORTS
24 NS_DECL_NSISTREAMLISTENER
25 NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
26 NS_DECL_NSIREQUESTOBSERVER
28 MutableBlobStreamListener(MutableBlobStorage::MutableBlobStorageType aType
,
30 const nsACString
& aContentType
,
31 MutableBlobStorageCallback
* aCallback
,
32 nsIEventTarget
* aEventTarget
= nullptr);
35 ~MutableBlobStreamListener();
38 WriteSegmentFun(nsIInputStream
* aWriter
, void* aClosure
,
39 const char* aFromSegment
, uint32_t aOffset
,
40 uint32_t aCount
, uint32_t* aWriteCount
);
42 RefPtr
<MutableBlobStorage
> mStorage
;
43 RefPtr
<MutableBlobStorageCallback
> mCallback
;
45 nsCOMPtr
<nsISupports
> mParent
;
46 MutableBlobStorage::MutableBlobStorageType mStorageType
;
47 nsCString mContentType
;
48 nsCOMPtr
<nsIEventTarget
> mEventTarget
;
52 } // namespace mozilla
54 #endif // mozilla_dom_MutableBlobStreamListener_h