Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/webgpu/Instance.cpp
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
#include "Instance.h"
7
8
#include "Adapter.h"
9
#include "InstanceProvider.h"
10
#include "mozilla/dom/WebGPUBinding.h"
11
#include "nsIGlobalObject.h"
12
13
namespace mozilla {
14
namespace webgpu {
15
16
/*static*/ RefPtr<Instance>
17
Instance::Create(nsIGlobalObject* parent)
18
0
{
19
0
    return new Instance(parent);
20
0
}
21
22
Instance::Instance(nsIGlobalObject* parent)
23
    : mParent(parent)
24
0
{
25
0
}
26
27
0
Instance::~Instance() = default;
28
29
already_AddRefed<Adapter>
30
Instance::GetAdapter(const dom::WebGPUAdapterDescriptor& desc) const
31
0
{
32
0
    MOZ_CRASH("todo");
33
0
}
34
35
template<typename T>
36
void
37
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback,
38
                            const nsCOMPtr<T>& field,
39
                            const char* name, uint32_t flags)
40
0
{
41
0
    CycleCollectionNoteChild(callback, field.get(), name, flags);
42
0
}
43
44
template<typename T>
45
void
46
ImplCycleCollectionUnlink(const nsCOMPtr<T>& field)
47
0
{
48
0
    const auto mut = const_cast<nsCOMPtr<T>*>(&field);
49
0
    *mut = nullptr;
50
0
}
51
52
JSObject*
53
Instance::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto)
54
0
{
55
0
    return dom::WebGPU_Binding::Wrap(cx, this, givenProto);
56
0
}
57
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(Instance, AddRef)
58
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(Instance, Release)
59
60
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Instance, mParent)
61
62
} // namespace webgpu
63
} // namespace mozilla