Bug 750297 part 2. Switch WebGLUniformLocation to Paris bindings. r=peterv, bjacob

This commit is contained in:
Boris Zbarsky 2012-06-15 16:25:51 -04:00
parent 80e043d181
commit 44edd4a058
10 changed files with 72 additions and 15 deletions

View File

@ -1312,6 +1312,12 @@ NS_INTERFACE_MAP_BEGIN(WebGLUniformLocation)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLUniformLocation)
NS_INTERFACE_MAP_END
JSObject*
WebGLUniformLocation::WrapObject(JSContext *cx, JSObject *scope)
{
return dom::WebGLUniformLocationBinding::Wrap(cx, scope, this);
}
NS_IMPL_ADDREF(WebGLShaderPrecisionFormat)
NS_IMPL_RELEASE(WebGLShaderPrecisionFormat)

View File

@ -2996,6 +2996,8 @@ public:
uint32_t ProgramGeneration() const { return mProgramGeneration; }
int ElementSize() const { return mElementSize; }
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope);
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBGLUNIFORMLOCATION
protected:

View File

@ -1534,7 +1534,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(WebGLRenderbuffer, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(WebGLUniformLocation, nsDOMGenericSH,
NS_DEFINE_CLASSINFO_DATA(WebGLUniformLocation,
nsNewDOMBindingNoWrapperCacheSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(WebGLShaderPrecisionFormat, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -10900,6 +10901,16 @@ WebGLExtensionSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
return WrapNativeParent(cx, globalObj, node, node, parentObj);
}
nsresult
nsNewDOMBindingNoWrapperCacheSH::PreCreate(nsISupports *nativeObj,
JSContext *cx,
JSObject *globalObj,
JSObject **parentObj)
{
// We don't allow this
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP
nsWebGLViewportHandlerSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
JSObject *globalObj, JSObject **parentObj)

View File

@ -486,6 +486,28 @@ public:
}
};
// scriptable helper for new-binding objects without wrapper caches
class nsNewDOMBindingNoWrapperCacheSH : public nsDOMGenericSH
{
protected:
nsNewDOMBindingNoWrapperCacheSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
{
}
virtual ~nsNewDOMBindingNoWrapperCacheSH()
{
}
public:
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
JSObject *globalObj, JSObject **parentObj);
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
{
return new nsNewDOMBindingNoWrapperCacheSH(aData);
}
};
// DOM Node helper, this class deals with setting the parent for the
// wrappers

View File

@ -56,11 +56,7 @@ DOMCI_CASTABLE_INTERFACE(nsGenericHTMLElement, nsGenericHTMLElement, 6, \
DOMCI_CASTABLE_INTERFACE(nsHTMLDocument, nsIDocument, 7, _extra) \
DOMCI_CASTABLE_INTERFACE(nsStyledElement, nsStyledElement, 8, _extra) \
DOMCI_CASTABLE_INTERFACE(nsSVGStylableElement, nsIContent, 9, _extra) \
DOMCI_CASTABLE_INTERFACE(nsIWebGLUniformLocation, \
nsIWebGLUniformLocation, 11, _extra) \
DOMCI_CASTABLE_INTERFACE(nsIDOMImageData, nsIDOMImageData, 12, _extra) \
DOMCI_CASTABLE_NAMESPACED_INTERFACE(mozilla, WebGLUniformLocation, \
nsIWebGLUniformLocation, 13, _extra)
DOMCI_CASTABLE_INTERFACE(nsIDOMImageData, nsIDOMImageData, 12, _extra)
// Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
// have been declared.

View File

@ -249,4 +249,19 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsWrapperCache, NS_WRAPPERCACHE_IID)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END \
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(_class)
#define NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(_class, _field1,\
_field2) \
NS_IMPL_CYCLE_COLLECTION_CLASS(_class) \
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(_class) \
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(_field1) \
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(_field2) \
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER \
NS_IMPL_CYCLE_COLLECTION_UNLINK_END \
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_class) \
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(_field1) \
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(_field2) \
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS \
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END \
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(_class)
#endif /* nsWrapperCache_h___ */

View File

@ -226,6 +226,12 @@ DOMInterfaces = {
]
},
'WebGLUniformLocation': {
'nativeType': 'mozilla::WebGLUniformLocation',
'headerFile': 'WebGLContext.h',
'wrapperCache': False
},
'XMLHttpRequest': [
{
'nativeType': 'nsXMLHttpRequest',
@ -377,6 +383,3 @@ addExternalIface('WebGLShaderPrecisionFormat',
headerFile='WebGLContext.h')
addExternalIface('WebGLTexture', nativeType='mozilla::WebGLTexture',
headerFile='WebGLContext.h')
addExternalIface('WebGLUniformLocation',
nativeType='mozilla::WebGLUniformLocation',
headerFile='WebGLContext.h')

View File

@ -1531,6 +1531,11 @@ for (uint32_t i = 0; i < length; ++i) {
templateBody = ""
if descriptor.castable:
if descriptor.prefable:
raise TypeError("We don't support prefable castable object "
"arguments (like %s), because we don't know "
"how to handle them being preffed off" %
descriptor.interface.identifier.name)
if failureCode is not None:
templateBody += str(CastableObjectUnwrapper(
descriptor,

View File

@ -48,7 +48,8 @@ interface WebGLShader;
interface WebGLTexture;
interface WebGLUniformLocation;
interface WebGLUniformLocation {
};
interface WebGLActiveInfo;
@ -589,6 +590,7 @@ interface WebGLRenderingContext {
any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
[Creator]
WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name);
any getVertexAttrib(unsigned long index, unsigned long pname);

View File

@ -13,12 +13,7 @@
#include "nsHTMLVideoElement.h"
#include "nsHTMLDocument.h"
#include "nsICSSDeclaration.h"
#include "nsIDOMWebGLRenderingContext.h"
#include "nsSVGStylableElement.h"
#include "WebGLContext.h"
// WebGLContext pulls in windows.h, which defines random crap, so nuke
// those defines.
#include "qsWinUndefs.h"
#define DEFINE_UNWRAP_CAST(_interface, _base, _bit) \
template <> \