• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ V8StringResource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: toDouble

void V8BooleanOrStringOrUnrestrictedDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, BooleanOrStringOrUnrestrictedDouble& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
    if (v8Value.IsEmpty())
        return;

    if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
        return;

    if (v8Value->IsBoolean()) {
        impl.setBoolean(v8Value.As<v8::Boolean>()->Value());
        return;
    }

    if (v8Value->IsNumber()) {
        double cppValue = toDouble(isolate, v8Value, exceptionState);
        if (exceptionState.hadException())
            return;
        impl.setUnrestrictedDouble(cppValue);
        return;
    }

    {
        V8StringResource<> cppValue = v8Value;
        if (!cppValue.prepare(exceptionState))
            return;
        impl.setString(cppValue);
        return;
    }
}
开发者ID:mirror,项目名称:chromium,代码行数:28,代码来源:BooleanOrStringOrUnrestrictedDouble.cpp


示例2: constructor

static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceEventInitConstructor", info.Holder(), info.GetIsolate());
    if (UNLIKELY(info.Length() < 2)) {
        setMinimumArityTypeError(exceptionState, 2, info.Length());
        exceptionState.throwIfNeeded();
        return;
    }
    V8StringResource<> type;
    TestInterfaceEventInit testInterfaceEventInit;
    {
        type = info[0];
        if (!type.prepare())
            return;
        if (!isUndefinedOrNull(info[1]) && !info[1]->IsObject()) {
            exceptionState.throwTypeError("parameter 2 ('testInterfaceEventInit') is not an object.");
            exceptionState.throwIfNeeded();
            return;
        }
        V8TestInterfaceEventInit::toImpl(info.GetIsolate(), info[1], testInterfaceEventInit, exceptionState);
        if (exceptionState.throwIfNeeded())
            return;
    }
    RefPtrWillBeRawPtr<TestInterfaceEventInitConstructor> impl = TestInterfaceEventInitConstructor::create(type, testInterfaceEventInit);
    v8::Local<v8::Object> wrapper = info.Holder();
    wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceEventInitConstructor::wrapperTypeInfo, wrapper);
    v8SetReturnValue(info, wrapper);
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:28,代码来源:V8TestInterfaceEventInitConstructor.cpp


示例3: block

void V8TestInterfaceEventInit::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceEventInit& impl, ExceptionState& exceptionState) {
  if (isUndefinedOrNull(v8Value)) {
    return;
  }
  if (!v8Value->IsObject()) {
    exceptionState.throwTypeError("cannot convert to dictionary.");
    return;
  }

  V8EventInit::toImpl(isolate, v8Value, impl, exceptionState);
  if (exceptionState.hadException())
    return;

  v8::TryCatch block(isolate);
  v8::Local<v8::Object> v8Object;
  if (!v8Call(v8Value->ToObject(isolate->GetCurrentContext()), v8Object, block)) {
    exceptionState.rethrowV8Exception(block.Exception());
    return;
  }
  v8::Local<v8::Value> stringMemberValue;
  if (!v8Object->Get(isolate->GetCurrentContext(), v8String(isolate, "stringMember")).ToLocal(&stringMemberValue)) {
    exceptionState.rethrowV8Exception(block.Exception());
    return;
  }
  if (stringMemberValue.IsEmpty() || stringMemberValue->IsUndefined()) {
    // Do nothing.
  } else {
    V8StringResource<> stringMember = stringMemberValue;
    if (!stringMember.prepare(exceptionState))
      return;
    impl.setStringMember(stringMember);
  }
}
开发者ID:mirror,项目名称:chromium,代码行数:33,代码来源:V8TestInterfaceEventInit.cpp


示例4: V8TestInterfaceWillBeGarbageCollectedConstructorCallback

static void V8TestInterfaceWillBeGarbageCollectedConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    if (!info.IsConstructCall()) {
        V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("TestInterface"));
        return;
    }

    if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
        v8SetReturnValue(info, info.Holder());
        return;
    }
    if (UNLIKELY(info.Length() < 1)) {
        V8ThrowException::throwException(createMinimumArityTypeErrorForConstructor(info.GetIsolate(), "TestInterfaceWillBeGarbageCollected", 1, info.Length()), info.GetIsolate());
        return;
    }
    V8StringResource<> str;
    {
        str = info[0];
        if (!str.prepare())
            return;
    }
    RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterfaceWillBeGarbageCollected::createForJSConstructor(str);
    v8::Local<v8::Object> wrapper = info.Holder();
    wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceWillBeGarbageCollectedConstructor::wrapperTypeInfo, wrapper);
    v8SetReturnValue(info, wrapper);
}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:26,代码来源:V8TestInterfaceWillBeGarbageCollected.cpp


