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:
jst%mozilla.jstenback.com
2004-08-27 01:04:46 +00:00
parent abba3c7011
commit 5e867be90e
4 changed files with 7 additions and 4 deletions

View File

@@ -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);

View File

@@ -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));
}

View File

@@ -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);
}

View File

@@ -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);