Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/webgpu/InstanceProvider.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 "InstanceProvider.h"
7
8
#include "Instance.h"
9
#include "mozilla/dom/WebGPUBinding.h"
10
11
namespace mozilla {
12
namespace webgpu {
13
14
InstanceProvider::InstanceProvider(nsIGlobalObject* const global)
15
    : mGlobal(global)
16
0
{ }
17
18
0
InstanceProvider::~InstanceProvider() = default;
19
20
already_AddRefed<Instance>
21
InstanceProvider::Webgpu() const
22
0
{
23
0
    if (!mInstance) {
24
0
        const auto inst = Instance::Create(mGlobal);
25
0
        mInstance = Some(inst);
26
0
    }
27
0
    auto ret = mInstance.value();
28
0
    return ret.forget();
29
0
}
30
31
void
32
InstanceProvider::CcTraverse(nsCycleCollectionTraversalCallback& callback) const
33
0
{
34
0
    if (mInstance) {
35
0
        CycleCollectionNoteChild(callback, mInstance.ref().get(),
36
0
                                 "webgpu::InstanceProvider::mInstance", 0);
37
0
    }
38
0
}
39
40
void
41
InstanceProvider::CcUnlink()
42
0
{
43
0
    mInstance = Some(nullptr);
44
0
}
45
46
} // namespace webgpu
47
} // namespace mozilla