Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/canvas/WebGLQuery.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 WEBGL_QUERY_H_
7
#define WEBGL_QUERY_H_
8
9
#include "mozilla/LinkedList.h"
10
#include "nsWrapperCache.h"
11
12
#include "WebGLObjectModel.h"
13
#include "nsThreadUtils.h"
14
15
namespace mozilla {
16
namespace webgl {
17
class AvailabilityRunnable;
18
} // namespace webgl
19
20
class WebGLQuery final
21
    : public nsWrapperCache
22
    , public WebGLRefCountedObject<WebGLQuery>
23
    , public LinkedListElement<WebGLQuery>
24
{
25
    friend class webgl::AvailabilityRunnable;
26
    friend class WebGLRefCountedObject<WebGLQuery>;
27
28
public:
29
    const GLuint mGLName;
30
private:
31
    GLenum mTarget;
32
    WebGLRefPtr<WebGLQuery>* mActiveSlot;
33
34
    bool mCanBeAvailable = false; // Track whether the event loop has spun
35
36
    ////
37
public:
38
0
    GLenum Target() const { return mTarget; }
39
0
    bool IsActive() const { return bool(mActiveSlot); }
40
41
    ////
42
43
    NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLQuery)
44
    NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLQuery)
45
46
    explicit WebGLQuery(WebGLContext* webgl);
47
48
private:
49
0
    ~WebGLQuery() {
50
0
        DeleteOnce();
51
0
    };
52
53
    // WebGLRefCountedObject
54
    void Delete();
55
56
public:
57
0
    WebGLContext* GetParentObject() const { return mContext; }
58
    virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) override;
59
60
    ////
61
62
    void BeginQuery(GLenum target, WebGLRefPtr<WebGLQuery>& slot);
63
    void DeleteQuery();
64
    void EndQuery();
65
    void GetQueryParameter(GLenum pname, JS::MutableHandleValue retval) const;
66
    bool IsQuery() const;
67
    void QueryCounter(GLenum target);
68
};
69
70
} // namespace mozilla
71
72
#endif // WEBGL_QUERY_H_