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

--HG--
extra : transplant_source : %16%16%92s%8C%B1%AC%8AT%23%DF%DD%A0%B7RH%84C%A7%3A
This commit is contained in:
Benjamin Smedberg 2010-01-22 10:05:29 -05:00
Родитель aff9b49ce6
Коммит 7f5a470794
3 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;

Просмотреть файл

@ -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.