您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ v8AtomicString函数代码示例

51自学网 2021-06-03 09:30:24
  C++
这篇教程C++ v8AtomicString函数代码示例写得很实用,希望能帮到您。

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

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

示例1: TRACE_EVENT_SCOPED_SAMPLING_STATE

v8::Local<v8::FunctionTemplate> V8TestInterfaceNamedConstructor2Constructor::domTemplate(v8::Isolate* isolate){    static int domTemplateKey; // This address is used for a key to look up the dom template.    V8PerIsolateData* data = V8PerIsolateData::from(isolate);    v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTemplateKey);    if (!result.IsEmpty())        return result;    TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate");    result = v8::FunctionTemplate::New(isolate, V8TestInterfaceNamedConstructor2ConstructorCallback);    v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();    instanceTemplate->SetInternalFieldCount(V8TestInterfaceNamedConstructor2::internalFieldCount);    result->SetClassName(v8AtomicString(isolate, "TestInterfaceNamedConstructor2"));    result->Inherit(V8TestInterfaceNamedConstructor2::domTemplate(isolate));    data->setDOMTemplate(&domTemplateKey, result);    return result;}
开发者ID:joone,项目名称:blink-crosswalk,代码行数:17,


示例2: installV8TestInterfaceNamedConstructor2Template

static void installV8TestInterfaceNamedConstructor2Template(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate){    functionTemplate->ReadOnlyPrototype();    v8::Local<v8::Signature> defaultSignature;    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterfaceNamedConstructor2", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceNamedConstructor2::internalFieldCount,        0, 0,        0, 0,        0, 0);    v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();    ALLOW_UNUSED_LOCAL(instanceTemplate);    v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();    ALLOW_UNUSED_LOCAL(prototypeTemplate);    // Custom toString template    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:17,


示例3: configureV8TestInterface3Template

static void configureV8TestInterface3Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate){    functionTemplate->ReadOnlyPrototype();    v8::Local<v8::Signature> defaultSignature;    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterface3", v8::Local<v8::FunctionTemplate>(), V8TestInterface3::internalFieldCount,        0, 0,        0, 0,        0, 0,        isolate);    v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();    v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();    functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterface3V8Internal::indexedPropertyGetterCallback, TestInterface3V8Internal::indexedPropertySetterCallback, 0, TestInterface3V8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterface3>);    functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterface3V8Internal::namedPropertyGetterCallback, TestInterface3V8Internal::namedPropertySetterCallback, TestInterface3V8Internal::namedPropertyQueryCallback, TestInterface3V8Internal::namedPropertyDeleterCallback, TestInterface3V8Internal::namedPropertyEnumeratorCallback);    // Custom toString template    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_chromium_org,代码行数:18,


示例4: configureV8TestTypedefsTemplate

static void configureV8TestTypedefsTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate){    functionTemplate->ReadOnlyPrototype();    v8::Local<v8::Signature> defaultSignature;    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestTypedefs", v8::Local<v8::FunctionTemplate>(), V8TestTypedefs::internalFieldCount,        V8TestTypedefsAttributes, WTF_ARRAY_LENGTH(V8TestTypedefsAttributes),        0, 0,        V8TestTypedefsMethods, WTF_ARRAY_LENGTH(V8TestTypedefsMethods),        isolate);    functionTemplate->SetCallHandler(V8TestTypedefs::constructorCallback);    functionTemplate->SetLength(1);    v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();    v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();    // Custom toString template    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_chromium_org,代码行数:18,


示例5: configureV8TestInterfaceConstructor3Template

static void configureV8TestInterfaceConstructor3Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate){    functionTemplate->ReadOnlyPrototype();    v8::Local<v8::Signature> defaultSignature;    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceConstructor3", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceConstructor3::internalFieldCount,        0, 0,        0, 0,        0, 0,        isolate);    functionTemplate->SetCallHandler(V8TestInterfaceConstructor3::constructorCallback);    functionTemplate->SetLength(1);    v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate();    v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate();    // Custom toString template    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());}
开发者ID:jeremyroman,项目名称:blink,代码行数:18,


示例6: configureV8TestSpecialOperationsCustomTemplate

static void configureV8TestSpecialOperationsCustomTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType){    functionTemplate->ReadOnlyPrototype();    v8::Local<v8::Signature> defaultSignature;    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestSpecialOperationsCustom", v8::Local<v8::FunctionTemplate>(), V8TestSpecialOperationsCustom::internalFieldCount,        0, 0,        0, 0,        0, 0,        isolate, currentWorldType);    v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate();    v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate();    functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialOperationsCustomV8Internal::indexedPropertyGetterCallback, TestSpecialOperationsCustomV8Internal::indexedPropertySetterCallback, 0, TestSpecialOperationsCustomV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestSpecialOperationsCustom>);    functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOperationsCustomV8Internal::namedPropertyGetterCallback, TestSpecialOperationsCustomV8Internal::namedPropertySetterCallback, TestSpecialOperationsCustomV8Internal::namedPropertyQueryCallback, TestSpecialOperationsCustomV8Internal::namedPropertyDeleterCallback, TestSpecialOperationsCustomV8Internal::namedPropertyEnumeratorCallback);    // Custom toString template    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::current()->toStringTemplate());}
开发者ID:kublaj,项目名称:blink,代码行数:18,


示例7: installV8SVGTestInterfaceTemplate

static void installV8SVGTestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate){    functionTemplate->ReadOnlyPrototype();    v8::Local<v8::Signature> defaultSignature;    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "SVGTestInterface", v8::Local<v8::FunctionTemplate>(), V8SVGTestInterface::internalFieldCount,        V8SVGTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8SVGTestInterfaceAttributes),        0, 0,        0, 0,        isolate);    v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();    ALLOW_UNUSED_LOCAL(instanceTemplate);    v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();    ALLOW_UNUSED_LOCAL(prototypeTemplate);    // Custom toString template    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());}
开发者ID:335969568,项目名称:Blink-1,代码行数:18,


