VirtualBox

Changeset 101993 in vbox


Ignore:
Timestamp:
Nov 8, 2023 5:44:34 PM (15 months ago)
Author:
vboxsync
Message:

libs/xpcom: Convert nsEventQueue.cpp from PR_LOG to IPRT's logging infrastructure, bugref:10545

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/threads/nsEventQueue.cpp

    r1 r101993  
    4646#include "nsString.h"
    4747
    48 #include "prlog.h"
    49 
    5048#ifdef NS_DEBUG
    5149#include "prprf.h"
    5250#endif
    5351
    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>
    6453
    6554// in a real system, these would be members in a header class...
     
    113102  */
    114103
    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));
    120105
    121106  mYoungerQueue = nsnull;
     
    129114  Unlink();
    130115
    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));
    136117
    137118  if (mEventQueue) {
     
    207188  mAcceptingEvents = PR_FALSE;
    208189  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));
    215193  return NS_OK;
    216194}
     
    246224{
    247225  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",
    251228         (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents));
    252   ++gEventQueueLogCount;
    253 #endif
     229
    254230    nsresult rv = NS_ERROR_FAILURE;
    255231    NS_ASSERTION(mElderQueue, "event dropped because event chain is dead");
     
    261237    return rv;
    262238  }
    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));
    268241  return PL_PostEvent(mEventQueue, aEvent) == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE;
    269242}
     
    273246{
    274247  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",
    278249         (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents));
    279   ++gEventQueueLogCount;
    280 #endif
     250
    281251    nsresult rv = NS_ERROR_NO_INTERFACE;
    282252    NS_ASSERTION(mElderQueue, "event dropped because event chain is dead");
     
    290260  }
    291261
    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));
    297263  void* result = PL_PostSynchronousEvent(mEventQueue, aEvent);
    298264  if (aResult)
     
    377343  if (!correctThread)
    378344    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));
    391348  PL_ProcessPendingEvents(mEventQueue);
    392349
     
    403360      elder->ProcessPendingEvents();
    404361  }
    405 #if defined(PR_LOGGING) && defined(DEBUG_danm)
    406   --gEventQueueLogPPLevel;
    407 #endif
     362
    408363  return NS_OK;
    409364}
     
    446401    return NS_ERROR_FAILURE;
    447402
    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
    454406  PL_HandleEvent(aEvent);
    455407  return NS_OK;
     
    464416      return NS_ERROR_FAILURE;
    465417
    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",
    469419         (long)mEventQueue,(int)mAcceptingEvents,(int)mCouldHaveEvents));
    470   ++gEventQueueLogCount;
    471 #endif
     420
    472421    *aResult = PL_WaitForEvent(mEventQueue);
    473422    CheckForDeactivation();
     
    547496                                old = mElderQueue;
    548497
    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()));
    555500
    556501  // 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.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette