VirtualBox

Changeset 101942 in vbox for trunk/src/libs/xpcom18a4/xpcom


Ignore:
Timestamp:
Nov 7, 2023 1:50:07 PM (15 months ago)
Author:
vboxsync
Message:

libs/xpcom: Remove unused code in xcDll.{cpp,h}, bugref:10545

Location:
trunk/src/libs/xpcom18a4/xpcom/components
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/components/xcDll.cpp

    r101803 r101942  
    5757#include "nsModule.h"
    5858#ifdef DEBUG
    59 #if defined(VMS)
    60 #include <lib$routines.h>
    61 #include <ssdef.h>
    62 #elif defined(XP_MACOSX)
     59#if defined(XP_MACOSX)
    6360#include <signal.h>
    6461#endif
     
    6663
    6764#include "nsTraceRefcntImpl.h"
    68 
    69 #define UNLOAD_DEPENDENT_LIBS
    70 #ifdef HPUX
    71 #undef UNLOAD_DEPENDENT_LIBS
    72 #endif
    7365
    7466#include "nsNativeComponentLoader.h"
     
    149141    //   on the dependent libraries with the assumption that the
    150142    //   component library holds a reference via the OS so loader.
    151 
    152 #if defined(XP_UNIX)
    153143    nsCOMPtr<nsIComponentLoaderManager> manager = do_QueryInterface(m_loader->mCompMgr);
    154144    if (!manager)
     
    158148    manager->GetOptionalData(m_dllSpec, nsnull, getter_Copies(extraData));
    159149
    160 #ifdef UNLOAD_DEPENDENT_LIBS
    161150    nsVoidArray dependentLibArray;
    162 #endif
    163151
    164152    // if there was any extra data, treat it as a listing of dependent libs
     
    180168        file->AppendNative(NS_LITERAL_CSTRING("dummy"));
    181169
    182 # ifdef VBOX_USE_IPRT_IN_XPCOM
    183170        char *buffer = (char *)nsMemory::Clone(extraData, strlen(extraData) + 1);
    184 # else
    185         char *buffer = strdup(extraData);
    186 # endif
    187171        if (!buffer)
    188172            return NS_ERROR_OUT_OF_MEMORY;
     
    227211            // can.  Now just let us fail later if this really was a required
    228212            // dependency.
    229 #ifdef UNLOAD_DEPENDENT_LIBS
    230213            if (lib)
    231214                dependentLibArray.AppendElement((void*)lib);
    232 #endif
    233215
    234216            token = nsCRT::strtok(newStr, " ", &newStr);
    235217        }
    236 # ifdef VBOX_USE_IPRT_IN_XPCOM
    237218        nsMemory::Free(buffer);
    238 # else
    239         free(buffer);
    240 # endif
    241     }
    242 #endif
     219    }
    243220
    244221    // load the component
     
    247224    lf->Load(&m_instance);
    248225
    249 #if defined(XP_UNIX)
    250226    // Unload any of library dependencies we loaded earlier. The assumption
    251227    // here is that the component will have a "internal" reference count to
    252228    // the dependency library we just loaded.
    253229    // XXX should we unload later - or even at all?
    254 
    255 #ifdef UNLOAD_DEPENDENT_LIBS
    256230    if (extraData != nsnull)
    257231    {
     
    260234            PR_UnloadLibrary((PRLibrary*)dependentLibArray.ElementAt(index));
    261235    }
    262 #endif
    263 #endif
    264236
    265237#ifdef NS_BUILD_REFCNT_LOGGING
     
    275247    }
    276248
    277 #ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
    278     // Debugging help for components. Component dlls need to have their
    279     // symbols loaded before we can put a breakpoint in the debugger.
    280     // This will help figureing out the point when the dll was loaded.
    281     nsXPIDLCString displayPath;
    282     GetDisplayPath(displayPath);
    283     BreakAfterLoad(displayPath.get());
    284 #endif
    285 
    286249    return ((m_instance == NULL) ? PR_FALSE : PR_TRUE);
    287250}
     
    376339}
    377340
    378 
    379 // These are used by BreakAfterLoad, below.
    380 #ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
    381 static nsCString *sBreakList[16];
    382 static int sBreakListCount = 0;
    383 #endif
    384 
    385341nsresult nsDll::Shutdown(void)
    386342{
     
    392348        NS_ASSERTION(refcnt == 0, "Dll moduleObject refcount non zero");
    393349    }
    394 #ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
    395     for (int i = 0; i < sBreakListCount; i++)
    396     {
    397         delete sBreakList[i];
    398         sBreakList[i] = nsnull;
    399     }
    400     sBreakListCount = 0;
    401 #endif
     350
    402351    return NS_OK;
    403352
    404353}
    405 #ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
    406 void nsDll::BreakAfterLoad(const char *nsprPath)
    407 {
    408     static PRBool firstTime = PR_TRUE;
    409 
    410     // return if invalid input
    411     if (!nsprPath || !*nsprPath) return;
    412 
    413     // return if nothing to break on
    414     if (!firstTime && sBreakListCount == 0) return;
    415 
    416     if (firstTime)
    417     {
    418         firstTime = PR_FALSE;
    419         // Form the list of dlls to break on load
    420         nsCAutoString envList(getenv("XPCOM_BREAK_ON_LOAD"));
    421         if (envList.IsEmpty()) return;
    422         PRInt32 ofset = 0;
    423         PRInt32 start = 0;
    424         do
    425         {
    426             ofset = envList.FindChar(':', start);
    427             sBreakList[sBreakListCount] = new nsCString();
    428             envList.Mid(*(sBreakList[sBreakListCount]), start, ofset);
    429             sBreakListCount++;
    430             start = ofset + 1;
    431         }
    432         while (ofset != -1 && 16 > sBreakListCount); // avoiding vc6.0 compiler issue. count < thinks it is starting a template
    433     }
    434 
    435     // Find the dllname part of the string
    436     nsCString currentPath(nsprPath);
    437     PRInt32 lastSep = currentPath.RFindCharInSet(":\\/");
    438 
    439     for (int i=0; i<sBreakListCount; i++)
    440         if (currentPath.Find(*(sBreakList[i]), PR_TRUE, lastSep) > 0)
    441         {
    442             // Loading a dll that we want to break on
    443             // Put your breakpoint here
    444             fprintf(stderr, "...Loading module %s\n", nsprPath);
    445             // Break in the debugger here.
    446 #if defined(__i386) && defined(__GNUC__)
    447             asm("int $3");
    448 #elif defined(VMS)
    449             lib$signal(SS$_DEBUG);
    450 #elif defined(XP_MACOSX)
    451             raise(SIGTRAP);
    452 #endif
    453         }
    454     return;
    455 }
    456 #endif /* SHOULD_IMPLEMENT_BREAKAFTERLOAD */
     354
  • trunk/src/libs/xpcom18a4/xpcom/components/xcDll.h

    r1 r101942  
    5656class nsNativeComponentLoader;
    5757
    58 #if defined(DEBUG) && !defined(XP_BEOS)
    59 #define SHOULD_IMPLEMENT_BREAKAFTERLOAD
    60 #endif
    61 
    6258class nsIModule;
    6359class nsIServiceManager;
     
    8278
    8379    void Init(nsIFile *dllSpec);
    84 
    85 #ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
    86     void BreakAfterLoad(const char *nsprPath);
    87 #endif
    8880
    8981public:
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