Line data Source code
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/. */
6 :
7 : #ifndef mozilla_dom_TemporaryBlobImpl_h
8 : #define mozilla_dom_TemporaryBlobImpl_h
9 :
10 : #include "BaseBlobImpl.h"
11 : #include "nsTemporaryFileInputStream.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : class TemporaryBlobImpl final : public BaseBlobImpl
17 : {
18 : public:
19 : NS_DECL_ISUPPORTS_INHERITED
20 :
21 : TemporaryBlobImpl(PRFileDesc* aFD, uint64_t aStartPos,
22 : uint64_t aLength, const nsAString& aContentType);
23 :
24 : virtual void GetInternalStream(nsIInputStream** aStream,
25 : ErrorResult& aRv) override;
26 :
27 : virtual already_AddRefed<BlobImpl>
28 : CreateSlice(uint64_t aStart, uint64_t aLength,
29 : const nsAString& aContentType, ErrorResult& aRv) override;
30 :
31 : private:
32 : TemporaryBlobImpl(const TemporaryBlobImpl* aOther,
33 : uint64_t aStart, uint64_t aLength,
34 : const nsAString& aContentType);
35 :
36 0 : ~TemporaryBlobImpl() = default;
37 :
38 : uint64_t mStartPos;
39 : RefPtr<nsTemporaryFileInputStream::FileDescOwner> mFileDescOwner;
40 : };
41 :
42 : } // namespace dom
43 : } // namespace mozilla
44 :
45 : #endif // mozilla_dom_TemporaryBlobImpl_h
|