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


C++ MutableHandleValue::isPrimitive方法代码示例

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


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

示例1: GetIIDArg

NS_IMETHODIMP
nsJSCID::CreateInstance(HandleValue iidval, JSContext* cx,
                        uint8_t optionalArgc, MutableHandleValue retval)
{
    if (!mDetails->IsValid())
        return NS_ERROR_XPC_BAD_CID;

    if (NS_FAILED(nsXPConnect::SecurityManager()->CanCreateInstance(cx, mDetails->ID()))) {
        NS_ERROR("how are we not being called from chrome here?");
        return NS_OK;
    }

    // If an IID was passed in then use it
    const nsID* iid = GetIIDArg(optionalArgc, iidval, cx);
    if (!iid)
        return NS_ERROR_XPC_BAD_IID;

    nsCOMPtr<nsIComponentManager> compMgr;
    nsresult rv = NS_GetComponentManager(getter_AddRefs(compMgr));
    if (NS_FAILED(rv))
        return NS_ERROR_UNEXPECTED;

    nsCOMPtr<nsISupports> inst;
    rv = compMgr->CreateInstance(mDetails->ID(), nullptr, *iid, getter_AddRefs(inst));
    MOZ_ASSERT(NS_FAILED(rv) || inst, "component manager returned success, but instance is null!");

    if (NS_FAILED(rv) || !inst)
        return NS_ERROR_XPC_CI_RETURNED_FAILURE;

    rv = nsContentUtils::WrapNative(cx, inst, iid, retval);
    if (NS_FAILED(rv) || retval.isPrimitive())
        return NS_ERROR_XPC_CANT_CREATE_WN;
    return NS_OK;
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: JS_WrapValue

// Call WaiveXrayAndWrap when you have a JS object that you don't want to be
// wrapped in an Xray wrapper. cx->compartment is the compartment that will be
// using the returned object. If the object to be wrapped is already in the
// correct compartment, then this returns the unwrapped object.
bool
WrapperFactory::WaiveXrayAndWrap(JSContext *cx, MutableHandleValue vp)
{
    if (vp.isPrimitive())
        return JS_WrapValue(cx, vp);

    RootedObject obj(cx, &vp.toObject());
    if (!WaiveXrayAndWrap(cx, &obj))
        return false;

    vp.setObject(*obj);
    return true;
}
开发者ID:abhishekvp,项目名称:gecko-dev,代码行数:17,代码来源:WrapperFactory.cpp


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