本文整理汇总了C++中v8::PropertyCallbackInfo类的典型用法代码示例。如果您正苦于以下问题:C++ PropertyCallbackInfo类的具体用法?C++ PropertyCallbackInfo怎么用?C++ PropertyCallbackInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PropertyCallbackInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: reflectStringAttributeAttributeGetter
static void reflectStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
Element* imp = V8Element::toNative(info.Holder());
v8SetReturnValueString(info, imp->fastGetAttribute(HTMLNames::reflectstringattributeAttr), info.GetIsolate());
}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:5,代码来源:V8TestInterfaceNode.cpp
示例2: uLongLongAttributeAttributeGetter
static void uLongLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Handle<v8::Object> holder = info.Holder();
TestTypedefs* impl = V8TestTypedefs::toNative(holder);
v8SetReturnValue(info, static_cast<double>(impl->uLongLongAttribute()));
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_chromium_org,代码行数:6,代码来源:V8TestTypedefs.cpp
示例3: attr2AttributeGetter
static void attr2AttributeGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestEventConstructor* imp = V8TestEventConstructor::toNative(info.Holder());
v8SetReturnValueString(info, imp->attr2(), info.GetIsolate());
return;
}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:6,代码来源:V8TestEventConstructor.cpp
示例4: exceptionState
void V8XMLHttpRequest::responseAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>& info)
{
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
switch (xmlHttpRequest->responseTypeCode()) {
case XMLHttpRequest::ResponseTypeDefault:
case XMLHttpRequest::ResponseTypeText:
responseTextAttributeGetterCustom(info);
return;
case XMLHttpRequest::ResponseTypeJSON:
{
v8::Isolate* isolate = info.GetIsolate();
ScriptString jsonSource = xmlHttpRequest->responseJSONSource();
if (jsonSource.hasNoValue() || !jsonSource.v8Value()->IsString()) {
v8SetReturnValue(info, v8::Null(isolate));
return;
}
// Catch syntax error.
v8::TryCatch exceptionCatcher;
v8::Handle<v8::Value> json = v8::JSON::Parse(jsonSource.v8Value().As<v8::String>());
if (exceptionCatcher.HasCaught() || json.IsEmpty())
v8SetReturnValue(info, v8::Null(isolate));
else
v8SetReturnValue(info, json);
return;
}
case XMLHttpRequest::ResponseTypeDocument:
{
ExceptionState exceptionState(ExceptionState::GetterContext, "response", "XMLHttpRequest", info.Holder(), info.GetIsolate());
Document* document = xmlHttpRequest->responseXML(exceptionState);
if (exceptionState.throwIfNeeded())
return;
v8SetReturnValueFast(info, document, xmlHttpRequest);
return;
}
case XMLHttpRequest::ResponseTypeBlob:
{
Blob* blob = xmlHttpRequest->responseBlob();
v8SetReturnValueFast(info, blob, xmlHttpRequest);
return;
}
case XMLHttpRequest::ResponseTypeStream:
{
Stream* stream = xmlHttpRequest->responseStream();
v8SetReturnValueFast(info, stream, xmlHttpRequest);
return;
}
case XMLHttpRequest::ResponseTypeArrayBuffer:
{
ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer();
if (arrayBuffer) {
arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTemplate());
}
v8SetReturnValueFast(info, arrayBuffer, xmlHttpRequest);
return;
}
}
}
开发者ID:kublaj,项目名称:blink,代码行数:68,代码来源:V8XMLHttpRequestCustom.cpp
示例5: switch
void V8MessageEvent::dataAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>& info)
{
MessageEvent* event = V8MessageEvent::toNative(info.Holder());
v8::Handle<v8::Value> result;
switch (event->dataType()) {
case MessageEvent::DataTypeScriptValue: {
result = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::data(info.GetIsolate()));
if (result.IsEmpty()) {
if (!event->dataAsSerializedScriptValue()) {
// If we're in an isolated world and the event was created in the main world,
// we need to find the 'data' property on the main world wrapper and clone it.
v8::Local<v8::Value> mainWorldData = V8HiddenValue::getHiddenValueFromMainWorldWrapper(info.GetIsolate(), event, V8HiddenValue::data(info.GetIsolate()));
if (!mainWorldData.IsEmpty())
event->setSerializedData(SerializedScriptValue::createAndSwallowExceptions(mainWorldData, info.GetIsolate()));
}
if (event->dataAsSerializedScriptValue())
result = event->dataAsSerializedScriptValue()->deserialize(info.GetIsolate());
else
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 = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::stringData(info.GetIsolate()));
if (result.IsEmpty()) {
String stringValue = event->dataAsString();
result = v8String(info.GetIsolate(), stringValue);
}
break;
}
case MessageEvent::DataTypeBlob:
result = toV8(event->dataAsBlob(), info.Holder(), info.GetIsolate());
break;
case MessageEvent::DataTypeArrayBuffer:
result = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::arrayBufferData(info.GetIsolate()));
if (result.IsEmpty())
result = toV8(event->dataAsArrayBuffer(), info.Holder(), info.GetIsolate());
break;
}
// Overwrite the data attribute so it returns the cached result in future invocations.
// This custom getter handler will not be called again.
v8::PropertyAttribute dataAttr = static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly);
info.Holder()->ForceSet(v8AtomicString(info.GetIsolate(), "data"), result, dataAttr);
v8SetReturnValue(info, result);
}
开发者ID:Mihiri,项目名称:blink,代码行数:59,代码来源:V8MessageEventCustom.cpp
示例6: npObjectSetIndexedProperty
void npObjectSetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
NPIdentifier identifier = _NPN_GetIntIdentifier(index);
v8SetReturnValue(info, npObjectSetProperty(self, identifier, value, info.GetIsolate()));
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:5,代码来源:V8NPObject.cpp
示例7: attr1AttributeGetter
static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Handle<v8::Object> holder = info.Holder();
TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toNative(holder);
v8SetReturnValueFast(info, WTF::getPtr(impl->attr1()), impl);
}
开发者ID:ewilligers,项目名称:blink,代码行数:6,代码来源:V8TestInterfaceGarbageCollected.cpp
示例8: attrWithSetterExceptionAttributeGetter
static void attrWithSetterExceptionAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
v8SetReturnValueInt(info, imp->attrWithSetterException());
}
开发者ID:kublaj,项目名称:blink,代码行数:5,代码来源:V8TestTypedefs.cpp
示例9: stringAttrWithGetterExceptionAttributeSetter
static void stringAttrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
imp->setStringAttrWithGetterException(cppValue);
}
开发者ID:kublaj,项目名称:blink,代码行数:6,代码来源:V8TestTypedefs.cpp
示例10: stringAttributeAttributeSetter
static void stringAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
imp->setStringAttribute(cppValue);
}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:6,代码来源:V8TestInterfaceNode.cpp
示例11:
void JSCanvasRenderingContext2D::JSSetFillStyle(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) {
JSCanvasRenderingContext2D* self = UnwrapSelf<JSCanvasRenderingContext2D>(info.Holder());
info.GetReturnValue().Set(self->GetFillStyle());
}
开发者ID:Xenoveritas,项目名称:jsvsynth,代码行数:4,代码来源:Canvas.cpp
示例12: stringAttributeAttributeGetter
static void stringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
v8SetReturnValueString(info, imp->stringAttribute(), info.GetIsolate());
}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:5,代码来源:V8TestInterfaceNode.cpp
示例13: reflectUrlStringAttributeAttributeSetter
static void reflectUrlStringAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
Element* imp = V8Element::toNative(info.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
imp->setAttribute(HTMLNames::reflecturlstringattributeAttr, cppValue);
}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:6,代码来源:V8TestInterfaceNode.cpp
示例14: reflectUrlStringAttributeAttributeGetter
static void reflectUrlStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder());
v8SetReturnValueString(info, imp->getURLAttribute(HTMLNames::reflecturlstringattributeAttr), info.GetIsolate());
}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:5,代码来源:V8TestInterfaceNode.cpp
示例15: npObjectIndexedPropertyGetter
void npObjectIndexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
{
NPIdentifier identifier = _NPN_GetIntIdentifier(index);
v8SetReturnValue(info, npObjectGetProperty(info.Holder(), identifier, v8::Number::New(index), info.GetIsolate()));
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:5,代码来源:V8NPObject.cpp
示例16: stringAttrWithSetterExceptionAttributeGetter
static void stringAttrWithSetterExceptionAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
v8SetReturnValueString(info, imp->stringAttrWithSetterException(), info.GetIsolate());
}
开发者ID:kublaj,项目名称:blink,代码行数:5,代码来源:V8TestTypedefs.cpp
示例17: npObjectSetNamedProperty
void npObjectSetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
NPIdentifier identifier = getStringIdentifier(name);
v8SetReturnValue(info, npObjectSetProperty(self, identifier, value, info.GetIsolate()));
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:5,代码来源:V8NPObject.cpp
示例18: unsignedLongLongAttrAttributeGetter
static void unsignedLongLongAttrAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
v8SetReturnValue(info, static_cast<double>(imp->unsignedLongLongAttr()));
}
开发者ID:kublaj,项目名称:blink,代码行数:5,代码来源:V8TestTypedefs.cpp
示例19: toLocalFrame
void V8Window::namedPropertyGetterCustom(
const AtomicString& name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
DOMWindow* window = V8Window::toImpl(info.Holder());
if (!window)
return;
Frame* frame = window->frame();
// window is detached from a frame.
if (!frame)
return;
// Note that the spec doesn't allow any cross-origin named access to the
// window object. However, UAs have traditionally allowed named access to
// named child browsing contexts, even across origins. So first, search child
// frames for a frame with a matching name.
Frame* child = frame->tree().scopedChild(name);
if (child) {
v8SetReturnValueFast(info, child->domWindow(), window);
return;
}
// If the frame is remote, the caller will never be able to access further
// named results.
if (!frame->isLocalFrame())
return;
// Search named items in the document.
Document* doc = toLocalFrame(frame)->document();
if (!doc || !doc->isHTMLDocument())
return;
// This is an AllCanRead interceptor. Check that the caller has access to the
// named results.
if (!BindingSecurity::shouldAllowAccessTo(
currentDOMWindow(info.GetIsolate()), window,
BindingSecurity::ErrorReportOption::DoNotReport))
return;
bool hasNamedItem = toHTMLDocument(doc)->hasNamedItem(name);
bool hasIdItem = doc->hasElementWithId(name);
if (!hasNamedItem && !hasIdItem)
return;
if (!hasNamedItem && hasIdItem &&
!doc->containsMultipleElementsWithId(name)) {
v8SetReturnValueFast(info, doc->getElementById(name), window);
return;
}
HTMLCollection* items = doc->windowNamedItems(name);
if (!items->isEmpty()) {
// TODO(esprehn): Firefox doesn't return an HTMLCollection here if there's
// multiple with the same name, but Chrome and Safari does. What's the
// right behavior?
if (items->hasExactlyOneItem()) {
v8SetReturnValueFast(info, items->item(0), window);
return;
}
v8SetReturnValueFast(info, items, window);
return;
}
}
开发者ID:mirror,项目名称:chromium,代码行数:64,代码来源:V8WindowCustom.cpp
示例20: TestInterfaceNamedConstructorReplaceableAttributeSetter
static void TestInterfaceNamedConstructorReplaceableAttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
info.This()->ForceSet(name, jsValue);
}
开发者ID:Mihiri,项目名称:blink,代码行数:4,代码来源:V8TestInterfaceNamedConstructor.cpp
注:本文中的v8::PropertyCallbackInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论