content/canvas/src/WebGLQuery.cpp

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 /* -*- Mode: C++; tab-width: 20; 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/. */
     6 #include "WebGLContext.h"
     7 #include "GLContext.h"
     8 #include "WebGLQuery.h"
     9 #include "mozilla/dom/WebGL2RenderingContextBinding.h"
    10 #include "nsContentUtils.h"
    12 using namespace mozilla;
    14 JSObject*
    15 WebGLQuery::WrapObject(JSContext *cx) {
    16     return dom::WebGLQueryBinding::Wrap(cx, this);
    17 }
    19 WebGLQuery::WebGLQuery(WebGLContext* context)
    20     : WebGLContextBoundObject(context)
    21     , mGLName(0)
    22     , mType(0)
    23 {
    24     SetIsDOMBinding();
    25     mContext->mQueries.insertBack(this);
    27     mContext->MakeContextCurrent();
    28     mContext->gl->fGenQueries(1, &mGLName);
    29 }
    31 void WebGLQuery::Delete() {
    32     mContext->MakeContextCurrent();
    33     mContext->gl->fDeleteQueries(1, &mGLName);
    34     LinkedListElement<WebGLQuery>::removeFrom(mContext->mQueries);
    35 }
    37 bool WebGLQuery::IsActive() const
    38 {
    39     WebGLRefPtr<WebGLQuery>* targetSlot = mContext->GetQueryTargetSlot(mType, "WebGLQuery::IsActive()");
    41     MOZ_ASSERT(targetSlot, "unknown query object's type");
    43     return targetSlot && *targetSlot == this;
    44 }
    47 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLQuery)
    49 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLQuery, AddRef)
    50 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLQuery, Release)

mercurial