Fixing bug 256944. Adding NPClass argument to NPAllocateFunctionPtr to make it easier to work with dynamic NPClasses. r+sr=brendan@mozilla.org, a=asa@mozilla.org
git-svn-id: svn://10.0.0.236/branches/AVIARY_1_0_20040515_BRANCH@161371 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -274,7 +274,7 @@ int32_t NPN_IntFromIdentifier(NPIdentifier identifier);
|
||||
The NPVariant *result argument of these functions (where
|
||||
applicable) should be released using NPN_ReleaseVariantValue().
|
||||
*/
|
||||
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp);
|
||||
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
|
||||
typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj);
|
||||
typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj);
|
||||
typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name);
|
||||
|
||||
@@ -1466,7 +1466,7 @@ _createobject(NPP npp, NPClass* aClass)
|
||||
NPObject *npobj;
|
||||
|
||||
if (aClass->allocate) {
|
||||
npobj = aClass->allocate(npp);
|
||||
npobj = aClass->allocate(npp, aClass);
|
||||
} else {
|
||||
npobj = (NPObject *)PR_Malloc(sizeof(NPObject));
|
||||
}
|
||||
|
||||
@@ -388,8 +388,11 @@ nsJSObjWrapper::~nsJSObjWrapper()
|
||||
|
||||
// static
|
||||
NPObject *
|
||||
nsJSObjWrapper::NP_Allocate(NPP npp)
|
||||
nsJSObjWrapper::NP_Allocate(NPP npp, NPClass *aClass)
|
||||
{
|
||||
NS_ASSERTION(aClass == &sJSObjWrapperNPClass,
|
||||
"Huh, wrong class passed to NP_Allocate()!!!");
|
||||
|
||||
return new nsJSObjWrapper(npp);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ protected:
|
||||
nsJSObjWrapper(NPP npp);
|
||||
~nsJSObjWrapper();
|
||||
|
||||
static NPObject * NP_Allocate(NPP npp);
|
||||
static NPObject * NP_Allocate(NPP npp, NPClass *aClass);
|
||||
static void NP_Deallocate(NPObject *obj);
|
||||
static void NP_Invalidate(NPObject *obj);
|
||||
static bool NP_HasMethod(NPObject *, NPIdentifier identifier);
|
||||
|
||||
Reference in New Issue
Block a user