Esempio n. 1
0
void StringCache::setWeakCallback(const v8::WeakCallbackData<v8::String, StringImpl>& data)
{
    StringCache* stringCache = V8PerIsolateData::from(data.GetIsolate())->stringCache();
    stringCache->m_lastStringImpl = 0;
    stringCache->m_lastV8String.clear();
    ASSERT(stringCache->m_stringCache.contains(data.GetParameter()));
    stringCache->m_stringCache.get(data.GetParameter()).dispose();
    stringCache->m_stringCache.remove(data.GetParameter());
    data.GetParameter()->deref();
}
/* ---------------------------------  CJS_Object --------------------------------- */
void  FreeObject(const v8::WeakCallbackData<v8::Object, CJS_Object>& data)
{
	CJS_Object* pJSObj  = data.GetParameter();
	if(pJSObj)
	{
		pJSObj->ExitInstance();
		delete pJSObj;
	}
	v8::Local<v8::Object> obj = data.GetValue();
	JS_FreePrivate(obj);
}
Esempio n. 3
0
    void JSZCluster::weakCallback(const v8::WeakCallbackData<v8::Object, JSZCluster> &data) {

        JSZCluster *This = data.GetParameter();
        Local<Object> value = data.GetValue();

        Local<External> wrap = Local<External>::Cast(value->GetInternalField(1));
        Cluster *cluster = (Cluster *) wrap->Value();

        NwkAddr nwkAddress = cluster->getNetworkAddress();
        EndpointID endpointId = cluster->getEndpoint();
        ClusterID clusterId = cluster->getId();

        Key key(nwkAddress, endpointId, clusterId);

        This->usedCluster.erase(key);
    }
Esempio n. 4
0
void NaObject::WeakCallback(
	const v8::WeakCallbackData<v8::Object, NaObject>& data
	)
{
	NaObject *pObject = data.GetParameter();
	if (pObject)
	{
		pObject->Release();
	}
}
Esempio n. 5
0
void nj::JSAlloc::CollectWeak(const v8::WeakCallbackData<v8::Object,JSAlloc> &data)
{
   JSAlloc *L = data.GetParameter();

   if(L)
   {
      if(L->_container) L->_container->free();
      else L->free();
   }
}
static void WeakCollectionCallback (const v8::WeakCallbackData<v8::External, v8::Persistent<v8::External>>& data) {
  auto isolate      = data.GetIsolate();
  auto persistent   = data.GetParameter();
  auto myCollection = v8::Local<v8::External>::New(isolate, *persistent);
  auto collection   = static_cast<TRI_vocbase_col_t*>(myCollection->Value());
  TRI_GET_GLOBALS();

  v8g->_hasDeadObjects = true;

  // decrease the reference-counter for the database
  TRI_ReleaseVocBase(collection->_vocbase);

  // find the persistent handle
#if TRI_ENABLE_MAINTAINER_MODE
  map<void*, v8::Persistent<v8::External>>::iterator it = v8g->JSCollections.find(collection);
  TRI_ASSERT(it != v8g->JSCollections.end())
#endif
  if (! collection->_isLocal) {
    FreeCoordinatorCollection(collection);
  }
  // dispose and clear the persistent handle
  v8g->JSCollections[collection].Reset();
  v8g->JSCollections.erase(collection);
}
Esempio n. 7
0
static void weakCallback(const v8::WeakCallbackData<v8::Context, ScriptState>& data)
{
    data.GetValue()->SetAlignedPointerInEmbedderData(v8ContextPerContextDataIndex, 0);
    data.GetParameter()->clearContext();
    data.GetParameter()->deref();
}
Esempio n. 8
0
void Response::WeakCallback(const v8::WeakCallbackData<v8::Object, Response>& data) {
  Response* pThis = data.GetParameter();
  (pThis->self_).Reset();
  delete pThis;
}
static void clearHandle(const v8::WeakCallbackData<v8::Object, ScopedPersistent<v8::Object> >& data)
{
    data.GetParameter()->clear();
}
void CanvasRenderingContext2D::DeallocateBuffer(const v8::WeakCallbackData<v8::ArrayBuffer, char>& data)
{
	delete[] data.GetParameter();
}
void V8AbstractEventListener::setWeakCallback(const v8::WeakCallbackData<v8::Object, V8AbstractEventListener> &data)
{
    data.GetParameter()->m_listener.clear();
}
Esempio n. 12
0
void InjectedScriptManager::setWeakCallback(const v8::WeakCallbackData<v8::Object, InjectedScriptManager::CallbackData>& data)
{
    InjectedScriptManager::CallbackData* callbackData = data.GetParameter();
    callbackData->injectedScriptManager->removeCallbackData(callbackData);
}
// Callback for V8 letting us know the JavaScript object is no longer reachable.
// Once we receive this callback we can safely release our strong reference
// on the wrapped Java object so it can become eligible for collection.
static void DetachCallback(const v8::WeakCallbackData<v8::Object, JavaObject>& data)
{
	JavaObject* javaObject = data.GetParameter();
	javaObject->detach();
}
static void weakCallback(const v8::WeakCallbackData<T, ScopedPersistent<T> >& data)
{
    data.GetParameter()->clear();
}
void V8NodeFilterCondition::setWeakCallback(const v8::WeakCallbackData<v8::Value, V8NodeFilterCondition>& data)
{
    data.GetParameter()->m_filter.clear();
}
Esempio n. 16
0
void InjectedScriptManager::setWeakCallback(const v8::WeakCallbackData<v8::Object, InjectedScriptManager::CallbackData>& data)
{
    data.GetParameter()->handle.clear();
    data.GetParameter()->host.clear();
    delete data.GetParameter();
}
Esempio n. 17
0
void DOMWrapperWorld::weakCallbackForDOMObjectHolder(const v8::WeakCallbackData<v8::Value, DOMObjectHolderBase>& data)
{
    DOMObjectHolderBase* holderBase = data.GetParameter();
    holderBase->world()->unregisterDOMObjectHolder(holderBase);
}
Esempio n. 18
0
void V8MutationCallback::setWeakCallback(const v8::WeakCallbackData<v8::Function, V8MutationCallback>& data)
{
    data.GetParameter()->m_callback.clear();
}
void CanvasRenderingContext2D::Deallocate(const v8::WeakCallbackData<v8::Object, CanvasRenderingContext2D>& data)
{
	__android_log_print(ANDROID_LOG_DEBUG, "C2D", "DEALLOCATING!");
	delete data.GetParameter();
}