示例8: m_wrapperBoilerplates

V8PerContextData::V8PerContextData(v8::Handle<v8::Context> context)    : m_wrapperBoilerplates(context->GetIsolate())    , m_constructorMap(context->GetIsolate())    , m_isolate(context->GetIsolate())    , m_contextHolder(adoptPtr(new gin::ContextHolder(context->GetIsolate())))    , m_context(m_isolate, context)    , m_customElementBindings(adoptPtr(new CustomElementBindingMap())){    m_contextHolder->SetContext(context);    v8::Context::Scope contextScope(context);    ASSERT(m_errorPrototype.isEmpty());    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(v8AtomicString(m_isolate, "Error")));    ASSERT(!object.IsEmpty());    v8::Handle<v8::Value> prototypeValue = object->Get(v8AtomicString(m_isolate, "prototype"));    ASSERT(!prototypeValue.IsEmpty());    m_errorPrototype.set(m_isolate, prototypeValue);}
开发者ID:coinpayee,项目名称:blink,代码行数:18,


示例9: scope

void CryptoResultImpl::completeWithJson(const char* utf8Data, unsigned length){    if (!m_resolver)        return;    ScriptState* scriptState = m_resolver->getScriptState();    ScriptState::Scope scope(scriptState);    v8::Local<v8::String> jsonString = v8AtomicString(scriptState->isolate(), utf8Data, length);    v8::TryCatch exceptionCatcher(scriptState->isolate());    v8::Local<v8::Value> jsonDictionary;    if (v8Call(v8::JSON::Parse(scriptState->isolate(), jsonString), jsonDictionary, exceptionCatcher))        m_resolver->resolve(jsonDictionary);    else        m_resolver->reject(exceptionCatcher.Exception());    clearResolver();}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:18,


示例10: m_isolate

