Backed out changeset e7108bad8aa2 (bug 817186)

This commit is contained in:
Saurabh Anand 2012-12-07 13:57:49 +05:30
parent 9031c9f696
commit 9e57d179b7
3 changed files with 47 additions and 64 deletions

View File

@ -11,7 +11,6 @@
#include "WebGLShader.h"
#include "WebGLBuffer.h"
#include "WebGLProgram.h"
#include "WebGLUniformLocation.h"
#include "WebGLRenderbuffer.h"
#include "WebGLTexture.h"
#include "WebGLVertexAttribData.h"
@ -72,6 +71,7 @@ class nsIPropertyBag;
namespace mozilla {
class WebGLFramebuffer;
class WebGLUniformLocation;
class WebGLMemoryPressureObserver;
class WebGLContextBoundObject;
class WebGLActiveInfo;
@ -1653,6 +1653,52 @@ public:
mDepthStencilAttachment;
};
class WebGLUniformLocation MOZ_FINAL
: public nsISupports
, public WebGLContextBoundObject
{
public:
WebGLUniformLocation(WebGLContext *context, WebGLProgram *program, GLint location, const WebGLUniformInfo& info)
: WebGLContextBoundObject(context)
, mProgram(program)
, mProgramGeneration(program->Generation())
, mLocation(location)
, mInfo(info)
{
mElementSize = info.ElementSize();
}
~WebGLUniformLocation() {
}
// needed for certain helper functions like ValidateObject.
// WebGLUniformLocation's can't be 'Deleted' in the WebGL sense.
bool IsDeleted() const { return false; }
const WebGLUniformInfo &Info() const { return mInfo; }
WebGLProgram *Program() const { return mProgram; }
GLint Location() const { return mLocation; }
uint32_t ProgramGeneration() const { return mProgramGeneration; }
int ElementSize() const { return mElementSize; }
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(WebGLUniformLocation)
protected:
// nsRefPtr, not WebGLRefPtr, so that we don't prevent the program from being explicitly deleted.
// we just want to avoid having a dangling pointer.
nsRefPtr<WebGLProgram> mProgram;
uint32_t mProgramGeneration;
GLint mLocation;
WebGLUniformInfo mInfo;
int mElementSize;
friend class WebGLProgram;
};
class WebGLActiveInfo MOZ_FINAL
: public nsISupports
{

View File

@ -14,16 +14,6 @@ WebGLUniformLocation::WrapObject(JSContext *cx, JSObject *scope)
return dom::WebGLUniformLocationBinding::Wrap(cx, scope, this);
}
WebGLUniformLocation::WebGLUniformLocation(WebGLContext *context, WebGLProgram *program, GLint location, const WebGLUniformInfo& info)
: WebGLContextBoundObject(context)
, mProgram(program)
, mProgramGeneration(program->Generation())
, mLocation(location)
, mInfo(info)
{
mElementSize = info.ElementSize();
}
NS_IMPL_CYCLE_COLLECTION_CLASS(WebGLUniformLocation)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(WebGLUniformLocation)

View File

@ -1,53 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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/. */
#ifndef WEBGLUNIFORMLOCATION_H_
#define WEBGLUNIFORMLOCATION_H_
#include "WebGLObjectModel.h"
namespace mozilla {
class WebGLUniformLocation MOZ_FINAL
: public nsISupports
, public WebGLContextBoundObject
{
public:
WebGLUniformLocation(WebGLContext *context, WebGLProgram *program, GLint location, const WebGLUniformInfo& info);
~WebGLUniformLocation() {
}
// needed for certain helper functions like ValidateObject.
// WebGLUniformLocation's can't be 'Deleted' in the WebGL sense.
bool IsDeleted() const { return false; }
const WebGLUniformInfo &Info() const { return mInfo; }
WebGLProgram *Program() const { return mProgram; }
GLint Location() const { return mLocation; }
uint32_t ProgramGeneration() const { return mProgramGeneration; }
int ElementSize() const { return mElementSize; }
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(WebGLUniformLocation)
protected:
// nsRefPtr, not WebGLRefPtr, so that we don't prevent the program from being explicitly deleted.
// we just want to avoid having a dangling pointer.
nsRefPtr<WebGLProgram> mProgram;
uint32_t mProgramGeneration;
GLint mLocation;
WebGLUniformInfo mInfo;
int mElementSize;
friend class WebGLProgram;
};
} // namespace mozilla
#endif