예제 #1
0
JSValue jsGeopositionCoords(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSGeoposition* castedThis = static_cast<JSGeoposition*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    Geoposition* imp = static_cast<Geoposition*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->coords()));
    return result;
}
static v8::Handle<v8::Value> coordsAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    Geoposition* imp = V8Geoposition::toNative(info.Holder());
    RefPtr<Coordinates> result = imp->coords();
    v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined();
    if (wrapper.IsEmpty()) {
        wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
        if (!wrapper.IsEmpty())
            V8DOMWrapper::setNamedHiddenReference(info.Holder(), "coords", wrapper);
    }
    return wrapper;
}