static bool plugin_object_set_property (NPObject *npobj, NPIdentifier name, const NPVariant *value) { PluginObject *obj; g_return_val_if_fail (plugin_object_has_property (npobj, name), FALSE); obj = (PluginObject*) npobj; if (obj->listener) funcs.releaseobject (obj->listener); obj->listener = NULL; if (NPVARIANT_IS_OBJECT (*value)) { obj->listener = NPVARIANT_TO_OBJECT (*value); funcs.retainobject (obj->listener); return TRUE; } else if (NPVARIANT_IS_NULL (*value)) return TRUE; return FALSE; }
NPObject *NPN_RetainObject(NPObject* obj) { char msg[1024]; sprintf(msg, "NPN_RetainObject"); logger->logMessage(msg); NPObject *rv = NPNFuncs.retainobject(obj); sprintf(msg, "--Return: %x", rv); logger->logMessage(msg); return rv; }
static bool plugin_object_set_callback (NPObject **listener, const NPVariant *value) { if (!NPVARIANT_IS_OBJECT (*value) && !NPVARIANT_IS_NULL (*value)) return FALSE; if (*listener) funcs.releaseobject (*listener); *listener = NULL; if (NPVARIANT_IS_OBJECT (*value)) { *listener = NPVARIANT_TO_OBJECT (*value); funcs.retainobject (*listener); } return TRUE; }
SEXP R_NP_GetGlobal(SEXP Rplug) { NPP inst = (NPP) R_ExternalPtrAddr(GET_SLOT( Rplug , Rf_install( "ref" ) ) ); NPNetscapeFuncs *funcs = (NPNetscapeFuncs *) R_ExternalPtrAddr(GET_SLOT( GET_SLOT(Rplug, Rf_install("funcs")), Rf_install("ref"))); NPObject *domwin = NULL; NPVariant *toret = (NPVariant *) funcs->memalloc(sizeof(NPVariant)); //NPVariant vartmp2; NPError res; bool success; res = funcs->getvalue(inst, NPNVWindowNPObject , &domwin); funcs->retainobject(domwin); OBJECT_TO_NPVARIANT(domwin, *toret); SEXP ans; PROTECT(ans = R_NilValue); ConvertNPToR(toret, inst, funcs, CONV_REF, &ans); UNPROTECT(1); return ans; }
NPObject *NPN_RetainObject(NPObject *obj) { return NPNFuncs.retainobject(obj); }