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


C++ IdentifierRep类代码示例

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


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

示例1: _NPN_HasMethod

bool _NPN_HasMethod(NPP, NPObject* o, NPIdentifier methodName)
{
    if (o->_class == NPScriptObjectClass) {
        JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o); 

        IdentifierRep* i = static_cast<IdentifierRep*>(methodName);
        if (!i->isString())
            return false;

        RootObject* rootObject = obj->rootObject;
        if (!rootObject || !rootObject->isValid())
            return false;

        ExecState* exec = rootObject->globalObject()->globalExec();
        JSLockHolder lock(exec);
        JSValue func = obj->imp->get(exec, identifierFromNPIdentifier(exec, i->string()));
        exec->clearException();
        return !func.isUndefined();
    }
    
    if (o->_class->hasMethod)
        return o->_class->hasMethod(o, methodName);
    
    return false;
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:25,代码来源:NP_jsobject.cpp

示例2: dropAllLocks

void CInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray)
{
    if (!NP_CLASS_STRUCT_VERSION_HAS_ENUM(_object->_class) || !_object->_class->enumerate)
        return;

    uint32_t count;
    NPIdentifier* identifiers;

    {
        JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
        ASSERT(globalExceptionString().isNull());
#if PLATFORM(AMIGAOS4)
        bool ok = _object->_class->enumerate(_object, &identifiers, (uint32_t *)&count);
#else
        bool ok = _object->_class->enumerate(_object, &identifiers, &count);
#endif
        moveGlobalExceptionToExecState(exec);
        if (!ok)
            return;
    }

    for (uint32_t i = 0; i < count; i++) {
        IdentifierRep* identifier = static_cast<IdentifierRep*>(identifiers[i]);

        if (identifier->isString())
            nameArray.add(identifierFromNPIdentifier(identifier->string()));
        else
            nameArray.add(Identifier::from(exec, identifier->number()));
    }

    // FIXME: This should really call NPN_MemFree but that's in WebKit
    free(identifiers);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:33,代码来源:c_instance.cpp

示例3: _NPN_HasProperty

bool _NPN_HasProperty(NPP, NPObject* o, NPIdentifier propertyName)
{
    if (o->_class == NPScriptObjectClass) {
        JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o); 

        RootObject* rootObject = obj->rootObject;
        if (!rootObject || !rootObject->isValid())
            return false;

        ExecState* exec = rootObject->globalObject()->globalExec();
        IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
        JSLockHolder lock(exec);
        if (i->isString()) {
            bool result = obj->imp->hasProperty(exec, identifierFromNPIdentifier(exec, i->string()));
            exec->clearException();
            return result;
        }

        bool result = obj->imp->hasProperty(exec, i->number());
        exec->clearException();
        return result;
    }

    if (o->_class->hasProperty)
        return o->_class->hasProperty(o, propertyName);

    return false;
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:28,代码来源:NP_jsobject.cpp

示例4: _NPN_SetProperty

bool _NPN_SetProperty(NPP, NPObject* o, NPIdentifier propertyName, const NPVariant* variant)
{
    if (o->_class == NPScriptObjectClass) {
        JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o); 

        RootObject* rootObject = obj->rootObject;
        if (!rootObject || !rootObject->isValid())
            return false;

        ExecState* exec = rootObject->globalObject()->globalExec();
        JSLockHolder lock(exec);
        IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);

        if (i->isString()) {
            PutPropertySlot slot(obj->imp);
            obj->imp->methodTable()->put(obj->imp, exec, identifierFromNPIdentifier(exec, i->string()), convertNPVariantToValue(exec, variant, rootObject), slot);
        } else
            obj->imp->methodTable()->putByIndex(obj->imp, exec, i->number(), convertNPVariantToValue(exec, variant, rootObject), false);
        exec->clearException();
        return true;
    }

    if (o->_class->setProperty)
        return o->_class->setProperty(o, propertyName, variant);

    return false;
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:27,代码来源:NP_jsobject.cpp

示例5: _NPN_GetProperty

