void JS_SetPrivate(IJS_Runtime* pJSRuntime, v8::Handle<v8::Object> pObj, void* p) { if(pObj.IsEmpty() || !pObj->InternalFieldCount()) return; CJS_PrivateData* pPrivateData = (CJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0); if(!pPrivateData) return; pPrivateData->pPrivate = p; }
bool isWrappedNPObject(v8::Handle<v8::Object> object) { if (object->InternalFieldCount() == npObjectInternalFieldCount) { const WrapperTypeInfo* typeInfo = static_cast<const WrapperTypeInfo*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperTypeIndex)); return typeInfo == npObjectTypeInfo(); } return false; }
int JS_GetObjDefnID(v8::Handle<v8::Object> pObj) { if(pObj.IsEmpty() || !pObj->InternalFieldCount()) return -1; CJS_PrivateData* pPrivateData = (CJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0); if(pPrivateData) return pPrivateData->ObjDefID; return -1; }
void JS_FreePrivate(v8::Handle<v8::Object> pObj) { if(pObj.IsEmpty() || !pObj->InternalFieldCount()) return; JS_FreePrivate(pObj->GetAlignedPointerFromInternalField(0)); pObj->SetAlignedPointerInInternalField(0, NULL); }