本文整理汇总了C++中constructEmptyObject函数的典型用法代码示例。如果您正苦于以下问题:C++ constructEmptyObject函数的具体用法?C++ constructEmptyObject怎么用?C++ constructEmptyObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了constructEmptyObject函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: jsUndefined
JSValue JSInjectedScriptHost::functionDetails(ExecState* exec)
{
if (exec->argumentCount() < 1)
return jsUndefined();
JSValue value = exec->argument(0);
if (!value.asCell()->inherits(&JSFunction::s_info))
return jsUndefined();
JSFunction* function = jsCast<JSFunction*>(value);
const SourceCode* sourceCode = function->sourceCode();
if (!sourceCode)
return jsUndefined();
int lineNumber = sourceCode->firstLine();
if (lineNumber)
lineNumber -= 1; // In the inspector protocol all positions are 0-based while in SourceCode they are 1-based
UString scriptId = UString::number(sourceCode->provider()->asID());
JSObject* location = constructEmptyObject(exec);
location->putDirect(exec->globalData(), Identifier(exec, "lineNumber"), jsNumber(lineNumber));
location->putDirect(exec->globalData(), Identifier(exec, "scriptId"), jsString(exec, scriptId));
JSObject* result = constructEmptyObject(exec);
result->putDirect(exec->globalData(), Identifier(exec, "location"), location);
UString name = function->name(exec);
if (!name.isEmpty())
result->putDirect(exec->globalData(), Identifier(exec, "name"), jsString(exec, name));
UString displayName = function->displayName(exec);
if (!displayName.isEmpty())
result->putDirect(exec->globalData(), Identifier(exec, "displayName"), jsString(exec, displayName));
// FIXME: provide function scope data in "scopesRaw" property when JSC supports it.
// https://bugs.webkit.org/show_bug.cgi?id=87192
return result;
}
开发者ID:dzhshf,项目名称:WebKit,代码行数:33,代码来源:JSInjectedScriptHostCustom.cpp
示例2: objectConstructorCreate
EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
{
if (!exec->argument(0).isObject() && !exec->argument(0).isNull())
return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object prototype may only be an Object or null.")));
JSValue proto = exec->argument(0);
JSObject* newObject = proto.isObject()
? constructEmptyObject(exec, asObject(proto))
: constructEmptyObject(exec, exec->lexicalGlobalObject()->nullPrototypeObjectStructure());
if (exec->argument(1).isUndefined())
return JSValue::encode(newObject);
if (!exec->argument(1).isObject())
return throwVMError(exec, createTypeError(exec, ASCIILiteral("Property descriptor list must be an Object.")));
return JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1))));
}
开发者ID:166MMX,项目名称:openjdk.java.net-openjfx-8u40-rt,代码行数:14,代码来源:ObjectConstructor.cpp
示例3: createIteratorResultObject
JSObject* createIteratorResultObject(ExecState* exec, JSValue value, bool done)
{
JSObject* resultObject = constructEmptyObject(exec);
resultObject->putDirect(exec->vm(), exec->propertyNames().done, jsBoolean(done));
resultObject->putDirect(exec->vm(), exec->propertyNames().value, value);
return resultObject;
}
开发者ID:biddyweb,项目名称:switch-oss,代码行数:7,代码来源:IteratorOperations.cpp
示例4: createIteratorResultObject
JSObject* createIteratorResultObject(ExecState* exec, JSValue value, bool done)
{
JSObject* resultObject = constructEmptyObject(exec, exec->lexicalGlobalObject()->iteratorResultObjectStructure());
resultObject->putDirect(exec->vm(), donePropertyOffset, jsBoolean(done));
resultObject->putDirect(exec->vm(), valuePropertyOffset, value);
return resultObject;
}
开发者ID:LuXiong,项目名称:webkit,代码行数:7,代码来源:IteratorOperations.cpp
示例5: constructEmptyObject
bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
JSFunction* thisObject = jsCast<JSFunction*>(cell);
if (thisObject->isHostFunction())
return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
if (propertyName == exec->propertyNames().prototype) {
JSGlobalData& globalData = exec->globalData();
PropertyOffset offset = thisObject->getDirectOffset(globalData, propertyName);
if (!isValidOffset(offset)) {
JSObject* prototype = constructEmptyObject(exec);
prototype->putDirect(globalData, exec->propertyNames().constructor, thisObject, DontEnum);
thisObject->putDirect(globalData, exec->propertyNames().prototype, prototype, DontDelete | DontEnum);
offset = thisObject->getDirectOffset(globalData, exec->propertyNames().prototype);
ASSERT(isValidOffset(offset));
}
slot.setValue(thisObject, thisObject->getDirect(offset), offset);
}
if (propertyName == exec->propertyNames().arguments) {
if (thisObject->jsExecutable()->isStrictMode()) {
bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
if (!result) {
thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
ASSERT(result);
}
return result;
}
slot.setCacheableCustom(thisObject, argumentsGetter);
return true;
}
if (propertyName == exec->propertyNames().length) {
slot.setCacheableCustom(thisObject, lengthGetter);
return true;
}
if (propertyName == exec->propertyNames().name) {
slot.setCacheableCustom(thisObject, nameGetter);
return true;
}
if (propertyName == exec->propertyNames().caller) {
if (thisObject->jsExecutable()->isStrictMode()) {
bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
if (!result) {
thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
ASSERT(result);
}
return result;
}
slot.setCacheableCustom(thisObject, callerGetter);
return true;
}
return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
}
开发者ID:fatman2021,项目名称:webkitgtk,代码行数:60,代码来源:JSFunction.cpp
示例6: webAssemblyModuleImports
EncodedJSValue JSC_HOST_CALL webAssemblyModuleImports(ExecState* exec)
{
VM& vm = exec->vm();
auto* globalObject = exec->lexicalGlobalObject();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSWebAssemblyModule* module = jsDynamicCast<JSWebAssemblyModule*>(vm, exec->argument(0));
if (!module)
return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, "WebAssembly.Module.imports called with non WebAssembly.Module argument"_s)));
JSArray* result = constructEmptyArray(exec, nullptr, globalObject);
RETURN_IF_EXCEPTION(throwScope, { });
const auto& imports = module->moduleInformation().imports;
if (imports.size()) {
Identifier module = Identifier::fromString(exec, "module");
Identifier name = Identifier::fromString(exec, "name");
Identifier kind = Identifier::fromString(exec, "kind");
for (const Wasm::Import& imp : imports) {
JSObject* obj = constructEmptyObject(exec);
RETURN_IF_EXCEPTION(throwScope, { });
obj->putDirect(vm, module, jsString(exec, String::fromUTF8(imp.module)));
obj->putDirect(vm, name, jsString(exec, String::fromUTF8(imp.field)));
obj->putDirect(vm, kind, jsString(exec, String(makeString(imp.kind))));
result->push(exec, obj);
RETURN_IF_EXCEPTION(throwScope, { });
}
}
return JSValue::encode(result);
}
开发者ID:wolfviking0,项目名称:webcl-webkit,代码行数:31,代码来源:WebAssemblyModuleConstructor.cpp
示例7: constructEmptyObject
JSValue Origin::toJS(ExecState* exec) const
{
JSObject* result = constructEmptyObject(exec);
result->putDirect(exec->vm(), exec->propertyNames().bytecodesID, jsNumber(m_bytecodes->id()));
result->putDirect(exec->vm(), exec->propertyNames().bytecodeIndex, jsNumber(m_bytecodeIndex));
return result;
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:7,代码来源:ProfilerOrigin.cpp
示例8: objectConstructorGetOwnPropertyDescriptor
JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
if (!args.at(0).isObject())
return throwError(exec, TypeError, "Requested property descriptor of a value that is not an object.");
UString propertyName = args.at(1).toString(exec);
if (exec->hadException())
return jsNull();
JSObject* object = asObject(args.at(0));
PropertyDescriptor descriptor;
if (!object->getOwnPropertyDescriptor(exec, Identifier(exec, propertyName), descriptor))
return jsUndefined();
if (exec->hadException())
return jsUndefined();
JSObject* description = constructEmptyObject(exec);
if (!descriptor.isAccessorDescriptor()) {
description->putDirect(exec->propertyNames().value, descriptor.value() ? descriptor.value() : jsUndefined(), 0);
description->putDirect(exec->propertyNames().writable, jsBoolean(descriptor.writable()), 0);
} else {
description->putDirect(exec->propertyNames().get, descriptor.getter() ? descriptor.getter() : jsUndefined(), 0);
description->putDirect(exec->propertyNames().set, descriptor.setter() ? descriptor.setter() : jsUndefined(), 0);
}
description->putDirect(exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0);
description->putDirect(exec->propertyNames().configurable, jsBoolean(descriptor.configurable()), 0);
return description;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:28,代码来源:ObjectConstructor.cpp
示例9: DECLARE_THROW_SCOPE
JSValue Database::toJS(ExecState* exec) const
{
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
JSObject* result = constructEmptyObject(exec);
JSArray* bytecodes = constructEmptyArray(exec, 0);
RETURN_IF_EXCEPTION(scope, JSValue());
for (unsigned i = 0; i < m_bytecodes.size(); ++i)
bytecodes->putDirectIndex(exec, i, m_bytecodes[i].toJS(exec));
result->putDirect(vm, exec->propertyNames().bytecodes, bytecodes);
JSArray* compilations = constructEmptyArray(exec, 0);
RETURN_IF_EXCEPTION(scope, JSValue());
for (unsigned i = 0; i < m_compilations.size(); ++i)
compilations->putDirectIndex(exec, i, m_compilations[i]->toJS(exec));
result->putDirect(vm, exec->propertyNames().compilations, compilations);
JSArray* events = constructEmptyArray(exec, 0);
RETURN_IF_EXCEPTION(scope, JSValue());
for (unsigned i = 0; i < m_events.size(); ++i)
events->putDirectIndex(exec, i, m_events[i].toJS(exec));
result->putDirect(vm, exec->propertyNames().events, events);
return result;
}
开发者ID:ollie314,项目名称:webkit,代码行数:26,代码来源:ProfilerDatabase.cpp
示例10: jsUndefined
JSValue JSInjectedScriptHost::weakSetEntries(ExecState* exec)
{
if (exec->argumentCount() < 1)
return jsUndefined();
JSValue value = exec->uncheckedArgument(0);
JSWeakSet* weakSet = jsDynamicCast<JSWeakSet*>(value);
if (!weakSet)
return jsUndefined();
unsigned fetched = 0;
unsigned numberToFetch = 100;
JSValue numberToFetchArg = exec->argument(1);
double fetchDouble = numberToFetchArg.toInteger(exec);
if (fetchDouble >= 0)
numberToFetch = static_cast<unsigned>(fetchDouble);
JSArray* array = constructEmptyArray(exec, nullptr);
for (auto it = weakSet->weakMapData()->begin(); it != weakSet->weakMapData()->end(); ++it) {
JSObject* entry = constructEmptyObject(exec);
entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), it->key);
array->putDirectIndex(exec, fetched++, entry);
if (numberToFetch && fetched >= numberToFetch)
break;
}
return array;
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:29,代码来源:JSInjectedScriptHost.cpp
示例11: jsUndefined
JSValue JSCommandLineAPIHost::getEventListeners(ExecState& state)
{
if (state.argumentCount() < 1)
return jsUndefined();
JSValue value = state.uncheckedArgument(0);
if (!value.isObject() || value.isNull())
return jsUndefined();
Node* node = JSNode::toWrapped(value);
if (!node)
return jsUndefined();
Vector<EventListenerInfo> listenersArray;
wrapped().getEventListenersImpl(node, listenersArray);
JSObject* result = constructEmptyObject(&state);
for (size_t i = 0; i < listenersArray.size(); ++i) {
JSArray* listeners = getJSListenerFunctions(state, &node->document(), listenersArray[i]);
if (!listeners->length())
continue;
AtomicString eventType = listenersArray[i].eventType;
result->putDirect(state.vm(), Identifier::fromString(&state, eventType.impl()), JSValue(listeners));
}
return result;
}
开发者ID:ollie314,项目名称:webkit,代码行数:27,代码来源:JSCommandLineAPIHostCustom.cpp
示例12: constructInternalProperty
static JSObject* constructInternalProperty(ExecState* exec, const String& name, JSValue value)
{
JSObject* result = constructEmptyObject(exec);
result->putDirect(exec->vm(), Identifier::fromString(exec, "name"), jsString(exec, name));
result->putDirect(exec->vm(), Identifier::fromString(exec, "value"), value);
return result;
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:7,代码来源:JSInjectedScriptHost.cpp
示例13: getJSListenerFunctions
static JSArray* getJSListenerFunctions(ExecState& state, Document* document, const EventListenerInfo& listenerInfo)
{
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
JSArray* result = constructEmptyArray(&state, nullptr);
RETURN_IF_EXCEPTION(scope, nullptr);
size_t handlersCount = listenerInfo.eventListenerVector.size();
for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) {
const JSEventListener* jsListener = JSEventListener::cast(&listenerInfo.eventListenerVector[i]->callback());
if (!jsListener) {
ASSERT_NOT_REACHED();
continue;
}
// Hide listeners from other contexts.
if (&jsListener->isolatedWorld() != ¤tWorld(&state))
continue;
JSObject* function = jsListener->jsFunction(document);
if (!function)
continue;
JSObject* listenerEntry = constructEmptyObject(&state);
listenerEntry->putDirect(vm, Identifier::fromString(&state, "listener"), function);
listenerEntry->putDirect(vm, Identifier::fromString(&state, "useCapture"), jsBoolean(listenerInfo.eventListenerVector[i]->useCapture()));
result->putDirectIndex(&state, outputIndex++, JSValue(listenerEntry));
}
return result;
}
开发者ID:ollie314,项目名称:webkit,代码行数:29,代码来源:JSCommandLineAPIHostCustom.cpp
示例14: objectConstructorGetOwnPropertyDescriptor
EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
{
if (!exec->argument(0).isObject())
return throwVMError(exec, createTypeError(exec, ASCIILiteral("Requested property descriptor of a value that is not an object.")));
String propertyName = exec->argument(1).toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsNull());
JSObject* object = asObject(exec->argument(0));
PropertyDescriptor descriptor;
if (!object->methodTable()->getOwnPropertyDescriptor(object, exec, Identifier(exec, propertyName), descriptor))
return JSValue::encode(jsUndefined());
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSObject* description = constructEmptyObject(exec);
if (!descriptor.isAccessorDescriptor()) {
description->putDirect(exec->vm(), exec->propertyNames().value, descriptor.value() ? descriptor.value() : jsUndefined(), 0);
description->putDirect(exec->vm(), exec->propertyNames().writable, jsBoolean(descriptor.writable()), 0);
} else {
ASSERT(descriptor.getter());
ASSERT(descriptor.setter());
description->putDirect(exec->vm(), exec->propertyNames().get, descriptor.getter(), 0);
description->putDirect(exec->vm(), exec->propertyNames().set, descriptor.setter(), 0);
}
description->putDirect(exec->vm(), exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0);
description->putDirect(exec->vm(), exec->propertyNames().configurable, jsBoolean(descriptor.configurable()), 0);
return JSValue::encode(description);
}
开发者ID:166MMX,项目名称:openjdk.java.net-openjfx-8u40-rt,代码行数:30,代码来源:ObjectConstructor.cpp
示例15: IntlCollatorPrototypeFuncResolvedOptions
EncodedJSValue JSC_HOST_CALL IntlCollatorPrototypeFuncResolvedOptions(ExecState* exec)
{
// 10.3.5 Intl.Collator.prototype.resolvedOptions() (ECMA-402 2.0)
IntlCollator* collator = jsDynamicCast<IntlCollator*>(exec->thisValue());
if (!collator)
return JSValue::encode(throwTypeError(exec, ASCIILiteral("Intl.Collator.prototype.resolvedOptions called on value that's not an object initialized as a Collator")));
// The function returns a new object whose properties and attributes are set as if
// constructed by an object literal assigning to each of the following properties the
// value of the corresponding internal slot of this Collator object (see 10.4): locale,
// usage, sensitivity, ignorePunctuation, collation, as well as those properties shown
// in Table 1 whose keys are included in the %Collator%[[relevantExtensionKeys]]
// internal slot of the standard built-in object that is the initial value of
// Intl.Collator.
VM& vm = exec->vm();
JSObject* options = constructEmptyObject(exec);
options->putDirect(vm, vm.propertyNames->locale, jsString(exec, collator->locale()));
options->putDirect(vm, vm.propertyNames->usage, jsString(exec, collator->usage()));
options->putDirect(vm, vm.propertyNames->sensitivity, jsString(exec, collator->sensitivity()));
options->putDirect(vm, vm.propertyNames->ignorePunctuation, jsBoolean(collator->ignorePunctuation()));
options->putDirect(vm, vm.propertyNames->collation, jsString(exec, collator->collation()));
options->putDirect(vm, vm.propertyNames->numeric, jsBoolean(collator->numeric()));
return JSValue::encode(options);
}
开发者ID:rhythmkay,项目名称:webkit,代码行数:25,代码来源:IntlCollatorPrototype.cpp
示例16: initializeCollator
JSObject* IntlCollator::resolvedOptions(ExecState& state)
{
// 10.3.5 Intl.Collator.prototype.resolvedOptions() (ECMA-402 2.0)
// The function returns a new object whose properties and attributes are set as if
// constructed by an object literal assigning to each of the following properties the
// value of the corresponding internal slot of this Collator object (see 10.4): locale,
// usage, sensitivity, ignorePunctuation, collation, as well as those properties shown
// in Table 1 whose keys are included in the %Collator%[[relevantExtensionKeys]]
// internal slot of the standard built-in object that is the initial value of
// Intl.Collator.
if (!m_initializedCollator) {
initializeCollator(state, jsUndefined(), jsUndefined());
ASSERT(!state.hadException());
}
VM& vm = state.vm();
JSObject* options = constructEmptyObject(&state);
options->putDirect(vm, vm.propertyNames->locale, jsString(&state, m_locale));
options->putDirect(vm, vm.propertyNames->usage, jsNontrivialString(&state, ASCIILiteral(usageString(m_usage))));
options->putDirect(vm, vm.propertyNames->sensitivity, jsNontrivialString(&state, ASCIILiteral(sensitivityString(m_sensitivity))));
options->putDirect(vm, vm.propertyNames->ignorePunctuation, jsBoolean(m_ignorePunctuation));
options->putDirect(vm, vm.propertyNames->collation, jsString(&state, m_collation));
options->putDirect(vm, vm.propertyNames->numeric, jsBoolean(m_numeric));
return options;
}
开发者ID:endlessm,项目名称:WebKit,代码行数:26,代码来源:IntlCollator.cpp
示例17: getJSListenerFunctions
static JSArray* getJSListenerFunctions(ExecState* exec, Document* document, const EventListenerInfo& listenerInfo)
{
JSArray* result = constructEmptyArray(exec, nullptr);
size_t handlersCount = listenerInfo.eventListenerVector.size();
for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) {
const JSEventListener* jsListener = JSEventListener::cast(listenerInfo.eventListenerVector[i].listener.get());
if (!jsListener) {
ASSERT_NOT_REACHED();
continue;
}
// Hide listeners from other contexts.
if (&jsListener->isolatedWorld() != ¤tWorld(exec))
continue;
JSObject* function = jsListener->jsFunction(document);
if (!function)
continue;
JSObject* listenerEntry = constructEmptyObject(exec);
listenerEntry->putDirect(exec->vm(), Identifier::fromString(exec, "listener"), function);
listenerEntry->putDirect(exec->vm(), Identifier::fromString(exec, "useCapture"), jsBoolean(listenerInfo.eventListenerVector[i].useCapture));
result->putDirectIndex(exec, outputIndex++, JSValue(listenerEntry));
}
return result;
}
开发者ID:biddyweb,项目名称:switch-oss,代码行数:26,代码来源:JSCommandLineAPIHostCustom.cpp
示例18: jsUndefined
JSValue JSInjectedScriptHost::functionDetails(ExecState* exec)
{
if (exec->argumentCount() < 1)
return jsUndefined();
JSValue value = exec->uncheckedArgument(0);
if (!value.asCell()->inherits(JSFunction::info()))
return jsUndefined();
// FIXME: This should provide better details for JSBoundFunctions.
JSFunction* function = jsCast<JSFunction*>(value);
const SourceCode* sourceCode = function->sourceCode();
if (!sourceCode)
return jsUndefined();
// In the inspector protocol all positions are 0-based while in SourceCode they are 1-based
int lineNumber = sourceCode->firstLine();
if (lineNumber)
lineNumber -= 1;
int columnNumber = sourceCode->startColumn();
if (columnNumber)
columnNumber -= 1;
VM& vm = exec->vm();
String scriptID = String::number(sourceCode->provider()->asID());
JSObject* location = constructEmptyObject(exec);
location->putDirect(vm, Identifier::fromString(exec, "scriptId"), jsString(exec, scriptID));
location->putDirect(vm, Identifier::fromString(exec, "lineNumber"), jsNumber(lineNumber));
location->putDirect(vm, Identifier::fromString(exec, "columnNumber"), jsNumber(columnNumber));
JSObject* result = constructEmptyObject(exec);
result->putDirect(vm, Identifier::fromString(exec, "location"), location);
String name = function->name();
if (!name.isEmpty())
result->putDirect(vm, Identifier::fromString(exec, "name"), jsString(exec, name));
String displayName = function->displayName(vm);
if (!displayName.isEmpty())
result->putDirect(vm, Identifier::fromString(exec, "displayName"), jsString(exec, displayName));
// FIXME: provide function scope data in "scopesRaw" property when JSC supports it.
// <https://webkit.org/b/87192> [JSC] expose function (closure) inner context to debugger
return result;
}
开发者ID:LuXiong,项目名称:webkit,代码行数:47,代码来源:JSInjectedScriptHost.cpp
示例19: createRotationRateObject
static JSObject* createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate, ExecState* exec)
{
JSObject* object = constructEmptyObject(exec);
object->putDirect(exec->globalData(), Identifier(exec, "alpha"), rotationRate->canProvideAlpha() ? jsNumber(rotationRate->alpha()) : jsNull());
object->putDirect(exec->globalData(), Identifier(exec, "beta"), rotationRate->canProvideBeta() ? jsNumber(rotationRate->beta()) : jsNull());
object->putDirect(exec->globalData(), Identifier(exec, "gamma"), rotationRate->canProvideGamma() ? jsNumber(rotationRate->gamma()) : jsNull());
return object;
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:8,代码来源:JSDeviceMotionEventCustom.cpp
示例20: createAccelerationObject
static JSObject* createAccelerationObject(const DeviceMotionData::Acceleration* acceleration, ExecState& state)
{
JSObject* object = constructEmptyObject(&state);
object->putDirect(state.vm(), Identifier::fromString(&state, "x"), acceleration->canProvideX() ? jsNumber(acceleration->x()) : jsNull());
object->putDirect(state.vm(), Identifier::fromString(&state, "y"), acceleration->canProvideY() ? jsNumber(acceleration->y()) : jsNull());
object->putDirect(state.vm(), Identifier::fromString(&state, "z"), acceleration->canProvideZ() ? jsNumber(acceleration->z()) : jsNull());
return object;
}
开发者ID:hnney,项目名称:webkit,代码行数:8,代码来源:JSDeviceMotionEventCustom.cpp
注:本文中的constructEmptyObject函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论