bool _NPN_GetProperty(NPP, NPObject* o, NPIdentifier propertyName, NPVariant* variant)
{
    if (o->_class == NPScriptObjectClass) {
        JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o); 

        RootObject* rootObject = obj->rootObject;
        if (!rootObject || !rootObject->isValid())
            return false;

        ExecState* exec = rootObject->globalObject()->globalExec();
        IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
        
        JSLockHolder lock(exec);
        JSValue result;
        if (i->isString())
            result = obj->imp->get(exec, identifierFromNPIdentifier(exec, i->string()));
        else
            result = obj->imp->get(exec, i->number());

        convertValueToNPVariant(exec, result, variant);
        exec->clearException();
        return true;
    }

    if (o->_class->hasProperty && o->_class->getProperty) {
        if (o->_class->hasProperty(o, propertyName))
            return o->_class->getProperty(o, propertyName, variant);
        return false;
    }

    VOID_TO_NPVARIANT(*variant);
    return false;
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:33,代码来源:NP_jsobject.cpp

示例6: lock

bool NPJSObject::removeProperty(NPIdentifier propertyName)
{
    IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
    
    ExecState* exec = m_objectMap->globalExec();
    if (!exec)
        return false;

    JSLock lock(SilenceAssertionsOnly);
    if (identifierRep->isString()) {
        Identifier identifier = identifierFromIdentifierRep(exec, identifierRep);
        
        if (!m_jsObject->hasProperty(exec, identifier)) {
            exec->clearException();
            return false;
        }
        
        m_jsObject->methodTable()->deleteProperty(m_jsObject.get(), exec, identifier);
    } else {
        if (!m_jsObject->hasProperty(exec, identifierRep->number())) {
            exec->clearException();
            return false;
        }

        m_jsObject->methodTable()->deletePropertyByIndex(m_jsObject.get(), exec, identifierRep->number());
    }

    exec->clearException();
    return true;
}
开发者ID:Moondee,项目名称:Artemis,代码行数:30,代码来源:NPJSObject.cpp

示例7: lock

bool NPJSObject::removeProperty(NPIdentifier propertyName)
{
    IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
    
    ExecState* exec = m_objectMap->globalExec();
    if (!exec)
        return false;

    VM& vm = exec->vm();
    JSLockHolder lock(vm);
    auto scope = DECLARE_CATCH_SCOPE(vm);

    if (identifierRep->isString()) {
        Identifier identifier = identifierFromIdentifierRep(exec, identifierRep);
        
        if (!m_jsObject->hasProperty(exec, identifier)) {
            scope.clearException();
            return false;
        }
        
        m_jsObject->methodTable()->deleteProperty(m_jsObject.get(), exec, identifier);
    } else {
        if (!m_jsObject->hasProperty(exec, identifierRep->number())) {
            scope.clearException();
            return false;
        }

        m_jsObject->methodTable()->deletePropertyByIndex(m_jsObject.get(), exec, identifierRep->number());
    }

    scope.clearException();
    return true;
}
开发者ID:eocanha,项目名称:webkit,代码行数:33,代码来源:NPJSObject.cpp

示例8: PLUGIN_ARCHITECTURE

