Changeset 5522 in vbox for trunk/src/libs
- Timestamp:
- Oct 26, 2007 5:21:00 PM (17 years ago)
- Location:
- trunk/src/libs/xpcom18a4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/client/src/ipcdclient.cpp
r3373 r5522 1198 1198 td->pendingQ.Append(msg); 1199 1199 1200 LOG(("placed message on pending queue for target %s and notifying all...\n", target.ToString())); 1200 #ifdef IPC_LOGGING 1201 { 1202 char *targetStr = target.ToString(); 1203 LOG(("placed message on pending queue for target %s and notifying all...\n", targetStr)); 1204 nsMemory::Free(targetStr); 1205 } 1206 #endif 1201 1207 1202 1208 // wake up anyone waiting on this queue … … 1277 1283 nsAutoMonitor mon(gClientState->monitor); 1278 1284 gClientState->targetMap.EnumerateRead(EnumerateTargetMapAndPlaceMsg, msg); 1285 1286 delete msg; 1279 1287 1280 1288 return; -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp
r4863 r5522 122 122 // dconnect minor opcodes for INVOKE 123 123 124 #pragma pack(1) 125 124 126 struct DConnectOp 125 127 { … … 186 188 // (see ipcDConnectService::SerializeException) 187 189 }; 190 191 #pragma pack() 188 192 189 193 //----------------------------------------------------------------------------- … … 471 475 case nsXPTType::T_IID: 472 476 { 473 nsID *buf = (nsID *) malloc(sizeof(nsID));477 nsID *buf = (nsID *) nsMemory::Alloc(sizeof(nsID)); 474 478 reader.GetBytes(buf, sizeof(nsID)); 475 479 v.val.p = v.ptr = buf; … … 489 493 else 490 494 { 491 char *buf = (char *) malloc(len + 1);495 char *buf = (char *) nsMemory::Alloc(len + 1); 492 496 reader.GetBytes(buf, len); 493 497 buf[len] = char(0); … … 510 514 else 511 515 { 512 PRUnichar *buf = (PRUnichar *) malloc(len + 2);516 PRUnichar *buf = (PRUnichar *) nsMemory::Alloc(len + 2); 513 517 reader.GetBytes(buf, len); 514 518 buf[len / 2] = PRUnichar(0); … … 621 625 v.type = t; 622 626 v.flags = nsXPTCVariant::PTR_IS_DATA; 627 628 // nsID, string and wstring types are not understood as dippers (see 629 // DIPPER_TYPE in xpidl.h) but they behave like dippers too. Therefore we 630 // need to treat them so manually. 631 switch (t.TagPart()) 632 { 633 case nsXPTType::T_IID: 634 case nsXPTType::T_CHAR_STR: 635 case nsXPTType::T_WCHAR_STR: 636 // add VAL_IS_ALLOCD to cause FinishParam() to do cleanup 637 v.flags |= nsXPTCVariant::VAL_IS_ALLOCD; 638 break; 639 default: 640 break; 641 } 623 642 } 624 643 … … 633 652 634 653 if (v.IsValAllocated()) 635 free(v.val.p);654 nsMemory::Free(v.val.p); 636 655 else if (v.IsValInterface()) 637 656 ((nsISupports *) v.val.p)->Release(); … … 1786 1805 1787 1806 // check if this object is nsISupports itself 1788 nsIID *iid = 0; 1789 rv = mIInfo->GetInterfaceIID(&iid); 1790 NS_ASSERTION(NS_SUCCEEDED(rv) && iid, 1791 "nsIInterfaceInfo::GetInterfaceIID failed"); 1792 if (NS_SUCCEEDED(rv) && iid && 1793 iid->Equals(NS_GET_IID(nsISupports))) 1794 { 1795 // nsISupports is queried on nsISupports, return ourselves 1796 *aInstancePtr = this; 1797 NS_ADDREF_THIS(); 1798 // cache ourselves weakly 1799 mCachedISupports = this; 1800 1801 PR_Unlock(dConnect->StubQILock()); 1802 return NS_OK; 1807 { 1808 nsIID *iid = 0; 1809 rv = mIInfo->GetInterfaceIID(&iid); 1810 NS_ASSERTION(NS_SUCCEEDED(rv) && iid, 1811 "nsIInterfaceInfo::GetInterfaceIID failed"); 1812 if (NS_SUCCEEDED(rv) && iid && 1813 iid->Equals(NS_GET_IID(nsISupports))) 1814 { 1815 nsMemory::Free((void*)iid); 1816 1817 // nsISupports is queried on nsISupports, return ourselves 1818 *aInstancePtr = this; 1819 NS_ADDREF_THIS(); 1820 // cache ourselves weakly 1821 mCachedISupports = this; 1822 1823 PR_Unlock(dConnect->StubQILock()); 1824 return NS_OK; 1825 } 1826 if (iid) 1827 nsMemory::Free((void*)iid); 1803 1828 } 1804 1829 -
trunk/src/libs/xpcom18a4/xpcom/base/nsExceptionService.cpp
r1 r5522 84 84 #ifdef NS_DEBUG 85 85 inline nsrefcnt ReleaseQuiet() { 86 nsAutoOwningThread old = _mOwningThread; 87 _mOwningThread = nsAutoOwningThread(); 88 nsrefcnt ref = Release(); 86 // shut up NS_ASSERT_OWNINGTHREAD (see explaination below) 87 nsAutoOwningThread old = _mOwningThread; 88 _mOwningThread = nsAutoOwningThread(); 89 nsrefcnt ref = Release(); 90 NS_ASSERTION(ref == 0, "the object is still referenced by other threads while it shouldn't"); 91 if (ref != 0) 89 92 _mOwningThread = old; 90 93 return ref; 91 94 } 92 95 #else … … 103 106 #endif 104 107 105 // Note this object is single threaded - the service itself ensures 106 // one per thread. 107 // Exceptions are DropAllThreads (called on the thread shutting down xpcom) 108 // and ThreadDestruct (called after xpcom destroyed the internal thread struct, 109 // so that PR_GetCurrentThread() will create a new one from scratch which will 110 // obviously not match the old one stored in the instance on creation). Since 111 // these NS_CheckThreadSafe() assertions are quite annoying in the debug build, 112 // we use a special ReleaseQuiet() mehtod in DoDropThread() to shut them up. 108 // Note: the nsExceptionManager object is single threaded - the exception 109 // service itself ensures one per thread. However, there are two methods that 110 // may be called on foreign threads: DropAllThreads (called on the thread 111 // shutting down xpcom) and ThreadDestruct (called after xpcom destroyed the 112 // internal thread struct, so that PR_GetCurrentThread() will create a new one 113 // from scratch which will obviously not match the old one stored in the 114 // instance on creation). In both cases, there should be no other threads 115 // holding objects (i.e. it's thread-safe to call them), but 116 // NS_CheckThreadSafe() assertions will still happen and yell in the debug 117 // build. Since it is quite annoying, we use a special ReleaseQuiet() mehtod 118 // in DoDropThread() to shut them up. 113 119 NS_IMPL_ISUPPORTS1(nsExceptionManager, nsIExceptionManager) 114 120 -
trunk/src/libs/xpcom18a4/xpcom/glue/nsDebug.cpp
r1 r5522 44 44 static nsIDebug* gDebugObject = nsnull; 45 45 46 // Note: Although the machinery here is similar to nsMemory.cpp, we cannot use 47 // NS_ASSERTION macros below because they end up in nsDebug::Assertion and 48 // therefore may produce endless recursion. 49 46 50 static NS_METHOD FreeDebugObject(void) 47 51 { … … 55 59 static nsIDebug* SetupDebugObject() 56 60 { 57 NS_GetDebug(&gDebugObject); 58 if (gDebugObject) 59 NS_RegisterXPCOMExitRoutine(FreeDebugObject, 0); 61 if (!gDebugObject) 62 { 63 NS_GetDebug(&gDebugObject); 64 if (gDebugObject) 65 NS_RegisterXPCOMExitRoutine(FreeDebugObject, 0); 66 } 60 67 return gDebugObject; 61 68 } … … 64 71 nsresult GlueStartupDebug() 65 72 { 66 NS_GetDebug(&gDebugObject); 67 if (!gDebugObject) 68 return NS_ERROR_FAILURE; 73 if (!gDebugObject) 74 { 75 NS_GetDebug(&gDebugObject); 76 if (!gDebugObject) 77 return NS_ERROR_FAILURE; 78 } 69 79 return NS_OK; 70 80 } -
trunk/src/libs/xpcom18a4/xpcom/glue/nsMemory.cpp
r1 r5522 44 44 static NS_METHOD FreeGlobalMemory(void) 45 45 { 46 NS_ASSERTION(gMemory, "must be not null after SetupGlobalMemory"); 46 47 NS_IF_RELEASE(gMemory); 47 48 return NS_OK; … … 54 55 SetupGlobalMemory() 55 56 { 56 NS_ASSERTION(!gMemory, "bad call"); 57 NS_GetMemoryManager(&gMemory); 58 NS_ASSERTION(gMemory, "can't get memory manager!"); 59 NS_RegisterXPCOMExitRoutine(FreeGlobalMemory, 0); 57 NS_ASSERTION(!gMemory, "must be called once"); 58 if (!gMemory) 59 { 60 NS_GetMemoryManager(&gMemory); 61 NS_ASSERTION(gMemory, "can't get memory manager!"); 62 if (gMemory) 63 NS_RegisterXPCOMExitRoutine(FreeGlobalMemory, 0); 64 } 60 65 return gMemory; 61 66 } … … 64 69 nsresult GlueStartupMemory() 65 70 { 66 NS_ASSERTION(!gMemory, "bad call"); 67 NS_GetMemoryManager(&gMemory); 68 NS_ASSERTION(gMemory, "can't get memory manager!"); 71 NS_ASSERTION(!gMemory, "must be called once"); 72 if (!gMemory) 73 { 74 NS_GetMemoryManager(&gMemory); 75 NS_ASSERTION(gMemory, "can't get memory manager!"); 76 if (!gMemory) 77 return NS_ERROR_FAILURE; 78 } 69 79 return NS_OK; 70 80 }
Note:
See TracChangeset
for help on using the changeset viewer.