content/canvas/src/WebGLQuery.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/src/WebGLQuery.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,83 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef WEBGLQUERY_H_
    1.10 +#define WEBGLQUERY_H_
    1.11 +
    1.12 +#include "WebGLObjectModel.h"
    1.13 +
    1.14 +#include "nsWrapperCache.h"
    1.15 +
    1.16 +#include "mozilla/LinkedList.h"
    1.17 +
    1.18 +namespace mozilla {
    1.19 +
    1.20 +class WebGLQuery MOZ_FINAL
    1.21 +    : public nsWrapperCache
    1.22 +    , public WebGLRefCountedObject<WebGLQuery>
    1.23 +    , public LinkedListElement<WebGLQuery>
    1.24 +    , public WebGLContextBoundObject
    1.25 +{
    1.26 +// -----------------------------------------------------------------------------
    1.27 +// PUBLIC
    1.28 +public:
    1.29 +
    1.30 +    // -------------------------------------------------------------------------
    1.31 +    // CONSTRUCTOR & DESTRUCTOR
    1.32 +
    1.33 +    WebGLQuery(WebGLContext *context);
    1.34 +
    1.35 +    ~WebGLQuery() {
    1.36 +        DeleteOnce();
    1.37 +    };
    1.38 +
    1.39 +
    1.40 +    // -------------------------------------------------------------------------
    1.41 +    // MEMBER FUNCTIONS
    1.42 +
    1.43 +    bool IsActive() const;
    1.44 +
    1.45 +    bool HasEverBeenActive()
    1.46 +    {
    1.47 +        return mType != 0;
    1.48 +    }
    1.49 +
    1.50 +
    1.51 +    // -------------------------------------------------------------------------
    1.52 +    // IMPLEMENT WebGLRefCountedObject and WebGLContextBoundObject
    1.53 +
    1.54 +    void Delete();
    1.55 +
    1.56 +    WebGLContext* GetParentObject() const
    1.57 +    {
    1.58 +        return Context();
    1.59 +    }
    1.60 +
    1.61 +
    1.62 +    // -------------------------------------------------------------------------
    1.63 +    // IMPLEMENT NS
    1.64 +    virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;
    1.65 +
    1.66 +    NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLQuery)
    1.67 +    NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLQuery)
    1.68 +
    1.69 +
    1.70 +// -----------------------------------------------------------------------------
    1.71 +// PRIVATE
    1.72 +private:
    1.73 +
    1.74 +    // -------------------------------------------------------------------------
    1.75 +    // MEMBERS
    1.76 +    GLuint mGLName;
    1.77 +    GLenum mType;
    1.78 +
    1.79 +    // -------------------------------------------------------------------------
    1.80 +    // FRIENDSHIPS
    1.81 +    friend class WebGLContext;
    1.82 +};
    1.83 +
    1.84 +} // namespace mozilla
    1.85 +
    1.86 +#endif

mercurial