bool PluginControllerProxy::tryToShortCircuitInvoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, bool& returnValue, NPVariant& result)
{
    // Only try to short circuit evaluate for plug-ins that have the quirk specified.
#if PLUGIN_ARCHITECTURE(MAC)
    if (!PluginProcess::shared().netscapePluginModule()->pluginQuirks().contains(PluginQuirks::CanShortCircuitSomeNPRuntimeCallsDuringInitialization))
        return false;
#else
    return false;
#endif

    // And only when we're in initialize.
    if (!inInitialize())
        return false;
    
    // And only when the NPObject is the window NPObject.
    if (npObject != m_windowNPObject)
        return false;

    // And only when we don't have any arguments.
    if (argumentCount)
        return false;

    IdentifierRep* methodNameRep = static_cast<IdentifierRep*>(methodName);
    if (!methodNameRep->isString())
        return false;

    if (!strcmp(methodNameRep->string(), "__flash_getWindowLocation")) {
        result.type = NPVariantType_String;
        result.value.stringValue = createNPString(m_pluginCreationParameters->parameters.documentURL.utf8()); 
        returnValue = true;
        return true;
    }
    
    if (!strcmp(methodNameRep->string(), "__flash_getTopLocation")) {
        if (m_pluginCreationParameters->parameters.toplevelDocumentURL.isNull()) {
            // If the toplevel document is URL it means that the frame that the plug-in is in doesn't have access to the toplevel document.
            // In this case, just pass the string "[object]" to Flash.
            result.type = NPVariantType_String;
            result.value.stringValue = createNPString("[object]");
            returnValue = true;
            return true;
        }

        result.type = NPVariantType_String;
        result.value.stringValue = createNPString(m_pluginCreationParameters->parameters.toplevelDocumentURL.utf8()); 
        returnValue = true;
        return true;
    }

    return false;
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:51,代码来源:PluginControllerProxy.cpp

示例9: _NPN_Invoke

bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
    if (o->_class == NPScriptObjectClass) {
        JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o); 

        IdentifierRep* i = static_cast<IdentifierRep*>(methodName);
        if (!i->isString())
            return false;

        // Special case the "eval" method.
        if (methodName == _NPN_GetStringIdentifier("eval")) {
            if (argCount != 1)
                return false;
            if (args[0].type != NPVariantType_String)
                return false;
            return _NPN_Evaluate(npp, o, const_cast<NPString*>(&args[0].value.stringValue), result);
        }

        // Look up the function object.
        RootObject* rootObject = obj->rootObject;
        if (!rootObject || !rootObject->isValid())
            return false;
        ExecState* exec = rootObject->globalObject()->globalExec();
        JSLock lock(SilenceAssertionsOnly);
        JSValue function = obj->imp->get(exec, identifierFromNPIdentifier(i->string()));
        CallData callData;
        CallType callType = function.getCallData(callData);
        if (callType == CallTypeNone)
            return false;

        // Call the function object.
        MarkedArgumentBuffer argList;
        getListFromVariantArgs(exec, args, argCount, rootObject, argList);
        ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject();
        globalObject->globalData()->timeoutChecker.start();
        JSValue resultV = JSC::call(exec, function, callType, callData, obj->imp, argList);
        globalObject->globalData()->timeoutChecker.stop();

        // Convert and return the result of the function call.
        convertValueToNPVariant(exec, resultV, result);
        exec->clearException();
        return true;
    }

    if (o->_class->invoke)
        return o->_class->invoke(o, methodName, args, argCount, result);
    
    VOID_TO_NPVARIANT(*result);
    return true;
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:50,代码来源:NP_jsobject.cpp

示例10: npObjectPropertyEnumerator

void npObjectPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info, bool namedProperty)
{
    NPObject* npObject = v8ObjectToNPObject(info.Holder());

    // Verify that our wrapper wasn't using a NPObject which
    // has already been deleted.
    if (!npObject || !_NPN_IsAlive(npObject))
        throwError(v8ReferenceError, "NPObject deleted", info.GetIsolate());

    if (NP_CLASS_STRUCT_VERSION_HAS_ENUM(npObject->_class) && npObject->_class->enumerate) {
        uint32_t count;
        NPIdentifier* identifiers;
        if (npObject->_class->enumerate(npObject, &identifiers, &count)) {
            v8::Handle<v8::Array> properties = v8::Array::New(count);
            for (uint32_t i = 0; i < count; ++i) {
                IdentifierRep* identifier = static_cast<IdentifierRep*>(identifiers[i]);
                if (namedProperty)
                    properties->Set(v8::Integer::New(i, info.GetIsolate()), v8::String::NewSymbol(identifier->string()));
                else
                    properties->Set(v8::Integer::New(i, info.GetIsolate()), v8::Integer::New(identifier->number(), info.GetIsolate()));
            }

            v8SetReturnValue(info, properties);
            return;
        }
    }
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:27,代码来源:V8NPObject.cpp

示例11: _NPN_RemoveProperty

bool _NPN_RemoveProperty(NPP, NPObject* o, NPIdentifier propertyName)
{
    if (o->_class == NPScriptObjectClass) {
        JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o); 

        RootObject* rootObject = obj->rootObject;
        if (!rootObject || !rootObject->isValid())
            return false;

        ExecState* exec = rootObject->globalObject()->globalExec();
        IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
        if (i->isString()) {
            if (!obj->imp->hasProperty(exec, identifierFromNPIdentifier(i->string()))) {
                exec->clearException();
                return false;
            }
        } else {
            if (!obj->imp->hasProperty(exec, i->number())) {
                exec->clearException();
                return false;
            }
        }

        JSLock lock(SilenceAssertionsOnly);
        if (i->isString())
            obj->imp->deleteProperty(exec, identifierFromNPIdentifier(i->string()));
        else
            obj->imp->deleteProperty(exec, i->number());

        exec->clearException();
        return true;
    }
    return false;
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:34,代码来源:NP_jsobject.cpp


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