|
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 WEBGLQUERY_H_ |
|
7 #define WEBGLQUERY_H_ |
|
8 |
|
9 #include "WebGLObjectModel.h" |
|
10 |
|
11 #include "nsWrapperCache.h" |
|
12 |
|
13 #include "mozilla/LinkedList.h" |
|
14 |
|
15 namespace mozilla { |
|
16 |
|
17 class WebGLQuery MOZ_FINAL |
|
18 : public nsWrapperCache |
|
19 , public WebGLRefCountedObject<WebGLQuery> |
|
20 , public LinkedListElement<WebGLQuery> |
|
21 , public WebGLContextBoundObject |
|
22 { |
|
23 // ----------------------------------------------------------------------------- |
|
24 // PUBLIC |
|
25 public: |
|
26 |
|
27 // ------------------------------------------------------------------------- |
|
28 // CONSTRUCTOR & DESTRUCTOR |
|
29 |
|
30 WebGLQuery(WebGLContext *context); |
|
31 |
|
32 ~WebGLQuery() { |
|
33 DeleteOnce(); |
|
34 }; |
|
35 |
|
36 |
|
37 // ------------------------------------------------------------------------- |
|
38 // MEMBER FUNCTIONS |
|
39 |
|
40 bool IsActive() const; |
|
41 |
|
42 bool HasEverBeenActive() |
|
43 { |
|
44 return mType != 0; |
|
45 } |
|
46 |
|
47 |
|
48 // ------------------------------------------------------------------------- |
|
49 // IMPLEMENT WebGLRefCountedObject and WebGLContextBoundObject |
|
50 |
|
51 void Delete(); |
|
52 |
|
53 WebGLContext* GetParentObject() const |
|
54 { |
|
55 return Context(); |
|
56 } |
|
57 |
|
58 |
|
59 // ------------------------------------------------------------------------- |
|
60 // IMPLEMENT NS |
|
61 virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE; |
|
62 |
|
63 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLQuery) |
|
64 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLQuery) |
|
65 |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // PRIVATE |
|
69 private: |
|
70 |
|
71 // ------------------------------------------------------------------------- |
|
72 // MEMBERS |
|
73 GLuint mGLName; |
|
74 GLenum mType; |
|
75 |
|
76 // ------------------------------------------------------------------------- |
|
77 // FRIENDSHIPS |
|
78 friend class WebGLContext; |
|
79 }; |
|
80 |
|
81 } // namespace mozilla |
|
82 |
|
83 #endif |