/src/mozilla-central/dom/file/StringBlobImpl.h
Line | Count | Source (jump to first uncovered line) |
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_StringBlobImpl_h |
8 | | #define mozilla_dom_StringBlobImpl_h |
9 | | |
10 | | #include "BaseBlobImpl.h" |
11 | | #include "nsIMemoryReporter.h" |
12 | | |
13 | | namespace mozilla { |
14 | | namespace dom { |
15 | | |
16 | | class StringBlobImpl final : public BaseBlobImpl |
17 | | , public nsIMemoryReporter |
18 | | { |
19 | | MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf) |
20 | | |
21 | | public: |
22 | | NS_DECL_ISUPPORTS_INHERITED |
23 | | NS_DECL_NSIMEMORYREPORTER |
24 | | |
25 | | static already_AddRefed<StringBlobImpl> |
26 | | Create(const nsACString& aData, const nsAString& aContentType); |
27 | | |
28 | | virtual void CreateInputStream(nsIInputStream** aStream, |
29 | | ErrorResult& aRv) override; |
30 | | |
31 | | virtual already_AddRefed<BlobImpl> |
32 | | CreateSlice(uint64_t aStart, uint64_t aLength, |
33 | | const nsAString& aContentType, ErrorResult& aRv) override; |
34 | | |
35 | | size_t GetAllocationSize() const override |
36 | 0 | { |
37 | 0 | return mData.Length(); |
38 | 0 | } |
39 | | |
40 | | size_t GetAllocationSize(FallibleTArray<BlobImpl*>& aVisitedBlobImpls) const override |
41 | 0 | { |
42 | 0 | return GetAllocationSize(); |
43 | 0 | } |
44 | | |
45 | | private: |
46 | | StringBlobImpl(const nsACString& aData, const nsAString& aContentType); |
47 | | |
48 | | ~StringBlobImpl(); |
49 | | |
50 | | nsCString mData; |
51 | | }; |
52 | | |
53 | | } // namespace dom |
54 | | } // namespace mozilla |
55 | | |
56 | | #endif // mozilla_dom_StringBlobImpl_h |