Bug 540858 part I: separate the refcount logging of NPObject (which works for both plugin and proxy NPObject) from ctor/dtor logging of ChildNPObject (proxy only), r=bent

This commit is contained in:
Benjamin Smedberg 2010-01-22 10:05:29 -05:00
parent 73a1d2211e
commit 1fc18fe407
3 changed files with 13 additions and 5 deletions

View File

@ -1067,7 +1067,7 @@ _createobject(NPP aNPP,
if (newObject) {
newObject->_class = aClass;
newObject->referenceCount = 1;
NS_LOG_ADDREF(newObject, 1, "ChildNPObject", sizeof(NPObject));
NS_LOG_ADDREF(newObject, 1, "NPObject", sizeof(NPObject));
}
return newObject;
}
@ -1078,7 +1078,7 @@ _retainobject(NPObject* aNPObj)
AssertPluginThread();
int32_t refCnt = PR_AtomicIncrement((PRInt32*)&aNPObj->referenceCount);
NS_LOG_ADDREF(aNPObj, refCnt, "ChildNPObject", sizeof(NPObject));
NS_LOG_ADDREF(aNPObj, refCnt, "NPObject", sizeof(NPObject));
return aNPObj;
}
@ -1089,7 +1089,7 @@ _releaseobject(NPObject* aNPObj)
AssertPluginThread();
int32_t refCnt = PR_AtomicDecrement((PRInt32*)&aNPObj->referenceCount);
NS_LOG_RELEASE(aNPObj, refCnt, "ChildNPObject");
NS_LOG_RELEASE(aNPObj, refCnt, "NPObject");
if (refCnt == 0) {
if (aNPObj->_class && aNPObj->_class->deallocate) {

View File

@ -535,7 +535,7 @@ PluginScriptableObjectChild::CreateProxyObject()
// own this actor. Set the reference count to 0 here so that when the object
// dies we will send the destructor message to the child.
object->referenceCount = 0;
NS_LOG_RELEASE(object, 0, "ChildNPObject");
NS_LOG_RELEASE(object, 0, "NPObject");
object->parent = const_cast<PluginScriptableObjectChild*>(this);
return object;

View File

@ -52,7 +52,15 @@ class PluginScriptableObjectChild;
struct ChildNPObject : NPObject
{
ChildNPObject()
: NPObject(), parent(NULL), invalidated(false) { }
: NPObject(), parent(NULL), invalidated(false)
{
MOZ_COUNT_CTOR(ChildNPObject);
}
~ChildNPObject()
{
MOZ_COUNT_DTOR(ChildNPObject);
}
// |parent| is always valid as long as the actor is alive. Once the actor is
// destroyed this will be set to null.