V8PerContextData::V8PerContextData(v8::Handle<v8::Context> context)    : m_isolate(context->GetIsolate())    , m_wrapperBoilerplates(m_isolate)    , m_constructorMap(m_isolate)    , m_contextHolder(adoptPtr(new gin::ContextHolder(m_isolate)))    , m_context(m_isolate, context)    , m_activityLogger(0)    , m_compiledPrivateScript(m_isolate){    m_contextHolder->SetContext(context);    v8::Context::Scope contextScope(context);    ASSERT(m_errorPrototype.isEmpty());    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(v8AtomicString(m_isolate, "Error")));    ASSERT(!object.IsEmpty());    v8::Handle<v8::Value> prototypeValue = object->Get(v8AtomicString(m_isolate, "prototype"));    ASSERT(!prototypeValue.IsEmpty());    m_errorPrototype.set(m_isolate, prototypeValue);}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:19,


示例11: installV8TestNodeTemplate

static void installV8TestNodeTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate){    functionTemplate->ReadOnlyPrototype();    v8::Local<v8::Signature> defaultSignature;    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestNode", V8Node::domTemplate(isolate), V8TestNode::internalFieldCount,        0, 0,        V8TestNodeAccessors, WTF_ARRAY_LENGTH(V8TestNodeAccessors),        0, 0);    functionTemplate->SetCallHandler(V8TestNode::constructorCallback);    functionTemplate->SetLength(0);    v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();    ALLOW_UNUSED_LOCAL(instanceTemplate);    v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();    ALLOW_UNUSED_LOCAL(prototypeTemplate);    // Custom toString template    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:19,


示例12: constructorOfToString

static void constructorOfToString(const v8::FunctionCallbackInfo<v8::Value>& info){    // The DOM constructors' toString functions grab the current toString    // for Functions by taking the toString function of itself and then    // calling it with the constructor as its receiver. This means that    // changes to the Function prototype chain or toString function are    // reflected when printing DOM constructors. The only wart is that    // changes to a DOM constructor's toString's toString will cause the    // toString of the DOM constructor itself to change. This is extremely    // obscure and unlikely to be a problem.    v8::Handle<v8::Value> value = info.Callee()->Get(v8AtomicString(info.GetIsolate(), "toString"));    if (!value->IsFunction()) {        v8SetReturnValue(info, v8::String::Empty(info.GetIsolate()));        return;    }    v8::Local<v8::Value> result;    if (V8ScriptRunner::callInternalFunction(v8::Handle<v8::Function>::Cast(value), info.This(), 0, 0, info.GetIsolate()).ToLocal(&result))        v8SetReturnValue(info, result);}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:19,


示例13: installV8TestInterfaceWillBeGarbageCollectedTemplate

static void installV8TestInterfaceWillBeGarbageCollectedTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate){    functionTemplate->ReadOnlyPrototype();    v8::Local<v8::Signature> defaultSignature;    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterfaceWillBeGarbageCollected", V8EventTarget::domTemplate(isolate), V8TestInterfaceWillBeGarbageCollected::internalFieldCount,        V8TestInterfaceWillBeGarbageCollectedAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceWillBeGarbageCollectedAttributes),        0, 0,        V8TestInterfaceWillBeGarbageCollectedMethods, WTF_ARRAY_LENGTH(V8TestInterfaceWillBeGarbageCollectedMethods));    functionTemplate->SetCallHandler(V8TestInterfaceWillBeGarbageCollected::constructorCallback);    functionTemplate->SetLength(1);    v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();    ALLOW_UNUSED_LOCAL(instanceTemplate);    v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();    ALLOW_UNUSED_LOCAL(prototypeTemplate);    // Custom toString template    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());}
开发者ID:eth-srl,项目名称:BlinkER,代码行数:19,


示例14: ASSERT

short V8NodeFilterCondition::acceptNode(Node* node, ExceptionState& exceptionState) const{    v8::Isolate* isolate = m_scriptState->isolate();    ASSERT(!m_scriptState->context().IsEmpty());    v8::HandleScope handleScope(isolate);    v8::Local<v8::Value> filter = m_filter.newLocal(isolate);    ASSERT(filter.IsEmpty() || filter->IsObject());    if (filter.IsEmpty())        return NodeFilter::FILTER_ACCEPT;    v8::TryCatch exceptionCatcher;    v8::Local<v8::Function> callback;    v8::Local<v8::Value> receiver;    if (filter->IsFunction()) {        callback = v8::Local<v8::Function>::Cast(filter);        receiver = v8::Undefined(isolate);    } else {        v8::Local<v8::Value> value = filter->ToObject(isolate)->Get(v8AtomicString(isolate, "acceptNode"));        if (value.IsEmpty() || !value->IsFunction()) {            exceptionState.throwTypeError("NodeFilter object does not have an acceptNode function");            return NodeFilter::FILTER_REJECT;        }        callback = v8::Local<v8::Function>::Cast(value);        receiver = filter;    }    OwnPtr<v8::Local<v8::Value>[]> info = adoptArrayPtr(new v8::Local<v8::Value>[1]);    info[0] = toV8(node, m_scriptState->context()->Global(), isolate);    v8::Local<v8::Value> result = ScriptController::callFunction(m_scriptState->executionContext(), callback, receiver, 1, info.get(), isolate);    if (exceptionCatcher.HasCaught()) {        exceptionState.rethrowV8Exception(exceptionCatcher.Exception());        return NodeFilter::FILTER_REJECT;    }    ASSERT(!result.IsEmpty());    return result->Int32Value();}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:42,


示例15: toV8

v8::Local<v8::Object> ImageData::associateWithWrapper(    v8::Isolate* isolate,    const WrapperTypeInfo* wrapperType,    v8::Local<v8::Object> wrapper) {  wrapper =      ScriptWrappable::associateWithWrapper(isolate, wrapperType, wrapper);  if (!wrapper.IsEmpty() && m_data.get()) {    // Create a V8 Uint8ClampedArray object and set the "data" property    // of the ImageData object to the created v8 object, eliminating the    // C++ callback when accessing the "data" property.    v8::Local<v8::Value> pixelArray = toV8(m_data.get(), wrapper, isolate);    if (pixelArray.IsEmpty() ||        !v8CallBoolean(wrapper->DefineOwnProperty(            isolate->GetCurrentContext(), v8AtomicString(isolate, "data"),            pixelArray, v8::ReadOnly)))      return v8::Local<v8::Object>();  }  return wrapper;}
开发者ID:mirror,项目名称:chromium,代码行数:20,


示例16: ASSERT

v8::Local<v8::Function> V8PerContextData::constructorForTypeSlowCase(const WrapperTypeInfo* type){    ASSERT(!m_errorPrototype.isEmpty());    v8::Local<v8::Context> currentContext = context();    v8::Context::Scope scope(currentContext);    const DOMWrapperWorld& world = DOMWrapperWorld::world(currentContext);    // We shouldn't reach this point for the types that are implemented in v8 such as typed arrays and    // hence don't have domTemplateFunction.    ASSERT(type->domTemplateFunction);    v8::Local<v8::FunctionTemplate> interfaceTemplate = type->domTemplate(m_isolate, world);    // Getting the function might fail if we're running out of stack or memory.    v8::Local<v8::Function> interfaceObject;    if (!interfaceTemplate->GetFunction(currentContext).ToLocal(&interfaceObject))        return v8::Local<v8::Function>();    if (type->parentClass) {        v8::Local<v8::Object> prototypeTemplate = constructorForType(type->parentClass);        if (prototypeTemplate.IsEmpty())            return v8::Local<v8::Function>();        if (!v8CallBoolean(interfaceObject->SetPrototype(currentContext, prototypeTemplate)))            return v8::Local<v8::Function>();    }    v8::Local<v8::Value> prototypeValue;    if (!interfaceObject->Get(currentContext, v8AtomicString(m_isolate, "prototype")).ToLocal(&prototypeValue) || !prototypeValue->IsObject())        return v8::Local<v8::Function>();    v8::Local<v8::Object> prototypeObject = prototypeValue.As<v8::Object>();    if (prototypeObject->InternalFieldCount() == v8PrototypeInternalFieldcount        && type->wrapperTypePrototype == WrapperTypeInfo::WrapperTypeObjectPrototype)        prototypeObject->SetAlignedPointerInInternalField(v8PrototypeTypeIndex, const_cast<WrapperTypeInfo*>(type));    type->preparePrototypeAndInterfaceObject(currentContext, world, prototypeObject, interfaceObject, interfaceTemplate);    if (type->wrapperTypePrototype == WrapperTypeInfo::WrapperTypeExceptionPrototype) {        if (!v8CallBoolean(prototypeObject->SetPrototype(currentContext, m_errorPrototype.newLocal(m_isolate))))            return v8::Local<v8::Function>();    }    m_constructorMap.Set(type, interfaceObject);    return interfaceObject;}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:41,


示例17: configureV8TestInterfaceDoNotCheckConstantsTemplate

static void configureV8TestInterfaceDoNotCheckConstantsTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType){    functionTemplate->ReadOnlyPrototype();    v8::Local<v8::Signature> defaultSignature;    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceDoNotCheckConstants", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceDoNotCheckConstants::internalFieldCount,        0, 0,        0, 0,        0, 0,        isolate, currentWorldType);    v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate();    v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate();    static const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceDoNotCheckConstantsConstants[] = {        {"CONST_VALUE_0", 0},        {"CONST_JAVASCRIPT", 1},    };    V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8TestInterfaceDoNotCheckConstantsConstants, WTF_ARRAY_LENGTH(V8TestInterfaceDoNotCheckConstantsConstants), isolate);    // Custom toString template    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::current()->toStringTemplate());}
开发者ID:kublaj,项目名称:blink,代码行数:21,


示例18: getListenerObject

v8::Local<v8::Function> V8EventListener::getListenerFunction(ExecutionContext*){    v8::Local<v8::Object> listener = getListenerObject(scriptState()->executionContext());    // Has the listener been disposed?    if (listener.IsEmpty())        return v8::Local<v8::Function>();    if (listener->IsFunction())        return v8::Local<v8::Function>::Cast(listener);    if (listener->IsObject()) {        v8::Local<v8::Value> property = listener->Get(v8AtomicString(isolate(), "handleEvent"));        // Check that no exceptions were thrown when getting the        // handleEvent property and that the value is a function.        if (!property.IsEmpty() && property->IsFunction())            return v8::Local<v8::Function>::Cast(property);    }    return v8::Local<v8::Function>();}
开发者ID:davemichael,项目名称:mojo,代码行数:21,


示例19: getListenerObject

v8::Local<v8::Function> V8EventListener::getListenerFunction(    ScriptState* scriptState) {    v8::Local<v8::Object> listener =        getListenerObject(scriptState->getExecutionContext());    // Has the listener been disposed?    if (listener.IsEmpty())        return v8::Local<v8::Function>();    if (listener->IsFunction())        return v8::Local<v8::Function>::Cast(listener);    // The EventHandler callback function type (used for event handler    // attributes in HTML) has [TreatNonObjectAsNull], which implies that    // non-function objects should be treated as no-op functions that return    // undefined.    if (isAttribute())        return v8::Local<v8::Function>();    // Getting the handleEvent property can runs script in the getter.    if (ScriptForbiddenScope::isScriptForbidden()) {        V8ThrowException::throwError(isolate(), "Script execution is forbidden.");        return v8::Local<v8::Function>();    }    if (listener->IsObject()) {        // Check that no exceptions were thrown when getting the        // handleEvent property and that the value is a function.        v8::Local<v8::Value> property;        if (listener                ->Get(scriptState->context(),                      v8AtomicString(isolate(), "handleEvent"))                .ToLocal(&property) &&                property->IsFunction())            return v8::Local<v8::Function>::Cast(property);    }    return v8::Local<v8::Function>();}
开发者ID:mirror,项目名称:chromium,代码行数:39,


示例20: toV8Context

void V8HTMLDocument::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info){    HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder());    if (info.Length() > 2) {        if (RefPtr<LocalFrame> frame = htmlDocument->frame()) {            // Fetch the global object for the frame.            v8::Local<v8::Context> context = toV8Context(info.GetIsolate(), frame.get(), DOMWrapperWorld::current(info.GetIsolate()));            // Bail out if we cannot get the context.            if (context.IsEmpty())                return;            v8::Local<v8::Object> global = context->Global();            // Get the open property of the global object.            v8::Local<v8::Value> function = global->Get(v8AtomicString(info.GetIsolate(), "open"));            // Failed; return without throwing (new) exception.            if (function.IsEmpty())                return;            // If the open property is not a function throw a type error.            if (!function->IsFunction()) {                throwTypeError("open is not a function", info.GetIsolate());                return;            }            // Wrap up the arguments and call the function.            OwnPtr<v8::Local<v8::Value>[]> params = adoptArrayPtr(new v8::Local<v8::Value>[info.Length()]);            for (int i = 0; i < info.Length(); i++)                params[i] = info[i];            v8SetReturnValue(info, frame->script().callFunction(v8::Local<v8::Function>::Cast(function), global, info.Length(), params.get()));            return;        }    }    ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Document", info.Holder(), info.GetIsolate());    htmlDocument->open(callingDOMWindow(info.GetIsolate())->document(), exceptionState);    if (exceptionState.throwIfNeeded())        return;    v8SetReturnValue(info, info.Holder());}
开发者ID:ericwilligers,项目名称:blink,代码行数:39,


示例21: getListenerObject

v8::Local<v8::Function> V8EventListener::getListenerFunction(ScriptState* scriptState){    v8::Local<v8::Object> listener = getListenerObject(scriptState->executionContext());    // Has the listener been disposed?    if (listener.IsEmpty())        return v8::Local<v8::Function>();    if (listener->IsFunction())        return v8::Local<v8::Function>::Cast(listener);    if (listener->IsObject()) {        ASSERT_WITH_MESSAGE(!isAttribute(), "EventHandler attributes should only accept JS Functions as input.");        v8::Local<v8::Value> property = listener->Get(v8AtomicString(isolate(), "handleEvent"));        // Check that no exceptions were thrown when getting the        // handleEvent property and that the value is a function.        if (!property.IsEmpty() && property->IsFunction())            return v8::Local<v8::Function>::Cast(property);    }    return v8::Local<v8::Function>();}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:22,


示例22: requestState

ScriptPromise PushRegistrationManager::hasPermissionPush(ExecutionContext* executionContext){    ScriptPromise promise = ScriptPromise::createPending(executionContext);    RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(promise, executionContext);    if (m_pushPermission != PushPermission::Default) {        DOMRequestState requestState(executionContext);        v8::Isolate* isolate = requestState.isolate();        PushPermission::PermissionType permission =                (permission == PushPermission::InProgress) ? PushPermission::Default : m_pushPermission;        resolver->resolve(ScriptValue(v8AtomicString(isolate, PushPermission::permissionString(m_pushPermission).utf8().data()), isolate));        return promise;    }    m_pushController->client()->hasPermissionPush(            blink::WebSecurityOrigin(executionContext->securityOrigin()),            new CallbackPromiseAdapterContext<PushPermission, PushError>(resolver, executionContext));    return promise;}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:22,


示例23: handleScope

bool WorkerScriptController::initializeContextIfNeeded(){    v8::HandleScope handleScope(m_isolate);    if (isContextInitialized())        return true;    v8::Handle<v8::Context> context = v8::Context::New(m_isolate);    if (context.IsEmpty())        return false;    m_scriptState = ScriptState::create(context, m_world);    ScriptState::Scope scope(m_scriptState.get());    // Set DebugId for the new context.    context->SetEmbedderData(0, v8AtomicString(m_isolate, "worker"));    // Create a new JS object and use it as the prototype for the shadow global object.    const WrapperTypeInfo* contextType = &V8DedicatedWorkerGlobalScope::wrapperTypeInfo;    if (m_workerGlobalScope.isServiceWorkerGlobalScope())        contextType = &V8ServiceWorkerGlobalScope::wrapperTypeInfo;    else if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope())        contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo;    v8::Handle<v8::Function> workerGlobalScopeConstructor = m_scriptState->perContextData()->constructorForType(contextType);    v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance(m_isolate, workerGlobalScopeConstructor);    if (jsWorkerGlobalScope.IsEmpty()) {        m_scriptState->disposePerContextData();        return false;    }    V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtrWillBeRawPtr<WorkerGlobalScope>(&m_workerGlobalScope), contextType, jsWorkerGlobalScope, m_isolate, WrapperConfiguration::Dependent);    // Insert the object instance as the prototype of the shadow object.    v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_scriptState->context()->Global()->GetPrototype());    globalObject->SetPrototype(jsWorkerGlobalScope);    return true;}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:39,


示例24: toLocalFrame

void WindowProxy::setSecurityToken(SecurityOrigin* origin){    // If two tokens are equal, then the SecurityOrigins canAccess each other.    // If two tokens are not equal, then we have to call canAccess.    // Note: we can't use the HTTPOrigin if it was set from the DOM.    String token;    // There are several situations where v8 needs to do a full canAccess check,    // so set an empty security token instead:    // - document.domain was modified    // - the frame is showing the initial empty document    // - the frame is remote    bool delaySet = m_world->isMainWorld()        && (m_frame->isRemoteFrame()            || origin->domainWasSetInDOM()            || toLocalFrame(m_frame)->loader().stateMachine()->isDisplayingInitialEmptyDocument());    if (origin && !delaySet)        token = origin->toString();    // An empty or "null" token means we always have to call    // canAccess. The toString method on securityOrigins returns the    // string "null" for empty security origins and for security    // origins that should only allow access to themselves. In this    // case, we use the global object as the security token to avoid    // calling canAccess when a script accesses its own objects.    v8::HandleScope handleScope(m_isolate);    v8::Local<v8::Context> context = m_scriptState->context();    if (token.isEmpty() || token == "null") {        context->UseDefaultSecurityToken();        return;    }    if (m_world->isPrivateScriptIsolatedWorld())        token = "private-script://" + token;    CString utf8Token = token.utf8();    // NOTE: V8 does identity comparison in fast path, must use a symbol    // as the security token.    context->SetSecurityToken(v8AtomicString(m_isolate, utf8Token.data(), utf8Token.length()));}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:39,


示例25: ASSERT

short V8NodeFilterCondition::acceptNode(ScriptState* state, Node* node) const{    v8::Isolate* isolate = state->isolate();    ASSERT(isolate->InContext());    v8::HandleScope handleScope(isolate);    v8::Handle<v8::Value> filter = m_filter.newLocal(isolate);    ASSERT(!filter.IsEmpty());    if (!filter->IsObject())        return NodeFilter::FILTER_ACCEPT;    v8::TryCatch exceptionCatcher;    v8::Handle<v8::Function> callback;    if (filter->IsFunction())        callback = v8::Handle<v8::Function>::Cast(filter);    else {        v8::Local<v8::Value> value = filter->ToObject()->Get(v8AtomicString(isolate, "acceptNode"));        if (!value->IsFunction()) {            throwTypeError("NodeFilter object does not have an acceptNode function", state->isolate());            return NodeFilter::FILTER_REJECT;        }        callback = v8::Handle<v8::Function>::Cast(value);    }    OwnPtr<v8::Handle<v8::Value>[]> info = adoptArrayPtr(new v8::Handle<v8::Value>[1]);    info[0] = toV8(node, v8::Handle<v8::Object>(), state->isolate());    v8::Handle<v8::Object> object = isolate->GetCurrentContext()->Global();    v8::Handle<v8::Value> result = ScriptController::callFunction(state->executionContext(), callback, object, 1, info.get(), isolate);    if (exceptionCatcher.HasCaught()) {        state->setException(exceptionCatcher.Exception());        return NodeFilter::FILTER_REJECT;    }    ASSERT(!result.IsEmpty());    return result->Int32Value();}
开发者ID:glenkim-dev,项目名称:blink-crosswalk,代码行数:39,


示例26: scope

void WindowProxy::updateDocumentProperty(){    ScriptState::Scope scope(m_scriptState.get());    v8::Handle<v8::Context> context = m_scriptState->context();    v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document(), context->Global(), context->GetIsolate());    ASSERT(documentWrapper == m_document.newLocal(m_isolate) || m_document.isEmpty());    if (m_document.isEmpty())        updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper));    // If instantiation of the document wrapper fails, clear the cache    // and let the LocalDOMWindow accessor handle access to the document.    if (documentWrapper.IsEmpty()) {        clearDocumentProperty();        return;    }    ASSERT(documentWrapper->IsObject());    context->Global()->ForceSet(v8AtomicString(m_isolate, "document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));    // We also stash a reference to the document on the inner global object so that    // LocalDOMWindow objects we obtain from JavaScript references are guaranteed to have    // live Document objects.    V8HiddenValue::setHiddenValue(m_isolate, toInnerGlobalObject(context), V8HiddenValue::document(m_isolate), documentWrapper);}
开发者ID:domenic,项目名称:mojo,代码行数:23,


示例27: installV8TestInterfaceWillBeGarbageCollectedTemplate

static void installV8TestInterfaceWillBeGarbageCollectedTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate){    functionTemplate->ReadOnlyPrototype();    v8::Local<v8::Signature> defaultSignature;    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterfaceWillBeGarbageCollected", V8EventTarget::domTemplate(isolate), V8TestInterfaceWillBeGarbageCollected::internalFieldCount,        V8TestInterfaceWillBeGarbageCollectedAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceWillBeGarbageCollectedAttributes),        0, 0,        0, 0);    functionTemplate->SetCallHandler(V8TestInterfaceWillBeGarbageCollected::constructorCallback);    functionTemplate->SetLength(1);    v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();    ALLOW_UNUSED_LOCAL(instanceTemplate);    v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();    ALLOW_UNUSED_LOCAL(prototypeTemplate);    const V8DOMConfiguration::MethodConfiguration funcMethodConfiguration = {        "func", TestInterfaceWillBeGarbageCollectedV8Internal::funcMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts,    };    V8DOMConfiguration::installMethod(isolate, instanceTemplate, defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly), funcMethodConfiguration);    // Custom toString template    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:23,


示例28: ASSERT

void V8WindowShell::setSecurityToken(){    ASSERT(m_world->isMainWorld());    Document* document = m_frame->document();    // Ask the document's SecurityOrigin to generate a security token.    // If two tokens are equal, then the SecurityOrigins canAccess each other.    // If two tokens are not equal, then we have to call canAccess.    // Note: we can't use the HTTPOrigin if it was set from the DOM.    SecurityOrigin* origin = document->securityOrigin();    String token;    // We stick with an empty token if document.domain was modified or if we    // are in the initial empty document, so that we can do a full canAccess    // check in those cases.    if (!origin->domainWasSetInDOM()        && !m_frame->loader().stateMachine()->isDisplayingInitialEmptyDocument())        token = document->securityOrigin()->toString();    // An empty or "null" token means we always have to call    // canAccess. The toString method on securityOrigins returns the    // string "null" for empty security origins and for security    // origins that should only allow access to themselves. In this    // case, we use the global object as the security token to avoid    // calling canAccess when a script accesses its own objects.    v8::HandleScope handleScope(m_isolate);    v8::Handle<v8::Context> context = m_contextHolder->context();    if (token.isEmpty() || token == "null") {        context->UseDefaultSecurityToken();        return;    }    CString utf8Token = token.utf8();    // NOTE: V8 does identity comparison in fast path, must use a symbol    // as the security token.    context->SetSecurityToken(v8AtomicString(m_isolate, utf8Token.data(), utf8Token.length()));}
开发者ID:Metrological,项目名称:chromium,代码行数:37,



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


C++ v8Boolean函数代码示例
C++ v7_arg函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。