这篇教程C++ v8SetReturnValue函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中v8SetReturnValue函数的典型用法代码示例。如果您正苦于以下问题:C++ v8SetReturnValue函数的具体用法?C++ v8SetReturnValue怎么用?C++ v8SetReturnValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了v8SetReturnValue函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: V8TestInterfaceNamedConstructor2ConstructorCallbackstatic void V8TestInterfaceNamedConstructor2ConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info){ if (!info.IsConstructCall()) { V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("Audio")); return; } if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) { v8SetReturnValue(info, info.Holder()); return; } if (UNLIKELY(info.Length() < 1)) { V8ThrowException::throwException(createMinimumArityTypeErrorForConstructor(info.GetIsolate(), "TestInterfaceNamedConstructor2", 1, info.Length()), info.GetIsolate()); return; } V8StringResource<> stringArg; { stringArg = info[0]; if (!stringArg.prepare()) return; } RefPtr<TestInterfaceNamedConstructor2> impl = TestInterfaceNamedConstructor2::createForJSConstructor(stringArg); v8::Local<v8::Object> wrapper = info.Holder(); wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceNamedConstructor2Constructor::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper);}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:26,
示例2: constructor4static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& info){ ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor2", info.Holder(), info.GetIsolate()); TestInterfaceEmpty* testInterfaceEmptyArg; int longArg; V8StringResource<> defaultUndefinedOptionalStringArg; V8StringResource<> defaultNullStringOptionalStringArg; Dictionary defaultUndefinedOptionalDictionaryArg; V8StringResource<> optionalStringArg; { int numArgsPassed = info.Length(); while (numArgsPassed > 0) { if (!info[numArgsPassed - 1]->IsUndefined()) break; --numArgsPassed; } testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), info[0]); if (!testInterfaceEmptyArg) { exceptionState.throwTypeError("parameter 1 is not of type 'TestInterfaceEmpty'."); exceptionState.throwIfNeeded(); return; } longArg = toInt32(info.GetIsolate(), info[1], NormalConversion, exceptionState); if (exceptionState.throwIfNeeded()) return; defaultUndefinedOptionalStringArg = info[2]; if (!defaultUndefinedOptionalStringArg.prepare()) return; if (!info[3]->IsUndefined()) { defaultNullStringOptionalStringArg = info[3]; if (!defaultNullStringOptionalStringArg.prepare()) return; } else { defaultNullStringOptionalStringArg = nullptr; } if (!isUndefinedOrNull(info[4]) && !info[4]->IsObject()) { exceptionState.throwTypeError("parameter 5 ('defaultUndefinedOptionalDictionaryArg') is not an object."); exceptionState.throwIfNeeded(); return; } defaultUndefinedOptionalDictionaryArg = Dictionary(info[4], info.GetIsolate(), exceptionState); if (exceptionState.throwIfNeeded()) return; if (UNLIKELY(numArgsPassed <= 5)) { RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(testInterfaceEmptyArg, longArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalStringArg, defaultUndefinedOptionalDictionaryArg); v8::Local<v8::Object> wrapper = info.Holder(); wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper); return; } optionalStringArg = info[5]; if (!optionalStringArg.prepare()) return; } RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(testInterfaceEmptyArg, longArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalStringArg, defaultUndefinedOptionalDictionaryArg, optionalStringArg); v8::Local<v8::Object> wrapper = info.Holder(); wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper);}
开发者ID:howardroark2018,项目名称:chromium,代码行数:59,
示例3: TOSTRING_VOIDvoid V8HTMLCanvasElement::getContextMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info){ v8::Handle<v8::Object> holder = info.Holder(); v8::Isolate* isolate = info.GetIsolate(); HTMLCanvasElement* impl = V8HTMLCanvasElement::toNative(holder); TOSTRING_VOID(V8StringResource<>, contextIdResource, info[0]); String contextId = contextIdResource; RefPtr<CanvasContextAttributes> attributes = nullptr; if (contextId == "webgl" || contextId == "experimental-webgl") { RefPtr<WebGLContextAttributes> webGLAttributes = WebGLContextAttributes::create(); if (info.Length() > 1 && info[1]->IsObject()) { v8::Handle<v8::Object> jsAttributes = info[1]->ToObject(); v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha"); if (jsAttributes->Has(alpha) && !isUndefinedOrNull(jsAttributes->Get(alpha))) webGLAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanValue()); v8::Handle<v8::String> depth = v8AtomicString(isolate, "depth"); if (jsAttributes->Has(depth) && !isUndefinedOrNull(jsAttributes->Get(depth))) webGLAttributes->setDepth(jsAttributes->Get(depth)->BooleanValue()); v8::Handle<v8::String> stencil = v8AtomicString(isolate, "stencil"); if (jsAttributes->Has(stencil) && !isUndefinedOrNull(jsAttributes->Get(stencil))) webGLAttributes->setStencil(jsAttributes->Get(stencil)->BooleanValue()); v8::Handle<v8::String> antialias = v8AtomicString(isolate, "antialias"); if (jsAttributes->Has(antialias) && !isUndefinedOrNull(jsAttributes->Get(antialias))) webGLAttributes->setAntialias(jsAttributes->Get(antialias)->BooleanValue()); v8::Handle<v8::String> premultipliedAlpha = v8AtomicString(isolate, "premultipliedAlpha"); if (jsAttributes->Has(premultipliedAlpha) && !isUndefinedOrNull(jsAttributes->Get(premultipliedAlpha))) webGLAttributes->setPremultipliedAlpha(jsAttributes->Get(premultipliedAlpha)->BooleanValue()); v8::Handle<v8::String> preserveDrawingBuffer = v8AtomicString(isolate, "preserveDrawingBuffer"); if (jsAttributes->Has(preserveDrawingBuffer) && !isUndefinedOrNull(jsAttributes->Get(preserveDrawingBuffer))) webGLAttributes->setPreserveDrawingBuffer(jsAttributes->Get(preserveDrawingBuffer)->BooleanValue()); v8::Handle<v8::String> failIfMajorPerformanceCaveat = v8AtomicString(isolate, "failIfMajorPerformanceCaveat"); if (jsAttributes->Has(failIfMajorPerformanceCaveat) && !isUndefinedOrNull(jsAttributes->Get(failIfMajorPerformanceCaveat))) webGLAttributes->setFailIfMajorPerformanceCaveat(jsAttributes->Get(failIfMajorPerformanceCaveat)->BooleanValue()); } attributes = webGLAttributes; } else { RefPtr<Canvas2DContextAttributes> canvas2DAttributes = Canvas2DContextAttributes::create(); attributes = canvas2DAttributes; } CanvasRenderingContext* result = impl->getContext(contextId, attributes.get()); if (!result) { v8SetReturnValueNull(info); return; } if (result->is2d()) { v8::Handle<v8::Value> v8Result = toV8(toCanvasRenderingContext2D(result), info.Holder(), info.GetIsolate()); v8SetReturnValue(info, v8Result); return; } if (result->is3d()) { v8::Handle<v8::Value> v8Result = toV8(toWebGLRenderingContext(result), info.Holder(), info.GetIsolate()); v8SetReturnValue(info, v8Result); return; } ASSERT_NOT_REACHED(); v8SetReturnValueNull(info);}
开发者ID:davemichael,项目名称:mojo,代码行数:57,
示例4: worldTypeInMainThread// FIXME(fqian): returning string is cheating, and we should// fix this by calling toString function on the receiver.// However, V8 implements toString in JavaScript, which requires// switching context of receiver. I consider it is dangerous.void V8Window::toStringMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args){ v8::Handle<v8::Object> domWrapper = args.This()->FindInstanceInPrototypeChain(V8Window::GetTemplate(args.GetIsolate(), worldTypeInMainThread(args.GetIsolate()))); if (domWrapper.IsEmpty()) { v8SetReturnValue(args, args.This()->ObjectProtoToString()); return; } v8SetReturnValue(args, domWrapper->ObjectProtoToString());}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:13,
示例5: v8SetReturnValue// FIXME(fqian): returning string is cheating, and we should// fix this by calling toString function on the receiver.// However, V8 implements toString in JavaScript, which requires// switching context of receiver. I consider it is dangerous.void V8Window::toStringMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info){ v8::Handle<v8::Object> domWrapper = V8Window::findInstanceInPrototypeChain(info.This(), info.GetIsolate()); if (domWrapper.IsEmpty()) { v8SetReturnValue(info, info.This()->ObjectProtoToString()); return; } v8SetReturnValue(info, domWrapper->ObjectProtoToString());}
开发者ID:smil-in-javascript,项目名称:blink,代码行数:13,
示例6: OSvoid V8InspectorFrontendHost::platformMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info){#if OS(MACOSX) v8SetReturnValue(info, v8AtomicString(info.GetIsolate(), "mac"));#elif OS(WIN) v8SetReturnValue(info, v8AtomicString(info.GetIsolate(), "windows"));#else // Unix-like systems v8SetReturnValue(info, v8AtomicString(info.GetIsolate(), "linux"));#endif}
开发者ID:Mihiri,项目名称:blink,代码行数:10,
示例7: v8SetReturnValuevoid V8PopStateEvent::stateAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>& info){ v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::state(info.GetIsolate())); if (!result.IsEmpty()) { v8SetReturnValue(info, result); return; } PopStateEvent* event = V8PopStateEvent::toImpl(info.Holder()); History* history = event->history(); if (!history || !event->serializedState()) { if (!event->serializedState()) { // If we're in an isolated world and the event was created in the main world, // we need to find the 'state' property on the main world wrapper and clone it. v8::Local<v8::Value> mainWorldState = V8HiddenValue::getHiddenValueFromMainWorldWrapper(info.GetIsolate(), event, V8HiddenValue::state(info.GetIsolate())); if (!mainWorldState.IsEmpty()) event->setSerializedState(SerializedScriptValueFactory::instance().createAndSwallowExceptions(info.GetIsolate(), mainWorldState)); } if (event->serializedState()) result = event->serializedState()->deserialize(); else result = v8::Null(info.GetIsolate()); v8SetReturnValue(info, cacheState(info.Holder(), result, info.GetIsolate())); return; } // There's no cached value from a previous invocation, nor a state value was provided by the // event, but there is a history object, so first we need to see if the state object has been // deserialized through the history object already. // The current history state object might've changed in the meantime, so we need to take care // of using the correct one, and always share the same deserialization with history.state. bool isSameState = history->isSameAsCurrentState(event->serializedState()); if (isSameState) { v8::Local<v8::Value> v8HistoryValue = toV8(history, info.Holder(), info.GetIsolate()); if (v8HistoryValue.IsEmpty()) return; v8::Local<v8::Object> v8History = v8HistoryValue.As<v8::Object>(); if (!history->stateChanged()) { result = V8HiddenValue::getHiddenValue(info.GetIsolate(), v8History, V8HiddenValue::state(info.GetIsolate())); if (!result.IsEmpty()) { v8SetReturnValue(info, cacheState(info.Holder(), result, info.GetIsolate())); return; } } result = event->serializedState()->deserialize(info.GetIsolate()); V8HiddenValue::setHiddenValue(info.GetIsolate(), v8History, V8HiddenValue::state(info.GetIsolate()), result); } else { result = event->serializedState()->deserialize(info.GetIsolate()); } v8SetReturnValue(info, cacheState(info.Holder(), result, info.GetIsolate()));}
开发者ID:joone,项目名称:blink-crosswalk,代码行数:55,
示例8: v8SetReturnValuevoid V8InjectedScriptHost::isHTMLAllCollectionMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info){ if (info.Length() < 1) return; if (!info[0]->IsObject()) { v8SetReturnValue(info, false); return; } v8SetReturnValue(info, V8HTMLAllCollection::HasInstance(info[0], info.GetIsolate(), worldType(info.GetIsolate())));}
开发者ID:chunywang,项目名称:blink-crosswalk,代码行数:12,
示例9: v8SetReturnValuevoid V8PopStateEvent::stateAttributeGetterCustom(const v8::FunctionCallbackInfo<v8::Value>& info){ v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::state(info.GetIsolate())); if (!result.IsEmpty()) { v8SetReturnValue(info, result); return; } PopStateEvent* event = V8PopStateEvent::toImpl(info.Holder()); History* history = event->history(); if (!history || !event->serializedState()) { // If the event doesn't have serializedState(), it means that the // event was initialized with PopStateEventInit. In such case, we need // to get a v8 value for the current world from state(). if (event->serializedState()) result = event->serializedState()->deserialize(); else result = event->state().v8ValueFor(ScriptState::current(info.GetIsolate())); if (result.IsEmpty()) result = v8::Null(info.GetIsolate()); v8SetReturnValue(info, cacheState(info.Holder(), result, info.GetIsolate())); return; } // There's no cached value from a previous invocation, nor a state value was provided by the // event, but there is a history object, so first we need to see if the state object has been // deserialized through the history object already. // The current history state object might've changed in the meantime, so we need to take care // of using the correct one, and always share the same deserialization with history.state. bool isSameState = history->isSameAsCurrentState(event->serializedState()); if (isSameState) { v8::Local<v8::Value> v8HistoryValue = toV8(history, info.Holder(), info.GetIsolate()); if (v8HistoryValue.IsEmpty()) return; v8::Local<v8::Object> v8History = v8HistoryValue.As<v8::Object>(); if (!history->stateChanged()) { result = V8HiddenValue::getHiddenValue(info.GetIsolate(), v8History, V8HiddenValue::state(info.GetIsolate())); if (!result.IsEmpty()) { v8SetReturnValue(info, cacheState(info.Holder(), result, info.GetIsolate())); return; } } result = event->serializedState()->deserialize(info.GetIsolate()); V8HiddenValue::setHiddenValue(info.GetIsolate(), v8History, V8HiddenValue::state(info.GetIsolate()), result); } else { result = event->serializedState()->deserialize(info.GetIsolate()); } v8SetReturnValue(info, cacheState(info.Holder(), result, info.GetIsolate()));}
开发者ID:dstockwell,项目名称:blink,代码行数:53,
示例10: promiseMethodPartialOverload3Methodstatic void promiseMethodPartialOverload3Method(const v8::FunctionCallbackInfo<v8::Value>& info){ TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); Document* document; { document = V8Document::toImplWithTypeCheck(info.GetIsolate(), info[0]); if (!document) { v8SetReturnValue(info, ScriptPromise::rejectRaw(ScriptState::current(info.GetIsolate()), V8ThrowException::createTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("promiseMethodPartialOverload", "TestInterface", "parameter 1 is not of type 'Document'.")))); return; } } v8SetReturnValue(info, TestPartialInterfaceImplementation3::promiseMethodPartialOverload(*impl, document).v8Value());}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:13,
示例11: v8SetReturnValuevoid V8InjectedScriptHost::subtypeCallback(const v8::FunctionCallbackInfo<v8::Value>& info){ if (info.Length() < 1) return; v8::Isolate* isolate = info.GetIsolate(); v8::Local<v8::Value> value = info[0]; if (value->IsArray() || value->IsTypedArray() || value->IsArgumentsObject()) { v8SetReturnValue(info, v8AtomicString(isolate, "array")); return; } if (value->IsDate()) { v8SetReturnValue(info, v8AtomicString(isolate, "date")); return; } if (value->IsRegExp()) { v8SetReturnValue(info, v8AtomicString(isolate, "regexp")); return; } if (value->IsMap() || value->IsWeakMap()) { v8SetReturnValue(info, v8AtomicString(isolate, "map")); return; } if (value->IsSet() || value->IsWeakSet()) { v8SetReturnValue(info, v8AtomicString(isolate, "set")); return; } if (value->IsMapIterator() || value->IsSetIterator()) { v8SetReturnValue(info, v8AtomicString(isolate, "iterator")); return; } if (value->IsGeneratorObject()) { v8SetReturnValue(info, v8AtomicString(isolate, "generator")); return; } if (V8Node::hasInstance(value, isolate)) { v8SetReturnValue(info, v8AtomicString(isolate, "node")); return; } if (V8NodeList::hasInstance(value, isolate) || V8DOMTokenList::hasInstance(value, isolate) || V8HTMLCollection::hasInstance(value, isolate) || V8HTMLAllCollection::hasInstance(value, isolate)) { v8SetReturnValue(info, v8AtomicString(isolate, "array")); return; } if (value->IsNativeError() || V8DOMException::hasInstance(value, isolate)) { v8SetReturnValue(info, v8AtomicString(isolate, "error")); return; }}
开发者ID:golden628,项目名称:ChromiumGStreamerBackend,代码行数:51,
示例12: v8SetReturnValuevoid V8MessageEvent::dataAttributeGetterCustom( const v8::FunctionCallbackInfo<v8::Value>& info) { ScriptState* scriptState = ScriptState::current(info.GetIsolate()); auto privateCachedData = V8PrivateProperty::getMessageEventCachedData(info.GetIsolate()); v8::Local<v8::Value> cachedData = privateCachedData.get(scriptState->context(), info.Holder()); if (!cachedData.IsEmpty()) { v8SetReturnValue(info, cachedData); return; } MessageEvent* event = V8MessageEvent::toImpl(info.Holder()); v8::Local<v8::Value> result; switch (event->getDataType()) { case MessageEvent::DataTypeScriptValue: result = event->dataAsScriptValue().v8ValueFor(scriptState); if (result.IsEmpty()) result = v8::Null(info.GetIsolate()); break; case MessageEvent::DataTypeSerializedScriptValue: if (SerializedScriptValue* serializedValue = event->dataAsSerializedScriptValue()) { MessagePortArray ports = event->ports(); result = serializedValue->deserialize(info.GetIsolate(), &ports); } else { result = v8::Null(info.GetIsolate()); } break; case MessageEvent::DataTypeString: result = v8String(info.GetIsolate(), event->dataAsString()); break; case MessageEvent::DataTypeBlob: result = toV8(event->dataAsBlob(), info.Holder(), info.GetIsolate()); break; case MessageEvent::DataTypeArrayBuffer: result = toV8(event->dataAsArrayBuffer(), info.Holder(), info.GetIsolate()); break; } // Store the result as a private value so this callback returns the cached // result in future invocations. privateCachedData.set(scriptState->context(), info.Holder(), result); v8SetReturnValue(info, result);}
开发者ID:mirror,项目名称:chromium,代码行数:51,
示例13: V8TestInterfaceConstructorConstructorCallbackstatic void V8TestInterfaceConstructorConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info){ if (!info.IsConstructCall()) { V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("Audio")); return; } if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) { v8SetReturnValue(info, info.Holder()); return; } ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { setMinimumArityTypeError(exceptionState, 1, info.Length()); exceptionState.throwIfNeeded(); return; } V8StringResource<> arg; V8StringResource<> optArg; { TOSTRING_VOID_INTERNAL(arg, info[0]); if (UNLIKELY(info.Length() <= 1)) { ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::createForJSConstructor(scriptState, executionContext, document, arg, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } v8::Local<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructorConstructor::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper); return; } TOSTRING_VOID_INTERNAL(optArg, info[1]); } ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::createForJSConstructor(scriptState, executionContext, document, arg, optArg, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } v8::Local<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructorConstructor::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper);}
开发者ID:eth-srl,项目名称:BlinkER,代码行数:49,
示例14: constructorstatic 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,
示例15: v8SetReturnValuevoid V8HTMLAllCollection::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>& info){ if (info.Length() < 1) return; HTMLAllCollection* impl = V8HTMLAllCollection::toImpl(info.Holder()); Node& ownerNode = impl->ownerNode(); UseCounter::countIfNotPrivateScript(info.GetIsolate(), ownerNode.document(), UseCounter::DocumentAllLegacyCall); if (info.Length() == 1) { v8SetReturnValue(info, getItem(impl, info[0], info)); return; } // If there is a second argument it is the index of the item we want. TOSTRING_VOID(V8StringResource<>, name, info[0]); v8::Local<v8::Uint32> index; if (!info[1]->ToArrayIndex(info.GetIsolate()->GetCurrentContext()).ToLocal(&index)) return; if (Node* node = impl->namedItemWithIndex(name, index->Value())) { v8SetReturnValueFast(info, node, impl); return; }}
开发者ID:howardroark2018,项目名称:chromium,代码行数:26,
示例16: constructorstatic void constructor(const v8::FunctionCallbackInfo<v8::Value>& info){ TestNode* impl = TestNode::create(); v8::Local<v8::Object> wrapper = info.Holder(); wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestNode::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper);}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,
示例17: functionDisplayNamevoid V8InjectedScriptHost::functionDetailsCallback(const v8::FunctionCallbackInfo<v8::Value>& info){ if (info.Length() < 1 || !info[0]->IsFunction()) return; v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(info[0]); int lineNumber = function->GetScriptLineNumber(); int columnNumber = function->GetScriptColumnNumber(); v8::Isolate* isolate = info.GetIsolate(); v8::Local<v8::Object> location = v8::Object::New(isolate); location->Set(v8AtomicString(isolate, "lineNumber"), v8::Integer::New(isolate, lineNumber)); location->Set(v8AtomicString(isolate, "columnNumber"), v8::Integer::New(isolate, columnNumber)); location->Set(v8AtomicString(isolate, "scriptId"), v8::Integer::New(isolate, function->ScriptId())->ToString(isolate)); v8::Local<v8::Object> result = v8::Object::New(isolate); result->Set(v8AtomicString(isolate, "location"), location); v8::Local<v8::String> name = functionDisplayName(function); result->Set(v8AtomicString(isolate, "functionName"), name.IsEmpty() ? v8AtomicString(isolate, "") : name); result->Set(v8AtomicString(isolate, "isGenerator"), v8::Boolean::New(isolate, function->IsGeneratorFunction())); InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->GetCurrentContext(), info.Holder()); V8DebuggerImpl& debugger = static_cast<V8DebuggerImpl&>(host->debugger()); v8::MaybeLocal<v8::Value> scopes = debugger.functionScopes(function); if (!scopes.IsEmpty() && scopes.ToLocalChecked()->IsArray()) result->Set(v8AtomicString(isolate, "rawScopes"), scopes.ToLocalChecked()); v8SetReturnValue(info, result);}
开发者ID:golden628,项目名称:ChromiumGStreamerBackend,代码行数:31,
示例18: exceptionStatevoid V8Crypto::getRandomValuesMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info){ ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRandomValues", "Crypto", info.Holder(), info.GetIsolate()); if (info.Length() < 1) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); exceptionState.throwIfNeeded(); return; } v8::Handle<v8::Value> buffer = info[0]; if (!V8ArrayBufferView::hasInstance(buffer, info.GetIsolate())) { exceptionState.throwTypeError("First argument is not an ArrayBufferView"); } else { ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(buffer)); ASSERT(arrayBufferView); Crypto* crypto = V8Crypto::toNative(info.Holder()); crypto->getRandomValues(arrayBufferView, exceptionState); } if (exceptionState.throwIfNeeded()) return; v8SetReturnValue(info, buffer);}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:25,
示例19: npObjectPropertyEnumeratorvoid 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,
示例20: eventHandlerAttributeAttributeGetterstatic void eventHandlerAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info){ v8::Local<v8::Object> holder = info.Holder(); TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder); EventListener* cppValue(impl->eventHandlerAttribute()); v8SetReturnValue(info, cppValue ? v8::Local<v8::Value>(V8AbstractEventListener::cast(cppValue)->getListenerObject(impl->executionContext())) : v8::Local<v8::Value>(v8::Null(info.GetIsolate())));}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:7,
示例21: ASSERTvoid V8HTMLAllCollection::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>& info){ if (info.Length() < 1) return; HTMLAllCollection* imp = V8HTMLAllCollection::toNative(info.Holder()); Node* ownerNode = imp->ownerNode(); ASSERT(ownerNode); UseCounter::count(ownerNode->document(), UseCounter::DocumentAllLegacyCall); if (info.Length() == 1) { v8SetReturnValue(info, getItem(imp, info[0], info)); return; } // If there is a second argument it is the index of the item we want. V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); v8::Local<v8::Uint32> index = info[1]->ToArrayIndex(); if (index.IsEmpty()) return; if (Node* node = imp->namedItemWithIndex(name, index->Uint32Value())) { v8SetReturnValueFast(info, node, imp); return; }}
开发者ID:wangshijun,项目名称:Blink,代码行数:27,
示例22: getJSListenerFunctionsvoid V8InjectedScriptHost::getEventListenersMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info){ if (info.Length() < 1) return; v8::Local<v8::Value> value = info[0]; if (!V8Node::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate()))) return; Node* node = V8Node::toNative(value->ToObject()); if (!node) return; InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); Vector<EventListenerInfo> listenersArray; host->getEventListenersImpl(node, listenersArray); v8::Local<v8::Object> result = v8::Object::New(); for (size_t i = 0; i < listenersArray.size(); ++i) { v8::Handle<v8::Array> listeners = getJSListenerFunctions(&node->document(), listenersArray[i]); if (!listeners->Length()) continue; AtomicString eventType = listenersArray[i].eventType; result->Set(v8String(eventType, info.GetIsolate()), listeners); } v8SetReturnValue(info, result);}
开发者ID:chunywang,项目名称:blink-crosswalk,代码行数:27,
示例23: constructorstatic void constructor(const v8::FunctionCallbackInfo<v8::Value>& info){ RefPtrWillBeRawPtr<TestNode> impl = TestNode::create(); v8::Handle<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(&V8TestNode::wrapperTypeInfo, wrapper, info.GetIsolate()); v8SetReturnValue(info, wrapper);}
开发者ID:335969568,项目名称:Blink-1,代码行数:7,
示例24: setExceptionAsReturnValuestatic void setExceptionAsReturnValue(const v8::FunctionCallbackInfo<v8::Value>& info, v8::Local<v8::Object> returnValue, v8::TryCatch& tryCatch){ v8::Isolate* isolate = info.GetIsolate(); returnValue->Set(v8::String::NewFromUtf8(isolate, "result"), tryCatch.Exception()); returnValue->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), JavaScriptCallFrame::createExceptionDetails(isolate, tryCatch.Message())); v8SetReturnValue(info, returnValue);}
开发者ID:golden628,项目名称:ChromiumGStreamerBackend,代码行数:7,
示例25: toLocalDOMWindowvoid V8Window::eventAttributeGetterCustom( const v8::PropertyCallbackInfo<v8::Value>& info) { LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); ExceptionState exceptionState(ExceptionState::GetterContext, "event", "Window", info.Holder(), info.GetIsolate()); if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), impl, exceptionState)) { return; } LocalFrame* frame = impl->frame(); ASSERT(frame); // This is a fast path to retrieve info.Holder()->CreationContext(). v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current(info.GetIsolate())); if (context.IsEmpty()) return; v8::Local<v8::Value> jsEvent = V8HiddenValue::getHiddenValue( ScriptState::current(info.GetIsolate()), context->Global(), V8HiddenValue::event(info.GetIsolate())); if (jsEvent.IsEmpty()) return; v8SetReturnValue(info, jsEvent);}
开发者ID:mirror,项目名称:chromium,代码行数:25,
示例26: staticPromiseMethodPartialOverload2Methodstatic void staticPromiseMethodPartialOverload2Method(const v8::FunctionCallbackInfo<v8::Value>& info){ ExceptionState exceptionState(ExceptionState::ExecutionContext, "staticPromiseMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate()); staticPromiseMethodPartialOverload2MethodPromise(info, exceptionState); if (exceptionState.hadException()) v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.GetIsolate())).v8Value());}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:7,
注:本文中的v8SetReturnValue函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ v8String函数代码示例 C++ v8Boolean函数代码示例 |