/work/obj-fuzz/dist/include/mozilla/dom/StructuredCloneBlob.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_StructuredCloneBlob_h |
8 | | #define mozilla_dom_StructuredCloneBlob_h |
9 | | |
10 | | #include "mozilla/dom/BindingDeclarations.h" |
11 | | #include "mozilla/dom/StructuredCloneHolder.h" |
12 | | #include "mozilla/dom/StructuredCloneHolderBinding.h" |
13 | | |
14 | | #include "jsapi.h" |
15 | | |
16 | | #include "nsIMemoryReporter.h" |
17 | | #include "nsISupports.h" |
18 | | |
19 | | namespace mozilla { |
20 | | namespace dom { |
21 | | |
22 | | class StructuredCloneBlob final : public nsIMemoryReporter |
23 | | , public StructuredCloneHolder |
24 | | { |
25 | | MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf) |
26 | | |
27 | | public: |
28 | | NS_DECL_ISUPPORTS |
29 | | NS_DECL_NSIMEMORYREPORTER |
30 | | |
31 | | static JSObject* ReadStructuredClone(JSContext* aCx, JSStructuredCloneReader* aReader, |
32 | | StructuredCloneHolder* aHolder); |
33 | | bool WriteStructuredClone(JSContext* aCx, JSStructuredCloneWriter* aWriter, |
34 | | StructuredCloneHolder* aHolder); |
35 | | |
36 | | static already_AddRefed<StructuredCloneBlob> |
37 | | Constructor(GlobalObject& aGlobal, JS::HandleValue aValue, JS::HandleObject aTargetGlobal, ErrorResult& aRv); |
38 | | |
39 | | void Deserialize(JSContext* aCx, JS::HandleObject aTargetScope, |
40 | | JS::MutableHandleValue aResult, ErrorResult& aRv); |
41 | | |
42 | 0 | nsISupports* GetParentObject() const { return nullptr; } |
43 | 0 | JSObject* GetWrapper() const { return nullptr; } |
44 | | |
45 | | bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandleObject aResult); |
46 | | |
47 | | protected: |
48 | | virtual ~StructuredCloneBlob(); |
49 | | |
50 | | private: |
51 | | explicit StructuredCloneBlob(); |
52 | | |
53 | | static already_AddRefed<StructuredCloneBlob> Create() |
54 | 0 | { |
55 | 0 | RefPtr<StructuredCloneBlob> holder = new StructuredCloneBlob(); |
56 | 0 | RegisterWeakMemoryReporter(holder); |
57 | 0 | return holder.forget(); |
58 | 0 | } |
59 | | |
60 | | bool ReadStructuredCloneInternal(JSContext* aCx, JSStructuredCloneReader* aReader, |
61 | | StructuredCloneHolder* aHolder); |
62 | | }; |
63 | | |
64 | | } // namespace dom |
65 | | } // namespace mozilla |
66 | | |
67 | | #endif // mozilla_dom_StructuredCloneBlob_h |
68 | | |