Changeset 109067 in vbox
- Timestamp:
- Apr 24, 2025 10:08:54 AM (4 weeks ago)
- svn:sync-xref-src-repo-rev:
- 168604
- Location:
- trunk/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxFB/VBoxFB.cpp
r106061 r109067 153 153 #if 0 154 154 nsCOMPtr<nsIServiceManager> serviceManager; 155 rc = NS_InitXPCOM2 (getter_AddRefs(serviceManager), nsnull, nsnull);155 rc = NS_InitXPCOM2Ex(getter_AddRefs(serviceManager), nsnull, nsnull, NS_INIT_XPCOM_F_AUTO_REGISTER_COMPONENTS_WITH_STATUS); 156 156 if (NS_FAILED(rc)) 157 157 { … … 159 159 exit(-1); 160 160 } 161 162 // register our component163 nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(serviceManager);164 if (!registrar)165 {166 printf("Error: could not query nsIComponentRegistrar interface!\n");167 exit(-1);168 }169 registrar->AutoRegister(nsnull);170 161 171 162 /* -
trunk/src/VBox/Main/glue/initterm.cpp
r107362 r109067 168 168 nsIFile **aRetval) 169 169 { 170 nsCOMPtr <nsILocalFile> localFile;171 nsresult rv = NS_ERROR_FAILURE;172 173 170 *aRetval = nsnull; 174 171 *aPersistent = PR_TRUE; 175 172 176 const char *fileLocation = NULL; 177 173 const char *fileLocation; 178 174 if (strcmp(aProp, NS_XPCOM_COMPONENT_REGISTRY_FILE) == 0) 179 175 fileLocation = mCompRegLocation; … … 187 183 return NS_ERROR_FAILURE; 188 184 189 rv = NS_NewNativeLocalFile(nsEmbedCString(fileLocation), 190 PR_TRUE, getter_AddRefs(localFile)); 185 nsCOMPtr<nsILocalFile> localFile; 186 nsresult rv = NS_NewNativeLocalFile(nsEmbedCString(fileLocation), 187 PR_TRUE, getter_AddRefs(localFile)); 191 188 if (NS_FAILED(rv)) 192 189 return rv; … … 705 702 break; 706 703 707 /* Setup the application path for NS_InitXPCOM2 . Note that we properly704 /* Setup the application path for NS_InitXPCOM2Ex. Note that we properly 708 705 * answer the NS_XPCOM_CURRENT_PROCESS_DIR query in our directory 709 706 * service provider but it seems to be activated after the directory 710 * service is used for the first time (see the source NS_InitXPCOM2 ). So707 * service is used for the first time (see the source NS_InitXPCOM2Ex). So 711 708 * use the same value here to be on the safe side. */ 712 709 nsCOMPtr <nsIFile> appDir; … … 737 734 { 738 735 nsCOMPtr<nsIServiceManager> serviceManager; 739 hrc = NS_InitXPCOM2(getter_AddRefs(serviceManager), appDir, dsProv); 736 hrc = NS_InitXPCOM2Ex(getter_AddRefs(serviceManager), appDir, dsProv, 737 NS_INIT_XPCOM_F_AUTO_REGISTER_COMPONENTS_WITH_STATUS); 740 738 if (NS_SUCCEEDED(hrc)) 741 739 { 742 nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(serviceManager, &hrc); 743 if (NS_SUCCEEDED(hrc)) 744 { 745 hrc = registrar->AutoRegister(nsnull); 746 if (NS_SUCCEEDED(hrc)) 747 { 748 /* We succeeded, stop probing paths */ 749 LogFlowFunc(("Succeeded.\n")); 750 break; 751 } 752 } 740 /* We succeeded, stop probing paths */ 741 LogFlowFunc(("Succeeded.\n")); 742 break; 753 743 } 754 744 } -
trunk/src/VBox/Main/testcase/tstVBoxAPIXPCOM.cpp
r108825 r109067 515 515 { 516 516 nsCOMPtr<nsIServiceManager> serviceManager; 517 rc = NS_InitXPCOM2 (getter_AddRefs(serviceManager), nsnull, nsnull);517 rc = NS_InitXPCOM2Ex(getter_AddRefs(serviceManager), nsnull, nsnull, 0); 518 518 if (NS_FAILED(rc)) 519 519 { … … 521 521 return -1; 522 522 } 523 524 #if 0525 /*526 * Register our components. This step is only necessary if this executable527 * implements XPCOM components itself which is not the case for this528 * simple example.529 */530 nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(serviceManager);531 if (!registrar)532 {533 printf("Error: could not query nsIComponentRegistrar interface!\n");534 return -1;535 }536 registrar->AutoRegister(nsnull);537 #endif538 523 539 524 /* -
trunk/src/libs/xpcom18a4/VBoxXPCOM.def
r106061 r109067 93 93 NS_GetTraceRefcnt 94 94 NS_IsXPCOMInitialized 95 NS_InitXPCOM2 95 NS_InitXPCOM2Ex 96 96 NS_MeanAndStdDev 97 97 NS_NewByteInputStream -
trunk/src/libs/xpcom18a4/ipc/ipcd/test/TestIPC.cpp
r1 r109067 196 196 { 197 197 nsCOMPtr<nsIServiceManager> servMan; 198 NS_InitXPCOM2 (getter_AddRefs(servMan), nsnull, nsnull);198 NS_InitXPCOM2Ex(getter_AddRefs(servMan), nsnull, nsnull, 0); 199 199 nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan); 200 200 NS_ASSERTION(registrar, "Null nsIComponentRegistrar"); -
trunk/src/libs/xpcom18a4/java/src/nsJavaInterfaces.cpp
r107722 r109067 212 212 // init XPCOM 213 213 nsCOMPtr<nsIServiceManager> servMan; 214 rv = NS_InitXPCOM2 (getter_AddRefs(servMan), directory, provider);214 rv = NS_InitXPCOM2Ex(getter_AddRefs(servMan), directory, provider, 0); 215 215 NS_ENSURE_SUCCESS(rv, rv); 216 216 217 // create Java proxy for service manager returned by NS_InitXPCOM2 217 // create Java proxy for service manager returned by NS_InitXPCOM2Ex 218 218 return NativeInterfaceToJavaObject(env, servMan, NS_GET_IID(nsIServiceManager), 219 219 nsnull, aResult); -
trunk/src/libs/xpcom18a4/python/src/dllmain.cpp
r103176 r109067 181 181 // not already initialized. 182 182 // Elsewhere, Mozilla can find it itself (we hope!) 183 nsresult rv = NS_InitXPCOM2 (nsnull, nsnull, nsnull);183 nsresult rv = NS_InitXPCOM2Ex(nsnull, nsnull, nsnull, 0); 184 184 if (NS_FAILED(rv)) { 185 185 PyErr_SetString(PyExc_RuntimeError, "The XPCOM subsystem could not be initialized"); -
trunk/src/libs/xpcom18a4/xpcom/build/nsXPCOM.h
r106112 r109067 48 48 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP 49 49 #define NS_IsXPCOMInitialized VBoxNsxpNS_IsXPCOMInitialized 50 #define NS_InitXPCOM2 VBoxNsxpNS_InitXPCOM250 #define NS_InitXPCOM2Ex VBoxNsxpNS_InitXPCOM2Ex 51 51 #define NS_ShutdownXPCOM VBoxNsxpNS_ShutdownXPCOM 52 52 #define NS_NewNativeLocalFile VBoxNsxpNS_NewNativeLocalFile … … 76 76 77 77 /** 78 * Checks whether XPCOM was initialized by a call to NS_InitXPCOM2 ().78 * Checks whether XPCOM was initialized by a call to NS_InitXPCOM2Ex(). 79 79 */ 80 80 extern "C" NS_COM PRBool … … 109 109 * <CODE>nsnull</CODE> for the default behaviour. 110 110 * 111 * @param fInitFlags NS_INIT_XPCOM_F_XXX values ORed together or zero. 112 * This was added during @bugref{10896} to workaround 113 * the problem that the IPC client component was already 114 * in use by the time NS_InitXPCOM2Ex returns and thus 115 * cannot be auto-re-registered by the client. 116 * (The actual need to trigger auto-reregistration of 117 * components is questionable, though, as it ought only 118 * to be needed after installing a new version, 119 * but we've always done it as part of our COM init glue 120 * code (see Main/glue/initterm.cpp).) 121 * 111 122 * @see NS_NewLocalFile 112 123 * @see nsILocalFile … … 120 131 */ 121 132 extern "C" NS_COM nsresult 122 NS_InitXPCOM2(nsIServiceManager* *result, 123 nsIFile* binDirectory, 124 nsIDirectoryServiceProvider* appFileLocationProvider); 133 NS_InitXPCOM2Ex(nsIServiceManager* *result, 134 nsIFile* binDirectory, 135 nsIDirectoryServiceProvider* appFileLocationProvider, 136 PRUint32 fFlags); 137 138 /** @name NS_INIT_XPCOM_F_XXX - Flags for NS_InitXPCOM2Ex. 139 * @{ */ 140 /** Auto-register components. */ 141 #define NS_INIT_XPCOM_F_AUTO_REGISTER_COMPONENTS 1 142 /** Auto-register components and return any failure status. 143 * @note When using this, always call NS_ShutdownXPCOM(nsnull) on failure 144 * (generally a good idea). */ 145 #define NS_INIT_XPCOM_F_AUTO_REGISTER_COMPONENTS_WITH_STATUS 2 146 /** @} */ 147 125 148 /** 126 149 * Shutdown XPCOM. You must call this method after you are finished … … 129 152 * @status FROZEN 130 153 * 131 * @param servMgr The service manager which was returned by NS_InitXPCOM2. 132 * This will release servMgr. You may pass null. 154 * @param servMgr The service manager which was returned by 155 * NS_InitXPCOM2Ex. This will release servMgr. 156 * You may pass null. 133 157 * 134 158 * @return NS_OK for success; … … 181 205 /** 182 206 * Public Method to create an instance of a nsILocalFile. This function 183 * may be called prior to NS_InitXPCOM2 .207 * may be called prior to NS_InitXPCOM2Ex. 184 208 * 185 209 * @status FROZEN -
trunk/src/libs/xpcom18a4/xpcom/build/nsXPComInit.cpp
r109065 r109067 380 380 } 381 381 382 nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result, 383 nsIFile* binDirectory, 384 nsIDirectoryServiceProvider* appFileLocationProvider) 382 nsresult NS_COM NS_InitXPCOM2Ex(nsIServiceManager* *result, 383 nsIFile* binDirectory, 384 nsIDirectoryServiceProvider* appFileLocationProvider, 385 PRUint32 fInitFlags) 385 386 { 386 387 nsresult rv = NS_OK; … … 388 389 /* Make sure IPRT is initialized. */ 389 390 RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE); 390 LogFlow(("NS_InitXPCOM2 : done RTR3InitDll\n"));391 LogFlow(("NS_InitXPCOM2Ex(,%p,%p,%#x): done RTR3InitDll\n", binDirectory, appFileLocationProvider, fInitFlags)); 391 392 392 393 // We are not shutting down … … 438 439 nsCOMPtr<nsIFile> xpcomLib; 439 440 440 PRBool value;441 441 if (binDirectory) 442 442 { 443 PRBool value = PR_FALSE; 443 444 rv = binDirectory->IsDirectory(&value); 444 445 445 if (NS_SUCCEEDED(rv) && value) { 446 446 gDirectoryService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory); … … 448 448 } 449 449 } 450 else {450 else 451 451 gDirectoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, 452 452 NS_GET_IID(nsIFile), 453 453 getter_AddRefs(xpcomLib)); 454 }455 454 456 455 if (xpcomLib) { … … 524 523 #endif 525 524 526 if ( NS_FAILED(rv) || CheckUpdateFile()) { 527 LogFlow(("NS_InitXPCOM2: rv=%#x or CheckUpdateFile()=>true\n", rv)); 525 PRBool fCheckUpdateFile = PR_FALSE; 526 if ( NS_FAILED(rv) 527 || (fInitFlags & (NS_INIT_XPCOM_F_AUTO_REGISTER_COMPONENTS | NS_INIT_XPCOM_F_AUTO_REGISTER_COMPONENTS_WITH_STATUS)) 528 || (fCheckUpdateFile = CheckUpdateFile())) { 529 LogFlow(("NS_InitXPCOM2Ex: rv=%#x fInitFlags=%#x CheckUpdateFile()=%d --> auto (re-)registering components\n", 530 rv, fInitFlags, fCheckUpdateFile)); RT_NOREF_PV(fCheckUpdateFile); 528 531 529 532 // if we find no persistent registry, we will try to autoregister 530 533 // the default components directory. 531 nsComponentManagerImpl::gComponentManager->AutoRegister(nsnull); 534 rv = nsComponentManagerImpl::gComponentManager->AutoRegister(nsnull); 535 if (NS_FAILED(rv) && (fInitFlags & NS_INIT_XPCOM_F_AUTO_REGISTER_COMPONENTS_WITH_STATUS)) { 536 NS_ERROR("gComponentManager->AutoRegister failed!"); 537 return rv; 538 } 532 539 533 540 // If the application is using a GRE, then, … … 631 638 632 639 // Notify observers of xpcom autoregistration start 633 LogFlow(("NS_InitXPCOM2 : Notifying startup observers (autoreg)\n"));640 LogFlow(("NS_InitXPCOM2Ex: Notifying startup observers\n")); 634 641 NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_OBSERVER_ID, 635 642 nsnull, … … 639 646 gXPCOMInitialized = PR_TRUE; 640 647 #endif 641 LogFlow(("NS_InitXPCOM2 : return NS_OK\n"));648 LogFlow(("NS_InitXPCOM2Ex: return NS_OK\n")); 642 649 return NS_OK; 643 650 } -
trunk/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp
r109066 r109067 3578 3578 { 3579 3579 // XPCOM needs initialization. 3580 rv = NS_InitXPCOM2 (nsnull, nsnull, nsnull);3580 rv = NS_InitXPCOM2Ex(nsnull, nsnull, nsnull, 0); 3581 3581 } 3582 3582 … … 3598 3598 { 3599 3599 // XPCOM needs initialization. 3600 nsresult rv = NS_InitXPCOM2 (nsnull, nsnull, nsnull);3600 nsresult rv = NS_InitXPCOM2Ex(nsnull, nsnull, nsnull, 0); 3601 3601 if (NS_FAILED(rv)) 3602 3602 return rv; … … 3629 3629 #else /* !VBOX */ 3630 3630 // XPCOM needs initialization. 3631 rv = NS_InitXPCOM2 (nsnull, nsnull, nsnull);3631 rv = NS_InitXPCOM2Ex(nsnull, nsnull, nsnull, 0); 3632 3632 #endif /* !VBOX */ 3633 3633 } … … 3651 3651 { 3652 3652 // XPCOM needs initialization. 3653 rv = NS_InitXPCOM2 (nsnull, nsnull, nsnull);3653 rv = NS_InitXPCOM2Ex(nsnull, nsnull, nsnull, 0); 3654 3654 } 3655 3655 … … 3674 3674 { 3675 3675 // XPCOM needs initialization. 3676 rv = NS_InitXPCOM2 (nsnull, nsnull, nsnull);3676 rv = NS_InitXPCOM2Ex(nsnull, nsnull, nsnull, 0); 3677 3677 } 3678 3678 -
trunk/src/libs/xpcom18a4/xpcom/io/nsDirectoryServiceDefs.h
r1 r109067 67 67 /* This location is similar to NS_OS_CURRENT_PROCESS_DIR, however, 68 68 * NS_XPCOM_CURRENT_PROCESS_DIR can be overriden by passing a "bin 69 * directory" to NS_InitXPCOM2 ().69 * directory" to NS_InitXPCOM2Ex(). 70 70 */ 71 71 #define NS_XPCOM_CURRENT_PROCESS_DIR "XCurProcD" -
trunk/src/libs/xpcom18a4/xpcom/tests/TestFactory.cpp
r1 r109067 116 116 { 117 117 nsCOMPtr<nsIServiceManager> servMan; 118 rv = NS_InitXPCOM2 (getter_AddRefs(servMan), nsnull, nsnull);118 rv = NS_InitXPCOM2Ex(getter_AddRefs(servMan), nsnull, nsnull, 0); 119 119 if (NS_FAILED(rv)) return -1; 120 120 nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan); -
trunk/src/libs/xpcom18a4/xpcom/tests/nsIFileTest.cpp
r103458 r109067 352 352 { 353 353 nsCOMPtr<nsIServiceManager> servMan; 354 NS_InitXPCOM2 (getter_AddRefs(servMan), nsnull, nsnull);354 NS_InitXPCOM2Ex(getter_AddRefs(servMan), nsnull, nsnull, 0); 355 355 nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan); 356 356 NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
Note:
See TracChangeset
for help on using the changeset viewer.