示例5: partialVoidTestEnumModulesArgMethodMethod

static void partialVoidTestEnumModulesArgMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoidTestEnumModulesArgMethod", "TestInterface", info.Holder(), info.GetIsolate());
    if (UNLIKELY(info.Length() < 1)) {
        setMinimumArityTypeError(exceptionState, 1, info.Length());
        exceptionState.throwIfNeeded();
        return;
    }
    TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
    V8StringResource<> arg;
    {
        arg = info[0];
        if (!arg.prepare())
            return;
        const char* validValues[] = {
            "EnumModulesValue1",
            "EnumModulesValue2",
        };
        if (!isValidEnum(arg, validValues, WTF_ARRAY_LENGTH(validValues), "TestEnumModules", exceptionState)) {
            exceptionState.throwIfNeeded();
            return;
        }
    }
    TestPartialInterfaceImplementation3::partialVoidTestEnumModulesArgMethod(*impl, arg);
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:25,代码来源:V8TestInterfacePartial.cpp


示例6: reflectUrlStringAttributeAttributeSetter

static void reflectUrlStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    Element* impl = V8Element::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    impl->setAttribute(HTMLNames::reflecturlstringattributeAttr, cppValue);
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:9,代码来源:V8TestInterfaceNode.cpp


示例7: hrefAttributeSetter

static void hrefAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    TestNode* impl = V8TestNode::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    impl->setHref(cppValue);
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:9,代码来源:V8TestNode.cpp


示例8: hrefCallWithAttributeSetter

static void hrefCallWithAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    TestNode* impl = V8TestNode::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
    impl->setHrefCallWith(executionContext, currentDOMWindow(info.GetIsolate()), enteredDOMWindow(info.GetIsolate()), cppValue);
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:10,代码来源:V8TestNode.cpp


示例9: staticVoidMethodPartialOverload2Method

static void staticVoidMethodPartialOverload2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    V8StringResource<> value;
    {
        value = info[0];
        if (!value.prepare())
            return;
    }
    TestPartialInterfaceImplementation3::staticVoidMethodPartialOverload(value);
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:10,代码来源:V8TestInterfacePartial.cpp


示例10: staticPromiseMethodPartialOverload2MethodPromise

static void staticPromiseMethodPartialOverload2MethodPromise(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionState)
{
    V8StringResource<> value;
    {
        value = info[0];
        if (!value.prepare(exceptionState))
            return;
    }
    v8SetReturnValue(info, TestPartialInterfaceImplementation3::staticPromiseMethodPartialOverload(value).v8Value());
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:10,代码来源:V8TestInterfacePartial.cpp


示例11: typeAttributeSetter

static void typeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    SVGTestInterface* impl = V8SVGTestInterface::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
    impl->setAttribute(SVGNames::typeAttr, cppValue);
}
开发者ID:joone,项目名称:blink-crosswalk,代码行数:10,代码来源:V8SVGTestInterface.cpp


示例12: hrefThrowsAttributeSetter

static void hrefThrowsAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    ExceptionState exceptionState(ExceptionState::SetterContext, "hrefThrows", "TestNode", holder, info.GetIsolate());
    TestNode* impl = V8TestNode::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    impl->setHrefThrows(cppValue, exceptionState);
    exceptionState.throwIfNeeded();
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:11,代码来源:V8TestNode.cpp


示例13: voidMethodPartialOverload3Method

static void voidMethodPartialOverload3Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
    V8StringResource<> value;
    {
        value = info[0];
        if (!value.prepare())
            return;
    }
    TestPartialInterfaceImplementation3::voidMethodPartialOverload(*impl, value);
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:11,代码来源:V8TestInterfacePartial.cpp


示例14: constructor1

static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    V8StringResource<> stringArg;
    {
        stringArg = info[0];
        if (!stringArg.prepare())
            return;
    }
    RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(stringArg);
    v8::Local<v8::Object> wrapper = info.Holder();
    wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper);
    v8SetReturnValue(info, wrapper);
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:13,代码来源:V8TestInterfaceConstructor2.cpp


