当前位置: 首页>>代码示例>>C++>>正文


C++ NPNetscapeFuncs::releaseobject方法代码示例

本文整理汇总了C++中NPNetscapeFuncs::releaseobject方法的典型用法代码示例。如果您正苦于以下问题:C++ NPNetscapeFuncs::releaseobject方法的具体用法?C++ NPNetscapeFuncs::releaseobject怎么用?C++ NPNetscapeFuncs::releaseobject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NPNetscapeFuncs的用法示例。


在下文中一共展示了NPNetscapeFuncs::releaseobject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

static void
cloud_spy_log (const gchar * log_domain, GLogLevelFlags log_level, const gchar * message, gpointer user_data)
{
  NPNetscapeFuncs * browser = cloud_spy_nsfuncs;
  NPP instance = static_cast<NPP> (user_data);
  NPObject * window = NULL, * console = NULL;
  NPVariant variant, result;
  NPError error;

  (void) log_domain;
  (void) log_level;

  error = browser->getvalue (instance, NPNVWindowNPObject, &window);
  if (error != NPERR_NO_ERROR)
    goto beach;

  VOID_TO_NPVARIANT (variant);
  if (!browser->getproperty (instance, window, browser->getstringidentifier ("console"), &variant))
    goto beach;
  console = NPVARIANT_TO_OBJECT (variant);

  STRINGZ_TO_NPVARIANT (message, variant);
  VOID_TO_NPVARIANT (result);
  if (!browser->invoke (instance, console, browser->getstringidentifier ("log"), &variant, 1, &result))
    goto beach;
  browser->releasevariantvalue (&result);

beach:
  if (console != NULL)
    browser->releaseobject (console);
  if (window != NULL)
    browser->releaseobject (window);
}
开发者ID:key2,项目名称:frida-ire,代码行数:33,代码来源:cloud-spy-plugin.cpp

示例2: if

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;
}
开发者ID:gcampax,项目名称:sweettooth-plugin,代码行数:25,代码来源:sweettooth-plugin.c

示例3: NPN_ReleaseObject

void NPN_ReleaseObject(NPObject *obj)
{
    char msg[1024];
    sprintf(msg, "NPN_ReleaseObject");
    logger->logMessage(msg);

    NPNFuncs.releaseobject(obj);

    sprintf(msg, "--Return.");
    logger->logMessage(msg);
}
开发者ID:bluebellzhy,项目名称:chromium,代码行数:11,代码来源:npn_gate.cpp

示例4:

static void
plugin_object_deallocate (NPObject *npobj)
{
  PluginObject *obj = (PluginObject*)npobj;

  g_signal_handler_disconnect (obj->proxy, obj->signal_id);
  g_object_unref (obj->proxy);

  if (obj->listener)
    funcs.releaseobject (obj->listener);

  g_debug ("plugin object destroyed");

  g_slice_free (PluginObject, obj);
}
开发者ID:gcampax,项目名称:sweettooth-plugin,代码行数:15,代码来源:sweettooth-plugin.c

示例5:

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;
}
开发者ID:PeterDaveHello,项目名称:deepin-gnome-shell,代码行数:19,代码来源:browser-plugin.c

示例6: NPN_ReleaseObject

void NPN_ReleaseObject(NPObject *obj)
{
  return NPNFuncs.releaseobject(obj);
}
开发者ID:gfunkmonk2,项目名称:mate-movie-player,代码行数:4,代码来源:idolNPNGlue.cpp

示例7: R_NPAPI_Invoke

SEXP R_NPAPI_Invoke(SEXP plug, SEXP Robj, SEXP Rname, SEXP Rargs, SEXP RconvArgsEnum, SEXP RconvArgsFuns, SEXP RconvRet, SEXP RkeepRes )
{
 
  NPP inst = (NPP) R_ExternalPtrAddr(GET_SLOT( plug , Rf_install( "ref" ) ) );
  NPNetscapeFuncs *funcs = (NPNetscapeFuncs *) R_ExternalPtrAddr(GET_SLOT( GET_SLOT(plug, Rf_install("funcs")), Rf_install("ref")));

  NPVariant *obj = (NPVariant *) R_ExternalPtrAddr(GET_SLOT( Robj , Rf_install( "ref" ) ) );
  
  if(!NPVARIANT_IS_OBJECT(*obj))
    {
      //What should we return in this case?
      Rf_error("Robj is not an NPVariant containing an NPObject.");
      return R_NilValue;
    }
  //custom conversion functions are applied on R side for return value.
  convert_t convRet = (convert_t) INTEGER(RconvRet)[0];
  convert_t curConvArg;
 
  int nargs = LENGTH(Rargs);
  NPVariant *args = (NPVariant *) funcs->memalloc(nargs*sizeof(NPVariant));
  
  for(int i = 0; i < nargs; i++)
    {
      curConvArg = (convert_t) INTEGER(RconvArgsEnum)[i];
      ConvertRToNP(VECTOR_ELT(Rargs, i), inst, funcs, &(args[i]), curConvArg);
      //If we have a custom converter we invoke it with here
      if(curConvArg == CONV_CUSTOM)
	{
	  fprintf(stderr, "Custom argument converter detected. Attempting to call JS Conversion function.");fflush(stderr);
	  funcs->invokeDefault(inst, ((NPVariant *) R_ExternalPtrAddr(GET_SLOT( VECTOR_ELT(RconvArgsFuns, i), Rf_install( "ref" ) ) ) ) -> value.objectValue, &args[i], 1, &args[i]) ;
	}
    }

  NPVariant *ret = (NPVariant *) funcs->memalloc(sizeof(NPVariant)); 
  
  const char *ccname = CHAR(STRING_ELT(Rname, 0));
  bool hasMethod = funcs->hasmethod(inst, obj->value.objectValue,  funcs->getstringidentifier(ccname));
  if(!hasMethod)
    {
      char msg[200];
      sprintf(msg, "Object has no %s method.", ccname);
      Rf_error(msg);
      return R_NilValue;
    }    
  bool success = funcs->invoke(inst, obj->value.objectValue, funcs->getstringidentifier(ccname), args, nargs, ret);
  if(!success)
    {
      fprintf(stderr, "\nInvocation of JS method %s failed.", ccname);fflush(stderr);
    }
  for(int j=0; j<nargs; j++)
    {
            if (NPVARIANT_IS_OBJECT(args[j]))
	      funcs->releaseobject(args[j].value.objectValue);
	    //funcs->releasevariantvalue(&args[j]);
    }
  funcs->memfree(args);
  
  if(!success)
    {
      char msg2[200];
      sprintf(msg2, "Invoke failed for %s method.", ccname);
      Rf_error(msg2);
      return R_NilValue;
    }
    
  SEXP ans;
  //PROTECT(ans = R_NilValue);
  PROTECT(ans = NEW_INTEGER(1));
  bool canfree = ConvertNPToR(ret, inst, funcs, convRet, &ans);
  bool keepRes = LOGICAL(RkeepRes)[0];
  if(canfree || !keepRes)
    funcs->releasevariantvalue(ret);
  
  UNPROTECT(1);
  if(keepRes)
    return ans ;
  else
    return R_NilValue;
}
开发者ID:gmbecker,项目名称:RBrowserPlugin,代码行数:79,代码来源:NPAPI.cpp

示例8: NPN_ReleaseObject

void NPN_ReleaseObject(NPObject *npobj)
{
	NPNFuncs.releaseobject(npobj);
}
开发者ID:dbluelle,项目名称:lightspark,代码行数:4,代码来源:npn_gate.cpp


注:本文中的NPNetscapeFuncs::releaseobject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。