X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=projects%2Fmozilla%2Fcontrol%2Fnporuntime.h;h=fe9bfc62936a305188162070584e99fab3112f88;hb=37a4d52044737bfaac6140a8e0a65d8f4e22987d;hp=2f6c91bb9214fa3ef053901958a23f771321f3e9;hpb=1f253f8d9a0730b61dc41a7baffdf9c634983446;p=vlc diff --git a/projects/mozilla/control/nporuntime.h b/projects/mozilla/control/nporuntime.h old mode 100755 new mode 100644 index 2f6c91bb92..fe9bfc6293 --- a/projects/mozilla/control/nporuntime.h +++ b/projects/mozilla/control/nporuntime.h @@ -42,6 +42,9 @@ static bool RuntimeNPClassInvokeDefault(NPObject *npobj, class RuntimeNPObject : public NPObject { public: + // Lazy child object cration helper. Doing this avoids + // ownership problems with firefox. + template void InstantObj( NPObject *&obj ); /* ** utility functions @@ -127,6 +130,17 @@ protected: bool returnInvokeResult(InvokeResult result); + static InvokeResult invokeResultString(const char *,NPVariant &); + + bool isPluginRunning() + { + return (_instance->pdata != NULL); + } + template T *getPrivate() + { + return reinterpret_cast(_instance->pdata); + } + NPP _instance; }; @@ -163,6 +177,13 @@ private: NPIdentifier *methodIdentifiers; }; +template +inline void RuntimeNPObject::InstantObj( NPObject *&obj ) +{ + if( !obj ) + obj = NPN_CreateObject(_instance, RuntimeNPClass::getClass()); +} + template static NPObject *RuntimeNPClassAllocate(NPP instance, NPClass *aClass) { @@ -315,8 +336,8 @@ RuntimeNPClass::RuntimeNPClass() template RuntimeNPClass::~RuntimeNPClass() { - delete propertyIdentifiers; - delete methodIdentifiers; + delete[] propertyIdentifiers; + delete[] methodIdentifiers; } template