Thu, 15 Jan 2015 21:03:48 +0100
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.)
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef WEBGLUNIFORMLOCATION_H_ |
michael@0 | 7 | #define WEBGLUNIFORMLOCATION_H_ |
michael@0 | 8 | |
michael@0 | 9 | #include "WebGLObjectModel.h" |
michael@0 | 10 | #include "WebGLUniformInfo.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | |
michael@0 | 14 | class WebGLProgram; |
michael@0 | 15 | |
michael@0 | 16 | class WebGLUniformLocation MOZ_FINAL |
michael@0 | 17 | : public WebGLContextBoundObject |
michael@0 | 18 | { |
michael@0 | 19 | public: |
michael@0 | 20 | WebGLUniformLocation(WebGLContext *context, WebGLProgram *program, GLint location, const WebGLUniformInfo& info); |
michael@0 | 21 | |
michael@0 | 22 | ~WebGLUniformLocation() { |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | // needed for certain helper functions like ValidateObject. |
michael@0 | 26 | // WebGLUniformLocation's can't be 'Deleted' in the WebGL sense. |
michael@0 | 27 | bool IsDeleted() const { return false; } |
michael@0 | 28 | |
michael@0 | 29 | const WebGLUniformInfo &Info() const { return mInfo; } |
michael@0 | 30 | |
michael@0 | 31 | WebGLProgram *Program() const { return mProgram; } |
michael@0 | 32 | GLint Location() const { return mLocation; } |
michael@0 | 33 | uint32_t ProgramGeneration() const { return mProgramGeneration; } |
michael@0 | 34 | int ElementSize() const { return mElementSize; } |
michael@0 | 35 | |
michael@0 | 36 | JSObject* WrapObject(JSContext *cx); |
michael@0 | 37 | |
michael@0 | 38 | NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLUniformLocation) |
michael@0 | 39 | NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(WebGLUniformLocation) |
michael@0 | 40 | |
michael@0 | 41 | protected: |
michael@0 | 42 | // nsRefPtr, not WebGLRefPtr, so that we don't prevent the program from being explicitly deleted. |
michael@0 | 43 | // we just want to avoid having a dangling pointer. |
michael@0 | 44 | nsRefPtr<WebGLProgram> mProgram; |
michael@0 | 45 | |
michael@0 | 46 | uint32_t mProgramGeneration; |
michael@0 | 47 | GLint mLocation; |
michael@0 | 48 | WebGLUniformInfo mInfo; |
michael@0 | 49 | int mElementSize; |
michael@0 | 50 | friend class WebGLProgram; |
michael@0 | 51 | }; |
michael@0 | 52 | |
michael@0 | 53 | } // namespace mozilla |
michael@0 | 54 | |
michael@0 | 55 | #endif |