michael@0: /* -*- Mode: C++; tab-width: 20; 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: #include "WebGL1Context.h" michael@0: #include "mozilla/dom/WebGLRenderingContextBinding.h" michael@0: michael@0: #include "mozilla/Telemetry.h" michael@0: michael@0: using namespace mozilla; michael@0: michael@0: // ----------------------------------------------------------------------------- michael@0: // CONSTRUCTOR & DESTRUCTOR michael@0: michael@0: WebGL1Context::WebGL1Context() michael@0: : WebGLContext() michael@0: { michael@0: michael@0: } michael@0: michael@0: WebGL1Context::~WebGL1Context() michael@0: { michael@0: michael@0: } michael@0: michael@0: michael@0: // ----------------------------------------------------------------------------- michael@0: // IMPLEMENT nsWrapperCache michael@0: michael@0: JSObject* michael@0: WebGL1Context::WrapObject(JSContext *cx) michael@0: { michael@0: return dom::WebGLRenderingContextBinding::Wrap(cx, this); michael@0: } michael@0: michael@0: michael@0: // ----------------------------------------------------------------------------- michael@0: // INSTANCING nsIDOMWebGLRenderingContext michael@0: michael@0: nsresult michael@0: NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** aResult) michael@0: { michael@0: Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_USED, 1); michael@0: nsIDOMWebGLRenderingContext* ctx = new WebGL1Context(); michael@0: michael@0: NS_ADDREF(*aResult = ctx); michael@0: return NS_OK; michael@0: } michael@0: