static void WeakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter) { InjectedScriptHost* nativeObject = static_cast<InjectedScriptHost*>(parameter); nativeObject->deref(); object.Dispose(); object.Clear(); }
void WeakHandleListener<StringCache, StringImpl>::callback(v8::Isolate* isolate, v8::Persistent<v8::Value> wrapper, StringImpl* stringImpl) { V8PerIsolateData::current()->stringCache()->remove(stringImpl); wrapper.Dispose(isolate); wrapper.Clear(); stringImpl->deref(); }
static void cachedStringCallback(v8::Persistent<v8::Value> wrapper, void* parameter) { StringImpl* stringImpl = static_cast<StringImpl*>(parameter); V8PerIsolateData::current()->stringCache()->remove(stringImpl); wrapper.Dispose(); wrapper.Clear(); stringImpl->deref(); }
static inline void MadeWeak(v8::Persistent<v8::Value> object, void *parameter) { T *obj = static_cast<T *>(parameter); delete(obj); object.Dispose(); object.Clear(); }
void SimpleDecWrappedRefCount(Isolate* isolate, v8::Persistent<v8::Value> object, void *parameter){ SMJS_BaseWrapped *wrapped = (SMJS_BaseWrapped*) parameter; if(--wrapped->refCount == 0){ delete wrapped; } object.Dispose(); object.Clear(); }
void JSFeature::FreeFeatureCallback(v8::Persistent<v8::Value> object, void *parameter) { Feature* feature = static_cast<Feature*>(parameter); delete feature; object.Dispose(); object.Clear(); }
void clrFuncProxyNearDeath(v8::Persistent<v8::Value> object, void* parameters) { DBG("clrFuncProxyNearDeath"); ClrFuncWrap* wrap = (ClrFuncWrap*)parameters; object.Dispose(); object.Clear(); wrap->clrFunc = nullptr; delete wrap; }
void JSFeatureProfile::FreeProfileCallback(v8::Persistent<v8::Value> object, void *parameter) { FeatureProfile* profile = static_cast<FeatureProfile*>(parameter); delete profile; object.Dispose(); object.Clear(); }
void JSFilterContext::FreeContextCallback(v8::Persistent<v8::Value> object, void *parameter) { FilterContext* context = static_cast<FilterContext*>(parameter); delete context; object.Dispose(); object.Clear(); }
void JSMapInfo::FreeMapInfoCallback(v8::Persistent<v8::Value> object, void *parameter) { Session* session = static_cast<Session*>(parameter); delete session; object.Dispose(); object.Clear(); }
void JSBounds::FreeBoundsCallback(v8::Persistent<v8::Value> object, void *parameter) { Bounds* bounds = static_cast<Bounds*>(parameter); delete bounds; object.Dispose(); object.Clear(); }
void JSVec3d::FreeVecCallback(v8::Persistent<v8::Value> object, void *parameter) { osg::Vec3d* v = static_cast<osg::Vec3d*>(parameter); delete v; object.Dispose(); object.Clear(); }
void JSSymbologyGeometry::FreeGeometryCallback(v8::Persistent<v8::Value> object, void *parameter) { osgEarth::Symbology::Geometry* geometry = static_cast<osgEarth::Symbology::Geometry*>(parameter); delete geometry; object.Dispose(); object.Clear(); }
void JSGeoExtent::FreeGeoExtentCallback(v8::Persistent<v8::Value> object, void *parameter) { osgEarth::GeoExtent* extent = static_cast<osgEarth::GeoExtent*>(parameter); delete extent; object.Dispose(); object.Clear(); }
void JSSpatialReference::FreeSpatialReferenceCallback(v8::Persistent<v8::Value> object, void *parameter) { //osgEarth::SpatialReference* srs = static_cast<osgEarth::SpatialReference*>(parameter); //delete srs; osg::ref_ptr<osgEarth::SpatialReference> srs = static_cast<osgEarth::SpatialReference*>(parameter); object.Dispose(); object.Clear(); }
void ObjectCache<K>::WeakCallback(v8::Persistent<v8::Value> object, void *parameter) { //called when only reference to object is weak - after garbage collection CallbackParameters<K> *params = (CallbackParameters<K>*) parameter; //remove it from the map params->cache->erase(params->key); //clear the reference to it object.Dispose(); object.Clear(); free(params); }
template <class T> inline void ClearPersistent(v8::Persistent<T>& handle) { if (handle.IsEmpty()) return; handle.Dispose(); handle.Clear(); }
void WeakHandleListener<DOMWrapperWorld>::callback(v8::Isolate* isolate, v8::Persistent<v8::Value> object, DOMWrapperWorld* world) { object.Dispose(isolate); object.Clear(); world->deref(); }
static void make_weak_callback(v8::Persistent<v8::Value> object, void *parameter) { object.Dispose(); // if there is no reference from js, surelly this can be disposed. object.Clear(); }
void WeakHandleListener<InjectedScriptManager, InjectedScriptHost>::callback(v8::Isolate* isolate, v8::Persistent<v8::Value> object, InjectedScriptHost* host) { host->deref(); object.Dispose(isolate); object.Clear(); }