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


C++ PluginIdentifierParent类代码示例

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


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

示例1: NS_WARNING

bool
PluginScriptableObjectParent::AnswerRemoveProperty(PPluginIdentifierParent* aId,
                                                   bool* aSuccess)
{
  if (!mObject) {
    NS_WARNING("Calling AnswerRemoveProperty with an invalidated object!");
    *aSuccess = false;
    return true;
  }

  NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
  NS_ASSERTION(mType == LocalObject, "Bad type!");

  PluginInstanceParent* instance = GetInstance();
  if (!instance) {
    NS_ERROR("No instance?!");
    *aSuccess = false;
    return true;
  }

  const NPNetscapeFuncs* npn = GetNetscapeFuncs(instance);
  if (!npn) {
    NS_ERROR("No netscape funcs?!");
    *aSuccess = false;
    return true;
  }

  PluginIdentifierParent* id = static_cast<PluginIdentifierParent*>(aId);
  *aSuccess = npn->removeproperty(instance->GetNPP(), mObject,
                                  id->ToNPIdentifier());
  return true;
}
开发者ID:Ajunboys,项目名称:mozilla-os2,代码行数:32,代码来源:PluginScriptableObjectParent.cpp

示例2: NS_ERROR

// static
bool
PluginScriptableObjectParent::ScriptableEnumerate(NPObject* aObject,
                                                  NPIdentifier** aIdentifiers,
                                                  uint32_t* aCount)
{
  if (aObject->_class != GetClass()) {
    NS_ERROR("Don't know what kind of object this is!");
    return false;
  }

  ParentNPObject* object = reinterpret_cast<ParentNPObject*>(aObject);
  if (object->invalidated) {
    NS_WARNING("Calling method on an invalidated object!");
    return false;
  }

  ProtectedActor<PluginScriptableObjectParent> actor(object->parent);
  if (!actor) {
    return false;
  }

  NS_ASSERTION(actor->Type() == Proxy, "Bad type!");

  const NPNetscapeFuncs* npn = GetNetscapeFuncs(aObject);
  if (!npn) {
    NS_ERROR("No netscape funcs!");
    return false;
  }

  AutoInfallibleTArray<PPluginIdentifierParent*, 10> identifiers;
  bool success;
  if (!actor->CallEnumerate(&identifiers, &success)) {
    NS_WARNING("Failed to send message!");
    return false;
  }

  if (!success) {
    return false;
  }

  *aCount = identifiers.Length();
  if (!*aCount) {
    *aIdentifiers = nullptr;
    return true;
  }

  *aIdentifiers = (NPIdentifier*)npn->memalloc(*aCount * sizeof(NPIdentifier));
  if (!*aIdentifiers) {
    NS_ERROR("Out of memory!");
    return false;
  }

  for (uint32_t index = 0; index < *aCount; index++) {
    PluginIdentifierParent* id =
      static_cast<PluginIdentifierParent*>(identifiers[index]);
    (*aIdentifiers)[index] = id->ToNPIdentifier();
  }
  return true;
}
开发者ID:Ajunboys,项目名称:mozilla-os2,代码行数:60,代码来源:PluginScriptableObjectParent.cpp

示例3: NS_WARNING

bool
PluginScriptableObjectParent::AnswerEnumerate(InfallibleTArray<PPluginIdentifierParent*>* aProperties,
                                              bool* aSuccess)
{
  if (!mObject) {
    NS_WARNING("Calling AnswerEnumerate with an invalidated object!");
    *aSuccess = false;
    return true;
  }

  NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
  NS_ASSERTION(mType == LocalObject, "Bad type!");

  PluginInstanceParent* instance = GetInstance();
  if (!instance) {
    NS_ERROR("No instance?!");
    *aSuccess = false;
    return true;
  }

  const NPNetscapeFuncs* npn = GetNetscapeFuncs(instance);
  if (!npn) {
    NS_WARNING("No netscape funcs?!");
    *aSuccess = false;
    return true;
  }

  NPIdentifier* ids;
  uint32_t idCount;
  if (!npn->enumerate(instance->GetNPP(), mObject, &ids, &idCount)) {
    *aSuccess = false;
    return true;
  }

  aProperties->SetCapacity(idCount);

  mozilla::AutoSafeJSContext cx;
  for (uint32_t index = 0; index < idCount; index++) {
    // Because of GC hazards, all identifiers returned from enumerate
    // must be made permanent.
    if (_identifierisstring(ids[index])) {
      JSString* str = NPIdentifierToString(ids[index]);
      if (!JS_StringHasBeenInterned(cx, str)) {
        DebugOnly<JSString*> str2 = JS_InternJSString(cx, str);
        NS_ASSERTION(str2 == str, "Interning a JS string which is currently an ID should return itself.");
      }
    }
    PluginIdentifierParent* id =
      instance->Module()->GetIdentifierForNPIdentifier(instance->GetNPP(), ids[index]);
    aProperties->AppendElement(id);
    NS_ASSERTION(!id->IsTemporary(), "Should only have permanent identifiers!");
  }

  npn->memfree(ids);
  *aSuccess = true;
  return true;
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:57,代码来源:PluginScriptableObjectParent.cpp

示例4: PluginIdentifierParent

PluginIdentifierParent*
PluginModuleParent::GetIdentifierForNPIdentifier(NPP npp, NPIdentifier aIdentifier)
{
    PluginIdentifierParent* ident;
    if (mIdentifiers.Get(aIdentifier, &ident)) {
        if (ident->IsTemporary()) {
            ident->AddTemporaryRef();
        }
        return ident;
    }

    nsCString string;
    int32_t intval = -1;
    bool temporary = false;
    if (mozilla::plugins::parent::_identifierisstring(aIdentifier)) {
        NPUTF8* chars =
            mozilla::plugins::parent::_utf8fromidentifier(aIdentifier);
        if (!chars) {
            return nsnull;
        }
        string.Adopt(chars);
        temporary = !NPStringIdentifierIsPermanent(npp, aIdentifier);
    }
    else {
        intval = mozilla::plugins::parent::_intfromidentifier(aIdentifier);
        string.SetIsVoid(PR_TRUE);
    }

    ident = new PluginIdentifierParent(aIdentifier, temporary);
    if (!SendPPluginIdentifierConstructor(ident, string, intval, temporary))
        return nsnull;

    if (!temporary) {
        mIdentifiers.Put(aIdentifier, ident);
    }
    return ident;
}
开发者ID:typ4rk,项目名称:mozilla-history,代码行数:37,代码来源:PluginModuleParent.cpp


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