示例15: voidMethodPartial2Method

static void voidMethodPartial2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    if (UNLIKELY(info.Length() < 1)) {
        V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "voidMethodPartial2", "TestInterface2", 1, info.Length()), info.GetIsolate());
        return;
    }
    TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
    V8StringResource<> value;
    {
        value = info[0];
        if (!value.prepare())
            return;
    }
    TestInterface2Partial2::voidMethodPartial2(*impl, value);
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:15,代码来源:V8TestInterface2Partial.cpp


示例16: locationAttributeSetter

static void locationAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
  v8::Local<v8::Object> holder = info.Holder();
  TestInterfaceDocument* proxyImpl = V8TestInterfaceDocument::toImpl(holder);
  Location* impl = WTF::getPtr(proxyImpl->location());
  if (!impl)
    return;

  ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "TestInterfaceDocument", "location");

  // Prepare the value to be set.
  V8StringResource<> cppValue = v8Value;
  if (!cppValue.prepare())
    return;

  impl->setHref(currentDOMWindow(info.GetIsolate()), enteredDOMWindow(info.GetIsolate()), cppValue, exceptionState);
}
开发者ID:mirror,项目名称:chromium,代码行数:16,代码来源:V8TestInterfaceDocument.cpp


示例17: constructor

static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    if (UNLIKELY(info.Length() < 1)) {
        V8ThrowException::throwException(createMinimumArityTypeErrorForConstructor(info.GetIsolate(), "TestInterfaceConstructor3", 1, info.Length()), info.GetIsolate());
        return;
    }
    V8StringResource<> stringArg;
    {
        stringArg = info[0];
        if (!stringArg.prepare())
            return;
    }
    RefPtr<TestInterfaceConstructor3> impl = TestInterfaceConstructor3::create(stringArg);
    v8::Local<v8::Object> wrapper = info.Holder();
    impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructor3::wrapperTypeInfo, wrapper);
    v8SetReturnValue(info, wrapper);
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:17,代码来源:V8TestInterfaceConstructor3.cpp


示例18: voidMethodFloatArgStringArgMethod

static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodFloatArgStringArg", "TestTypedefs", info.Holder(), info.GetIsolate());
    if (UNLIKELY(info.Length() < 2)) {
        setMinimumArityTypeError(exceptionState, 2, info.Length());
        exceptionState.throwIfNeeded();
        return;
    }
    TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
    float floatArg;
    V8StringResource<> stringArg;
    {
        floatArg = toRestrictedFloat(info.GetIsolate(), info[0], exceptionState);
        if (exceptionState.throwIfNeeded())
            return;
        stringArg = info[1];
        if (!stringArg.prepare())
            return;
    }
    impl->voidMethodFloatArgStringArg(floatArg, stringArg);
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:21,代码来源:V8TestTypedefs.cpp


示例19:

void V8TestInterfaceGarbageCollectedOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceGarbageCollectedOrString& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
  if (v8Value.IsEmpty())
    return;

  if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
    return;

  if (V8TestInterfaceGarbageCollected::hasInstance(v8Value, isolate)) {
    TestInterfaceGarbageCollected* cppValue = V8TestInterfaceGarbageCollected::toImpl(v8::Local<v8::Object>::Cast(v8Value));
    impl.setTestInterfaceGarbageCollected(cppValue);
    return;
  }

  {
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare(exceptionState))
      return;
    impl.setString(cppValue);
    return;
  }
}
开发者ID:mirror,项目名称:chromium,代码行数:21,代码来源:TestInterfaceGarbageCollectedOrString.cpp


示例20: deleteNamedItemMethod

static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
  ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface2", "deleteNamedItem");

  TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());

  if (UNLIKELY(info.Length() < 1)) {
    exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
    return;
  }

  V8StringResource<> name;
  name = info[0];
  if (!name.prepare())
    return;

  bool result = impl->deleteNamedItem(name, exceptionState);
  if (exceptionState.hadException()) {
    return;
  }
  v8SetReturnValueBool(info, result);
}
开发者ID:mirror,项目名称:chromium,代码行数:21,代码来源:V8TestInterface2.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ V8TestingScope类代码示例发布时间:2022-05-31
下一篇:
C++ V8Proxy类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap