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_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 0 : 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 GetInternalStream(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 : private:
36 : StringBlobImpl(const nsACString& aData, const nsAString& aContentType);
37 :
38 : ~StringBlobImpl();
39 :
40 : nsCString mData;
41 : };
42 :
43 : } // namespace dom
44 : } // namespace mozilla
45 :
46 : #endif // mozilla_dom_StringBlobImpl_h
|