Lines Matching defs:npObject
263 NPObject *_NPN_CreateObject(NPP npp, NPClass* npClass)
268 NPObject* npObject;
270 npObject = npClass->allocate(npp, npClass);
272 npObject = reinterpret_cast<NPObject*>(malloc(sizeof(NPObject)));
274 npObject->_class = npClass;
275 npObject->referenceCount = 1;
276 return npObject;
282 NPObject* _NPN_RetainObject(NPObject* npObject)
284 ASSERT(npObject);
285 ASSERT(npObject->referenceCount > 0);
287 if (npObject)
288 npObject->referenceCount++;
290 return npObject;
296 void _NPN_DeallocateObject(NPObject* npObject)
298 ASSERT(npObject);
300 if (npObject) {
305 if (_NPN_IsAlive(npObject))
306 _NPN_UnregisterObject(npObject);
308 npObject->referenceCount = -1;
309 if (npObject->_class->deallocate)
310 npObject->_class->deallocate(npObject);
312 free(npObject);
320 void NPN_ReleaseObject(NPObject *obj)
325 void _NPN_ReleaseObject(NPObject* npObject)
327 ASSERT(npObject);
328 ASSERT(npObject->referenceCount >= 1);
330 if (npObject && npObject->referenceCount >= 1) {
331 if (!--npObject->referenceCount)
332 _NPN_DeallocateObject(npObject);
348 // JS needs to be able to quickly lookup a given NPObject to determine
363 typedef WTF::HashSet<NPObject*> NPObjectSet;
364 typedef WTF::HashMap<NPObject*, NPObject*> NPObjectMap;
365 typedef WTF::HashMap<NPObject*, NPObjectSet*> NPRootObjectMap;
374 void _NPN_RegisterObject(NPObject* npObject, NPObject* owner)
376 ASSERT(npObject);
379 if (liveObjectMap.find(npObject) != liveObjectMap.end())
384 ASSERT(rootObjectMap.find(npObject) == rootObjectMap.end());
385 rootObjectMap.set(npObject, new NPObjectSet());
390 NPObject* parent = 0;
396 ASSERT(rootObjectMap.find(npObject) == rootObjectMap.end());
398 rootObjectMap.get(owner)->add(npObject);
401 ASSERT(liveObjectMap.find(npObject) == liveObjectMap.end());
402 liveObjectMap.set(npObject, owner);
405 void _NPN_UnregisterObject(NPObject* npObject)
407 ASSERT(npObject);
408 ASSERT(liveObjectMap.find(npObject) != liveObjectMap.end());
410 NPObject* owner = 0;
411 if (liveObjectMap.find(npObject) != liveObjectMap.end())
412 owner = liveObjectMap.find(npObject)->second;
416 ASSERT(rootObjectMap.find(npObject) != rootObjectMap.end());
417 NPObjectSet* set = rootObjectMap.get(npObject);
422 NPObject* sub_object = *(set->begin());
436 rootObjectMap.remove(npObject);
441 ASSERT(list->find(npObject) != list->end());
442 list->remove(npObject);
446 liveObjectMap.remove(npObject);
447 forgetV8ObjectForNPObject(npObject);
450 bool _NPN_IsAlive(NPObject* npObject)
452 return liveObjectMap.find(npObject) != liveObjectMap.end();