/work/obj-fuzz/dist/include/mozilla/webgpu/ObjectModel.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
3 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | | |
6 | | #ifndef WEBGPU_OBJECT_MODEL_H_ |
7 | | #define WEBGPU_OBJECT_MODEL_H_ |
8 | | |
9 | | #include "nsWrapperCache.h" |
10 | | |
11 | | class nsIGlobalObject; |
12 | | |
13 | | namespace mozilla { |
14 | | namespace webgpu { |
15 | | |
16 | | template<typename T> |
17 | | class ChildOf |
18 | | : public nsWrapperCache |
19 | | { |
20 | | public: |
21 | | const RefPtr<T> mParent; |
22 | | |
23 | | explicit ChildOf(T* parent = nullptr); // TODO: This can't be nullptr eventually. |
24 | | protected: |
25 | 0 | virtual ~ChildOf(); Unexecuted instantiation: mozilla::webgpu::ChildOf<mozilla::webgpu::Adapter>::~ChildOf() Unexecuted instantiation: mozilla::webgpu::ChildOf<mozilla::webgpu::Device>::~ChildOf() Unexecuted instantiation: mozilla::webgpu::ChildOf<mozilla::webgpu::Instance>::~ChildOf() |
26 | | |
27 | | public: |
28 | | nsIGlobalObject* GetParentObject() const; |
29 | | }; |
30 | | |
31 | | } // namespace webgpu |
32 | | } // namespace mozilla |
33 | | |
34 | | #define WEBGPU_DECL_GOOP(T) \ |
35 | | NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(T) \ |
36 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(T) \ |
37 | | virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) override; |
38 | | |
39 | | #define WEBGPU_IMPL_GOOP_INTERNAL(T) \ |
40 | | JSObject* \ |
41 | | T::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) \ |
42 | 0 | { \ |
43 | 0 | return dom::WebGPU ## T ## _Binding::Wrap(cx, this, givenProto); \ |
44 | 0 | } \ Unexecuted instantiation: mozilla::webgpu::Adapter::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::AttachmentState::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::BindGroup::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::BindGroupLayout::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::BlendState::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::CommandBuffer::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::CommandEncoder::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::ComputePipeline::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::DepthStencilState::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::Device::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::Fence::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::InputState::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::LogEntry::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::PipelineLayout::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::Queue::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::RenderPipeline::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::Sampler::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::ShaderModule::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::SwapChain::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::Texture::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::webgpu::TextureView::WrapObject(JSContext*, JS::Handle<JSObject*>) |
45 | | NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(T, AddRef) \ |
46 | | NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(T, Release) |
47 | | |
48 | | #define WEBGPU_IMPL_GOOP(T,...) \ |
49 | | WEBGPU_IMPL_GOOP_INTERNAL(T) \ |
50 | | NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(T, mParent, __VA_ARGS__) |
51 | | |
52 | | #define WEBGPU_IMPL_GOOP_0(T) \ |
53 | | WEBGPU_IMPL_GOOP_INTERNAL(T) \ |
54 | | NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(T, mParent) |
55 | | |
56 | | template<typename T> |
57 | | void |
58 | | ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback, |
59 | | const RefPtr<T>& field, |
60 | | const char* name, uint32_t flags) |
61 | 0 | { |
62 | 0 | CycleCollectionNoteChild(callback, field.get(), name, flags); |
63 | 0 | } Unexecuted instantiation: void ImplCycleCollectionTraverse<mozilla::webgpu::Instance>(nsCycleCollectionTraversalCallback&, RefPtr<mozilla::webgpu::Instance> const&, char const*, unsigned int) Unexecuted instantiation: void ImplCycleCollectionTraverse<mozilla::webgpu::Device>(nsCycleCollectionTraversalCallback&, RefPtr<mozilla::webgpu::Device> const&, char const*, unsigned int) Unexecuted instantiation: void ImplCycleCollectionTraverse<mozilla::webgpu::Adapter>(nsCycleCollectionTraversalCallback&, RefPtr<mozilla::webgpu::Adapter> const&, char const*, unsigned int) |
64 | | |
65 | | template<typename T> |
66 | | void |
67 | | ImplCycleCollectionUnlink(const RefPtr<T>& field) |
68 | 0 | { |
69 | 0 | const auto mutPtr = const_cast< RefPtr<T>* >(&field); |
70 | 0 | ImplCycleCollectionUnlink(*mutPtr); |
71 | 0 | } Unexecuted instantiation: void ImplCycleCollectionUnlink<mozilla::webgpu::Instance>(RefPtr<mozilla::webgpu::Instance> const&) Unexecuted instantiation: void ImplCycleCollectionUnlink<mozilla::webgpu::Device>(RefPtr<mozilla::webgpu::Device> const&) Unexecuted instantiation: void ImplCycleCollectionUnlink<mozilla::webgpu::Adapter>(RefPtr<mozilla::webgpu::Adapter> const&) |
72 | | |
73 | | #endif // WEBGPU_OBJECT_MODEL_H_ |