michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef WEBGLQUERY_H_ michael@0: #define WEBGLQUERY_H_ michael@0: michael@0: #include "WebGLObjectModel.h" michael@0: michael@0: #include "nsWrapperCache.h" michael@0: michael@0: #include "mozilla/LinkedList.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: class WebGLQuery MOZ_FINAL michael@0: : public nsWrapperCache michael@0: , public WebGLRefCountedObject michael@0: , public LinkedListElement michael@0: , public WebGLContextBoundObject michael@0: { michael@0: // ----------------------------------------------------------------------------- michael@0: // PUBLIC michael@0: public: michael@0: michael@0: // ------------------------------------------------------------------------- michael@0: // CONSTRUCTOR & DESTRUCTOR michael@0: michael@0: WebGLQuery(WebGLContext *context); michael@0: michael@0: ~WebGLQuery() { michael@0: DeleteOnce(); michael@0: }; michael@0: michael@0: michael@0: // ------------------------------------------------------------------------- michael@0: // MEMBER FUNCTIONS michael@0: michael@0: bool IsActive() const; michael@0: michael@0: bool HasEverBeenActive() michael@0: { michael@0: return mType != 0; michael@0: } michael@0: michael@0: michael@0: // ------------------------------------------------------------------------- michael@0: // IMPLEMENT WebGLRefCountedObject and WebGLContextBoundObject michael@0: michael@0: void Delete(); michael@0: michael@0: WebGLContext* GetParentObject() const michael@0: { michael@0: return Context(); michael@0: } michael@0: michael@0: michael@0: // ------------------------------------------------------------------------- michael@0: // IMPLEMENT NS michael@0: virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE; michael@0: michael@0: NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLQuery) michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLQuery) michael@0: michael@0: michael@0: // ----------------------------------------------------------------------------- michael@0: // PRIVATE michael@0: private: michael@0: michael@0: // ------------------------------------------------------------------------- michael@0: // MEMBERS michael@0: GLuint mGLName; michael@0: GLenum mType; michael@0: michael@0: // ------------------------------------------------------------------------- michael@0: // FRIENDSHIPS michael@0: friend class WebGLContext; michael@0: }; michael@0: michael@0: } // namespace mozilla michael@0: michael@0: #endif