content/canvas/src/WebGLUniformLocation.h

branch
TOR_BUG_9701
changeset 11
deefc01c0e14
equal deleted inserted replaced
-1:000000000000 0:221041fd7aa2
1 /* -*- Mode: C++; tab-width: 4; 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/. */
5
6 #ifndef WEBGLUNIFORMLOCATION_H_
7 #define WEBGLUNIFORMLOCATION_H_
8
9 #include "WebGLObjectModel.h"
10 #include "WebGLUniformInfo.h"
11
12 namespace mozilla {
13
14 class WebGLProgram;
15
16 class WebGLUniformLocation MOZ_FINAL
17 : public WebGLContextBoundObject
18 {
19 public:
20 WebGLUniformLocation(WebGLContext *context, WebGLProgram *program, GLint location, const WebGLUniformInfo& info);
21
22 ~WebGLUniformLocation() {
23 }
24
25 // needed for certain helper functions like ValidateObject.
26 // WebGLUniformLocation's can't be 'Deleted' in the WebGL sense.
27 bool IsDeleted() const { return false; }
28
29 const WebGLUniformInfo &Info() const { return mInfo; }
30
31 WebGLProgram *Program() const { return mProgram; }
32 GLint Location() const { return mLocation; }
33 uint32_t ProgramGeneration() const { return mProgramGeneration; }
34 int ElementSize() const { return mElementSize; }
35
36 JSObject* WrapObject(JSContext *cx);
37
38 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLUniformLocation)
39 NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(WebGLUniformLocation)
40
41 protected:
42 // nsRefPtr, not WebGLRefPtr, so that we don't prevent the program from being explicitly deleted.
43 // we just want to avoid having a dangling pointer.
44 nsRefPtr<WebGLProgram> mProgram;
45
46 uint32_t mProgramGeneration;
47 GLint mLocation;
48 WebGLUniformInfo mInfo;
49 int mElementSize;
50 friend class WebGLProgram;
51 };
52
53 } // namespace mozilla
54
55 #endif

mercurial