Changeset 101993 in vbox
- Timestamp:
- Nov 8, 2023 5:44:34 PM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/threads/nsEventQueue.cpp
r1 r101993 46 46 #include "nsString.h" 47 47 48 #include "prlog.h"49 50 48 #ifdef NS_DEBUG 51 49 #include "prprf.h" 52 50 #endif 53 51 54 #if defined(PR_LOGGING) && defined(DEBUG_danm) 55 /* found these logs useful in conjunction with netlibStreamEvent logging 56 from netwerk. */ 57 PRLogModuleInfo* gEventQueueLog = 0; 58 PRUint32 gEventQueueLogCount = 0; 59 PRUint32 gEventQueueLogPPCount = 0; 60 static int gEventQueueLogPPLevel = 0; 61 static PLEventQueue *gEventQueueLogQueue = 0; 62 static PRThread *gEventQueueLogThread = 0; 63 #endif 52 #include <VBox/log.h> 64 53 65 54 // in a real system, these would be members in a header class... … … 113 102 */ 114 103 115 #if defined(PR_LOGGING) && defined(DEBUG_danm) 116 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 117 ("EventQueue: Created [queue=%lx]",(long)mEventQueue)); 118 ++gEventQueueLogCount; 119 #endif 104 Log(("EventQueue: Created [queue=%lx]\n",(long)mEventQueue)); 120 105 121 106 mYoungerQueue = nsnull; … … 129 114 Unlink(); 130 115 131 #if defined(PR_LOGGING) && defined(DEBUG_danm) 132 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 133 ("EventQueue: Destroyed [queue=%lx]",(long)mEventQueue)); 134 ++gEventQueueLogCount; 135 #endif 116 Log(("EventQueue: Destroyed [queue=%lx]\n",(long)mEventQueue)); 136 117 137 118 if (mEventQueue) { … … 207 188 mAcceptingEvents = PR_FALSE; 208 189 CheckForDeactivation(); 209 #if defined(PR_LOGGING) && defined(DEBUG_danm) 210 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 211 ("EventQueue: StopAccepting [queue=%lx, accept=%d, could=%d]", 212 (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents)); 213 ++gEventQueueLogCount; 214 #endif 190 191 Log(("EventQueue: StopAccepting [queue=%lx, accept=%d, could=%d]\n", 192 (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents)); 215 193 return NS_OK; 216 194 } … … 246 224 { 247 225 if (!mAcceptingEvents) { 248 #if defined(PR_LOGGING) && defined(DEBUG_danm) 249 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 250 ("EventQueue: Punt posted event [queue=%lx, accept=%d, could=%d]", 226 227 Log(("EventQueue: Punt posted event [queue=%lx, accept=%d, could=%d]\n", 251 228 (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents)); 252 ++gEventQueueLogCount; 253 #endif 229 254 230 nsresult rv = NS_ERROR_FAILURE; 255 231 NS_ASSERTION(mElderQueue, "event dropped because event chain is dead"); … … 261 237 return rv; 262 238 } 263 #if defined(PR_LOGGING) && defined(DEBUG_danm) 264 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 265 ("EventQueue: Posting event [queue=%lx]", (long)mEventQueue)); 266 ++gEventQueueLogCount; 267 #endif 239 240 Log(("EventQueue: Posting event [queue=%lx]\n", (long)mEventQueue)); 268 241 return PL_PostEvent(mEventQueue, aEvent) == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE; 269 242 } … … 273 246 { 274 247 if (!mAcceptingEvents) { 275 #if defined(PR_LOGGING) && defined(DEBUG_danm) 276 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 277 ("EventQueue: Punt posted synchronous event [queue=%lx, accept=%d, could=%d]", 248 Log(("EventQueue: Punt posted synchronous event [queue=%lx, accept=%d, could=%d]\n", 278 249 (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents)); 279 ++gEventQueueLogCount; 280 #endif 250 281 251 nsresult rv = NS_ERROR_NO_INTERFACE; 282 252 NS_ASSERTION(mElderQueue, "event dropped because event chain is dead"); … … 290 260 } 291 261 292 #if defined(PR_LOGGING) && defined(DEBUG_danm) 293 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 294 ("EventQueue: Posting synchronous event [queue=%lx]", (long)mEventQueue)); 295 ++gEventQueueLogCount; 296 #endif 262 Log(("EventQueue: Posting synchronous event [queue=%lx]\n", (long)mEventQueue)); 297 263 void* result = PL_PostSynchronousEvent(mEventQueue, aEvent); 298 264 if (aResult) … … 377 343 if (!correctThread) 378 344 return NS_ERROR_FAILURE; 379 #if defined(PR_LOGGING) && defined(DEBUG_danm) 380 ++gEventQueueLogPPLevel; 381 if ((gEventQueueLogQueue != mEventQueue || gEventQueueLogThread != PR_GetCurrentThread() || 382 gEventQueueLogCount != gEventQueueLogPPCount) && gEventQueueLogPPLevel == 1) { 383 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 384 ("EventQueue: Process pending [queue=%lx, accept=%d, could=%d]", 385 (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents)); 386 gEventQueueLogPPCount = ++gEventQueueLogCount; 387 gEventQueueLogQueue = mEventQueue; 388 gEventQueueLogThread = PR_GetCurrentThread(); 389 } 390 #endif 345 346 Log(("EventQueue: Process pending [queue=%lx, accept=%d, could=%d]\n", 347 (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents)); 391 348 PL_ProcessPendingEvents(mEventQueue); 392 349 … … 403 360 elder->ProcessPendingEvents(); 404 361 } 405 #if defined(PR_LOGGING) && defined(DEBUG_danm) 406 --gEventQueueLogPPLevel; 407 #endif 362 408 363 return NS_OK; 409 364 } … … 446 401 return NS_ERROR_FAILURE; 447 402 448 #if defined(PR_LOGGING) && defined(DEBUG_danm) 449 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 450 ("EventQueue: handle event [queue=%lx, accept=%d, could=%d]", 451 (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents)); 452 ++gEventQueueLogCount; 453 #endif 403 Log(("EventQueue: handle event [queue=%lx, accept=%d, could=%d]\n", 404 (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents)); 405 454 406 PL_HandleEvent(aEvent); 455 407 return NS_OK; … … 464 416 return NS_ERROR_FAILURE; 465 417 466 #if defined(PR_LOGGING) && defined(DEBUG_danm) 467 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 468 ("EventQueue: wait for event [queue=%lx, accept=%d, could=%d]", 418 Log(("EventQueue: wait for event [queue=%lx, accept=%d, could=%d]\n", 469 419 (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents)); 470 ++gEventQueueLogCount; 471 #endif 420 472 421 *aResult = PL_WaitForEvent(mEventQueue); 473 422 CheckForDeactivation(); … … 547 496 old = mElderQueue; 548 497 549 #if defined(PR_LOGGING) && defined(DEBUG_danm) 550 PR_LOG(gEventQueueLog, PR_LOG_DEBUG, 551 ("EventQueue: unlink [queue=%lx, younger=%lx, elder=%lx]", 552 (long)mEventQueue,(long)mYoungerQueue, (long)mElderQueue.get())); 553 ++gEventQueueLogCount; 554 #endif 498 Log(("EventQueue: unlink [queue=%lx, younger=%lx, elder=%lx]\n", 499 (long)mEventQueue,(long)mYoungerQueue, (long)mElderQueue.get())); 555 500 556 501 // this is probably OK, but shouldn't happen by design, so tell me if it does
Note:
See TracChangeset
for help on using the changeset viewer.