2015-05-27 14:12:00 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "WebGLTimerQuery.h"
|
|
|
|
|
|
|
|
#include "GLContext.h"
|
|
|
|
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
#include "WebGLContext.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
JSObject*
|
2015-07-15 03:37:28 +03:00
|
|
|
WebGLTimerQuery::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto)
|
2015-05-27 14:12:00 +03:00
|
|
|
{
|
2015-07-15 03:37:28 +03:00
|
|
|
return dom::WebGLTimerQueryEXTBinding::Wrap(cx, this, givenProto);
|
2015-05-27 14:12:00 +03:00
|
|
|
}
|
|
|
|
|
2015-07-15 03:37:28 +03:00
|
|
|
WebGLTimerQuery::WebGLTimerQuery(WebGLContext* webgl, GLuint name)
|
2015-06-03 05:51:13 +03:00
|
|
|
: WebGLContextBoundObject(webgl)
|
2015-07-15 03:37:28 +03:00
|
|
|
, mGLName(name)
|
2015-06-03 05:51:13 +03:00
|
|
|
, mTarget(LOCAL_GL_NONE)
|
2015-05-27 14:12:00 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-06-03 05:51:13 +03:00
|
|
|
WebGLTimerQuery::~WebGLTimerQuery()
|
|
|
|
{
|
|
|
|
DeleteOnce();
|
|
|
|
}
|
|
|
|
|
2015-05-27 14:12:00 +03:00
|
|
|
WebGLTimerQuery*
|
|
|
|
WebGLTimerQuery::Create(WebGLContext* webgl)
|
|
|
|
{
|
|
|
|
GLuint name = 0;
|
|
|
|
webgl->MakeContextCurrent();
|
|
|
|
webgl->gl->fGenQueries(1, &name);
|
|
|
|
return new WebGLTimerQuery(webgl, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
WebGLTimerQuery::Delete()
|
|
|
|
{
|
|
|
|
mContext->MakeContextCurrent();
|
|
|
|
mContext->gl->fDeleteQueries(1, &mGLName);
|
|
|
|
}
|
|
|
|
|
2015-06-03 05:51:13 +03:00
|
|
|
WebGLContext*
|
|
|
|
WebGLTimerQuery::GetParentObject() const
|
|
|
|
{
|
2015-11-25 07:15:29 +03:00
|
|
|
return mContext;
|
2015-06-03 05:51:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-27 14:12:00 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLTimerQuery)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLTimerQuery, AddRef)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLTimerQuery, Release)
|
|
|
|
|
|
|
|
} // namespace mozilla
|