Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / canvas / WebGLQuery.h
blob9480e4acde5bc39219773c97be5dcd5f4cd9f049
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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/. */
6 #ifndef WEBGL_QUERY_H_
7 #define WEBGL_QUERY_H_
9 #include "WebGLObjectModel.h"
10 #include "nsThreadUtils.h"
12 namespace mozilla {
13 namespace webgl {
14 class AvailabilityRunnable;
15 } // namespace webgl
17 class WebGLQuery final : public WebGLContextBoundObject {
18 friend class webgl::AvailabilityRunnable;
20 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(WebGLQuery, override)
22 public:
23 const GLuint mGLName;
25 private:
26 GLenum mTarget;
27 RefPtr<WebGLQuery>* mActiveSlot;
29 bool mCanBeAvailable = false; // Track whether the event loop has spun
31 ////
32 public:
33 GLenum Target() const { return mTarget; }
34 bool IsActive() const { return bool(mActiveSlot); }
36 ////
38 explicit WebGLQuery(WebGLContext* webgl);
40 private:
41 ~WebGLQuery() override;
43 public:
44 ////
46 void BeginQuery(GLenum target, RefPtr<WebGLQuery>& slot);
47 void EndQuery();
48 Maybe<double> GetQueryParameter(GLenum pname) const;
49 void QueryCounter();
52 } // namespace mozilla
54 #endif // WEBGL_QUERY_H_