Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/canvas/WebGLSync.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 "WebGLSync.h"
7
8
#include "GLContext.h"
9
#include "mozilla/dom/WebGL2RenderingContextBinding.h"
10
#include "WebGLContext.h"
11
12
namespace mozilla {
13
14
WebGLSync::WebGLSync(WebGLContext* webgl, GLenum condition, GLbitfield flags)
15
    : WebGLRefCountedObject(webgl)
16
    , mGLName(mContext->gl->fFenceSync(condition, flags))
17
    , mFenceId(mContext->mNextFenceId)
18
0
{
19
0
    mContext->mNextFenceId += 1;
20
0
    mContext->mSyncs.insertBack(this);
21
0
}
22
23
WebGLSync::~WebGLSync()
24
0
{
25
0
    DeleteOnce();
26
0
}
27
28
void
29
WebGLSync::Delete()
30
0
{
31
0
    mContext->gl->fDeleteSync(mGLName);
32
0
    LinkedListElement<WebGLSync>::removeFrom(mContext->mSyncs);
33
0
}
34
35
WebGLContext*
36
WebGLSync::GetParentObject() const
37
0
{
38
0
    return mContext;
39
0
}
40
41
void
42
WebGLSync::MarkSignaled() const
43
0
{
44
0
    if (mContext->mCompletedFenceId < mFenceId) {
45
0
        mContext->mCompletedFenceId = mFenceId;
46
0
    }
47
0
}
48
49
// -------------------------------------------------------------------------
50
// IMPLEMENT NS
51
JSObject*
52
WebGLSync::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto)
53
0
{
54
0
    return dom::WebGLSync_Binding::Wrap(cx, this, givenProto);
55
0
}
56
57
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLSync)
58
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLSync, AddRef)
59
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLSync, Release);
60
61
} // namespace mozilla