VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/build/nsXPComInit.cpp@ 101803

Last change on this file since 101803 was 101803, checked in by vboxsync, 15 months ago

libs/xpcom: Get rid of code used only if MOZ_TIMELINE is defined which we never do, bugref:10545

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 38.9 KB
Line 
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38#include "nsXPCOM.h"
39#include "nsXPCOMPrivate.h"
40#include "nscore.h"
41#include "prlink.h"
42#include "nsCOMPtr.h"
43#include "nsObserverList.h"
44#include "nsObserverService.h"
45#include "nsProperties.h"
46#include "nsIProperties.h"
47#include "nsPersistentProperties.h"
48#include "nsScriptableInputStream.h"
49#include "nsBinaryStream.h"
50#include "nsStorageStream.h"
51
52#include "nsMemoryImpl.h"
53#include "nsDebugImpl.h"
54#include "nsTraceRefcntImpl.h"
55#include "nsErrorService.h"
56#include "nsByteBuffer.h"
57
58#include "nsSupportsArray.h"
59#include "nsArray.h"
60#include "nsSupportsPrimitives.h"
61#include "nsConsoleService.h"
62#include "nsExceptionService.h"
63
64#include "nsComponentManager.h"
65#include "nsCategoryManagerUtils.h"
66#include "nsIServiceManager.h"
67#include "nsGenericFactory.h"
68
69#include "nsEventQueueService.h"
70#include "nsEventQueue.h"
71#ifdef VBOX
72# include "nsEventQueueUtils.h"
73# include "nsProxyRelease.h"
74#endif /* VBOX */
75
76#include "nsIProxyObjectManager.h"
77#include "nsProxyEventPrivate.h" // access to the impl of nsProxyObjectManager for the generic factory registration.
78
79#include "xptinfo.h"
80#include "nsIInterfaceInfoManager.h"
81
82#include "nsTimerImpl.h"
83#include "TimerThread.h"
84
85#include "nsThread.h"
86#include "nsProcess.h"
87#include "nsEnvironment.h"
88
89#include "nsEmptyEnumerator.h"
90
91#include "nsILocalFile.h"
92#include "nsLocalFile.h"
93#if defined(XP_UNIX) || defined(XP_OS2)
94#include "nsNativeCharsetUtils.h"
95#endif
96#include "nsDirectoryService.h"
97#include "nsDirectoryServiceDefs.h"
98#include "nsCategoryManager.h"
99#include "nsICategoryManager.h"
100#include "nsStringStream.h"
101#include "nsMultiplexInputStream.h"
102
103#include "nsFastLoadService.h"
104
105#include "nsAtomService.h"
106#include "nsAtomTable.h"
107#include "nsTraceRefcnt.h"
108
109#include "nsVariant.h"
110
111#include "nsRecyclingAllocator.h"
112
113#include "SpecialSystemDirectory.h"
114
115#include "ipcdclient.h"
116#include "ipcService.h"
117#include "ipcConfig.h"
118#include "ipcCID.h"
119#include "ipcLockService.h"
120#include "ipcLockCID.h"
121#include "tmTransactionService.h"
122#include "ipcDConnectService.h"
123
124#include <locale.h>
125
126// Registry Factory creation function defined in nsRegistry.cpp
127// We hook into this function locally to create and register the registry
128// Since noone outside xpcom needs to know about this and nsRegistry.cpp
129// does not have a local include file, we are putting this definition
130// here rather than in nsIRegistry.h
131extern nsresult NS_RegistryGetFactory(nsIFactory** aFactory);
132extern nsresult NS_CategoryManagerGetFactory( nsIFactory** );
133
134#ifdef DEBUG
135extern void _FreeAutoLockStatics();
136#endif
137
138static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
139static NS_DEFINE_CID(kMemoryCID, NS_MEMORY_CID);
140static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
141
142NS_GENERIC_FACTORY_CONSTRUCTOR(nsProcess)
143NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsEventQueueServiceImpl, Init)
144
145#define NS_ENVIRONMENT_CLASSNAME "Environment Service"
146
147#include "nsXPCOM.h"
148// ds/nsISupportsPrimitives
149#define NS_SUPPORTS_ID_CLASSNAME "Supports ID"
150#define NS_SUPPORTS_CSTRING_CLASSNAME "Supports String"
151#define NS_SUPPORTS_STRING_CLASSNAME "Supports WString"
152#define NS_SUPPORTS_PRBOOL_CLASSNAME "Supports PRBool"
153#define NS_SUPPORTS_PRUINT8_CLASSNAME "Supports PRUint8"
154#define NS_SUPPORTS_PRUINT16_CLASSNAME "Supports PRUint16"
155#define NS_SUPPORTS_PRUINT32_CLASSNAME "Supports PRUint32"
156#define NS_SUPPORTS_PRUINT64_CLASSNAME "Supports PRUint64"
157#define NS_SUPPORTS_PRTIME_CLASSNAME "Supports PRTime"
158#define NS_SUPPORTS_CHAR_CLASSNAME "Supports Char"
159#define NS_SUPPORTS_PRINT16_CLASSNAME "Supports PRInt16"
160#define NS_SUPPORTS_PRINT32_CLASSNAME "Supports PRInt32"
161#define NS_SUPPORTS_PRINT64_CLASSNAME "Supports PRInt64"
162#define NS_SUPPORTS_FLOAT_CLASSNAME "Supports float"
163#define NS_SUPPORTS_DOUBLE_CLASSNAME "Supports double"
164#define NS_SUPPORTS_VOID_CLASSNAME "Supports void"
165#define NS_SUPPORTS_INTERFACE_POINTER_CLASSNAME "Supports interface pointer"
166
167NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsIDImpl)
168NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsStringImpl)
169NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsCStringImpl)
170NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRBoolImpl)
171NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint8Impl)
172NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint16Impl)
173NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint32Impl)
174NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint64Impl)
175NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRTimeImpl)
176NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsCharImpl)
177NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt16Impl)
178NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt32Impl)
179NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt64Impl)
180NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsFloatImpl)
181NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsDoubleImpl)
182NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsVoidImpl)
183NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsInterfacePointerImpl)
184
185NS_GENERIC_FACTORY_CONSTRUCTOR(nsArray)
186NS_GENERIC_FACTORY_CONSTRUCTOR(nsConsoleService)
187NS_GENERIC_FACTORY_CONSTRUCTOR(nsAtomService)
188NS_GENERIC_FACTORY_CONSTRUCTOR(nsExceptionService)
189NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimerImpl)
190NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimerManager)
191NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryOutputStream)
192NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryInputStream)
193NS_GENERIC_FACTORY_CONSTRUCTOR(nsStorageStream)
194
195NS_GENERIC_FACTORY_CONSTRUCTOR(nsVariant)
196
197NS_GENERIC_FACTORY_CONSTRUCTOR(nsRecyclingAllocatorImpl)
198
199static NS_METHOD
200nsXPTIInterfaceInfoManagerGetSingleton(nsISupports* outer,
201 const nsIID& aIID,
202 void* *aInstancePtr)
203{
204 NS_ENSURE_ARG_POINTER(aInstancePtr);
205 NS_ENSURE_TRUE(!outer, NS_ERROR_NO_AGGREGATION);
206
207 nsCOMPtr<nsIInterfaceInfoManager> iim(dont_AddRef(XPTI_GetInterfaceInfoManager()));
208 if (!iim) {
209 return NS_ERROR_FAILURE;
210 }
211
212 return iim->QueryInterface(aIID, aInstancePtr);
213}
214
215
216PR_STATIC_CALLBACK(nsresult)
217RegisterGenericFactory(nsIComponentRegistrar* registrar,
218 const nsModuleComponentInfo *info)
219{
220 nsresult rv;
221 nsIGenericFactory* fact;
222 rv = NS_NewGenericFactory(&fact, info);
223 if (NS_FAILED(rv)) return rv;
224
225 rv = registrar->RegisterFactory(info->mCID,
226 info->mDescription,
227 info->mContractID,
228 fact);
229 NS_RELEASE(fact);
230 return rv;
231}
232
233// In order to support the installer, we need
234// to be told out of band if we should cause
235// an autoregister. If the file ".autoreg" exists in the binary
236// directory, we check its timestamp against the timestamp of the
237// compreg.dat file. If the .autoreg file is newer, we autoregister.
238static PRBool CheckUpdateFile()
239{
240 nsresult rv;
241 nsCOMPtr<nsIProperties> directoryService;
242 nsDirectoryService::Create(nsnull,
243 NS_GET_IID(nsIProperties),
244 getter_AddRefs(directoryService));
245
246 if (!directoryService)
247 return PR_FALSE;
248
249 nsCOMPtr<nsIFile> file;
250 rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
251 NS_GET_IID(nsIFile),
252 getter_AddRefs(file));
253
254 if (NS_FAILED(rv)) {
255 NS_WARNING("Getting NS_XPCOM_CURRENT_PROCESS_DIR failed");
256 return PR_FALSE;
257 }
258
259 file->AppendNative(nsDependentCString(".autoreg"));
260
261 PRBool exists;
262 file->Exists(&exists);
263 if (!exists)
264 return PR_FALSE;
265
266 nsCOMPtr<nsIFile> compregFile;
267 rv = directoryService->Get(NS_XPCOM_COMPONENT_REGISTRY_FILE,
268 NS_GET_IID(nsIFile),
269 getter_AddRefs(compregFile));
270
271
272 if (NS_FAILED(rv)) {
273 NS_WARNING("Getting NS_XPCOM_COMPONENT_REGISTRY_FILE failed");
274 return PR_FALSE;
275 }
276
277 // Don't need to check whether compreg exists; if it doesn't
278 // we won't even be here.
279
280 PRInt64 compregModTime, autoregModTime;
281 compregFile->GetLastModifiedTime(&compregModTime);
282 file->GetLastModifiedTime(&autoregModTime);
283
284 return LL_CMP(autoregModTime, >, compregModTime);
285}
286
287#if 0 /// @todo later
288NS_GENERIC_FACTORY_CONSTRUCTOR(ipcService)
289NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ipcLockService, Init)
290NS_GENERIC_FACTORY_CONSTRUCTOR(tmTransactionService)
291NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ipcDConnectService, Init)
292
293// enable this code to make the IPC DCONNECT service auto-start.
294NS_METHOD
295ipcDConnectServiceRegisterProc(nsIComponentManager *aCompMgr,
296 nsIFile *aPath,
297 const char *registryLocation,
298 const char *componentType,
299 const nsModuleComponentInfo *info)
300{
301 //
302 // add ipcService to the XPCOM startup category
303 //
304 nsCOMPtr<nsICategoryManager> catman(do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
305 if (catman) {
306 nsXPIDLCString prevEntry;
307 catman->AddCategoryEntry(NS_XPCOM_STARTUP_OBSERVER_ID, "ipcDConnectService",
308 IPC_DCONNECTSERVICE_CONTRACTID, PR_TRUE, PR_TRUE,
309 getter_Copies(prevEntry));
310 }
311 return NS_OK;
312}
313
314NS_METHOD
315ipcDConnectServiceUnregisterProc(nsIComponentManager *aCompMgr,
316 nsIFile *aPath,
317 const char *registryLocation,
318 const nsModuleComponentInfo *info)
319{
320 nsCOMPtr<nsICategoryManager> catman(do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
321 if (catman)
322 catman->DeleteCategoryEntry(NS_XPCOM_STARTUP_OBSERVER_ID,
323 IPC_DCONNECTSERVICE_CONTRACTID, PR_TRUE);
324 return NS_OK;
325}
326#endif
327
328nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = NULL;
329nsIProperties *gDirectoryService = NULL;
330PRBool gXPCOMShuttingDown = PR_FALSE;
331
332// For each class that wishes to support nsIClassInfo, add a line like this
333// NS_DECL_CLASSINFO(nsMyClass)
334
335#define COMPONENT(NAME, Ctor) \
336 { NS_##NAME##_CLASSNAME, NS_##NAME##_CID, NS_##NAME##_CONTRACTID, Ctor }
337
338#define COMPONENT_CI(NAME, Ctor, Class) \
339 { NS_##NAME##_CLASSNAME, NS_##NAME##_CID, NS_##NAME##_CONTRACTID, Ctor, \
340 NULL, NULL, NULL, NS_CI_INTERFACE_GETTER_NAME(Class), NULL, \
341 &NS_CLASSINFO_NAME(Class) }
342
343static const nsModuleComponentInfo components[] = {
344 COMPONENT(MEMORY, nsMemoryImpl::Create),
345 COMPONENT(DEBUG, nsDebugImpl::Create),
346#define NS_ERRORSERVICE_CLASSNAME NS_ERRORSERVICE_NAME
347 COMPONENT(ERRORSERVICE, nsErrorService::Create),
348
349 COMPONENT(BYTEBUFFER, ByteBufferImpl::Create),
350 COMPONENT(SCRIPTABLEINPUTSTREAM, nsScriptableInputStream::Create),
351 COMPONENT(BINARYINPUTSTREAM, nsBinaryInputStreamConstructor),
352 COMPONENT(BINARYOUTPUTSTREAM, nsBinaryOutputStreamConstructor),
353 COMPONENT(STORAGESTREAM, nsStorageStreamConstructor),
354
355#define NS_PROPERTIES_CLASSNAME "Properties"
356 COMPONENT(PROPERTIES, nsProperties::Create),
357
358#define NS_PERSISTENTPROPERTIES_CID NS_IPERSISTENTPROPERTIES_CID /* sigh */
359 COMPONENT(PERSISTENTPROPERTIES, nsPersistentProperties::Create),
360
361 COMPONENT(SUPPORTSARRAY, nsSupportsArray::Create),
362 COMPONENT(ARRAY, nsArrayConstructor),
363 COMPONENT(CONSOLESERVICE, nsConsoleServiceConstructor),
364 COMPONENT(EXCEPTIONSERVICE, nsExceptionServiceConstructor),
365 COMPONENT(ATOMSERVICE, nsAtomServiceConstructor),
366 COMPONENT(OBSERVERSERVICE, nsObserverService::Create),
367 COMPONENT(GENERICFACTORY, nsGenericFactory::Create),
368 COMPONENT(EVENTQUEUESERVICE, nsEventQueueServiceImplConstructor),
369 COMPONENT(EVENTQUEUE, nsEventQueueImpl::Create),
370 COMPONENT(THREAD, nsThread::Create),
371
372#define NS_XPCOMPROXY_CID NS_PROXYEVENT_MANAGER_CID
373 COMPONENT(XPCOMPROXY, nsProxyObjectManager::Create),
374
375 COMPONENT(TIMER, nsTimerImplConstructor),
376 COMPONENT(TIMERMANAGER, nsTimerManagerConstructor),
377
378#define COMPONENT_SUPPORTS(TYPE, Type) \
379 COMPONENT(SUPPORTS_##TYPE, nsSupports##Type##ImplConstructor)
380
381 COMPONENT_SUPPORTS(ID, ID),
382 COMPONENT_SUPPORTS(STRING, String),
383 COMPONENT_SUPPORTS(CSTRING, CString),
384 COMPONENT_SUPPORTS(PRBOOL, PRBool),
385 COMPONENT_SUPPORTS(PRUINT8, PRUint8),
386 COMPONENT_SUPPORTS(PRUINT16, PRUint16),
387 COMPONENT_SUPPORTS(PRUINT32, PRUint32),
388 COMPONENT_SUPPORTS(PRUINT64, PRUint64),
389 COMPONENT_SUPPORTS(PRTIME, PRTime),
390 COMPONENT_SUPPORTS(CHAR, Char),
391 COMPONENT_SUPPORTS(PRINT16, PRInt16),
392 COMPONENT_SUPPORTS(PRINT32, PRInt32),
393 COMPONENT_SUPPORTS(PRINT64, PRInt64),
394 COMPONENT_SUPPORTS(FLOAT, Float),
395 COMPONENT_SUPPORTS(DOUBLE, Double),
396 COMPONENT_SUPPORTS(VOID, Void),
397 COMPONENT_SUPPORTS(INTERFACE_POINTER, InterfacePointer),
398
399#undef COMPONENT_SUPPORTS
400#define NS_LOCAL_FILE_CLASSNAME "Local File Specification"
401 COMPONENT(LOCAL_FILE, nsLocalFile::nsLocalFileConstructor),
402#define NS_DIRECTORY_SERVICE_CLASSNAME "nsIFile Directory Service"
403 COMPONENT(DIRECTORY_SERVICE, nsDirectoryService::Create),
404 COMPONENT(PROCESS, nsProcessConstructor),
405 COMPONENT(ENVIRONMENT, nsEnvironment::Create),
406
407 COMPONENT(STRINGINPUTSTREAM, nsStringInputStreamConstructor),
408 COMPONENT(MULTIPLEXINPUTSTREAM, nsMultiplexInputStreamConstructor),
409
410 COMPONENT(FASTLOADSERVICE, nsFastLoadService::Create),
411 COMPONENT(VARIANT, nsVariantConstructor),
412 COMPONENT(INTERFACEINFOMANAGER_SERVICE, nsXPTIInterfaceInfoManagerGetSingleton),
413
414 COMPONENT(RECYCLINGALLOCATOR, nsRecyclingAllocatorImplConstructor),
415
416#if 0 /// @todo later
417 { IPC_SERVICE_CLASSNAME,
418 IPC_SERVICE_CID,
419 IPC_SERVICE_CONTRACTID,
420 ipcServiceConstructor },
421 /*
422 ipcServiceRegisterProc,
423 ipcServiceUnregisterProc },
424 */
425 //
426 // extensions go here:
427 //
428 { IPC_LOCKSERVICE_CLASSNAME,
429 IPC_LOCKSERVICE_CID,
430 IPC_LOCKSERVICE_CONTRACTID,
431 ipcLockServiceConstructor },
432 { IPC_TRANSACTIONSERVICE_CLASSNAME,
433 IPC_TRANSACTIONSERVICE_CID,
434 IPC_TRANSACTIONSERVICE_CONTRACTID,
435 tmTransactionServiceConstructor },
436
437#ifdef BUILD_DCONNECT
438 { IPC_DCONNECTSERVICE_CLASSNAME,
439 IPC_DCONNECTSERVICE_CID,
440 IPC_DCONNECTSERVICE_CONTRACTID,
441 ipcDConnectServiceConstructor,
442 ipcDConnectServiceRegisterProc,
443 ipcDConnectServiceUnregisterProc },
444#endif
445#endif
446};
447
448#undef COMPONENT
449
450const int components_length = sizeof(components) / sizeof(components[0]);
451
452// gMemory will be freed during shutdown.
453static nsIMemory* gMemory = nsnull;
454nsresult NS_COM NS_GetMemoryManager(nsIMemory* *result)
455{
456 nsresult rv = NS_OK;
457 if (!gMemory)
458 {
459 rv = nsMemoryImpl::Create(nsnull,
460 NS_GET_IID(nsIMemory),
461 (void**)&gMemory);
462 }
463 NS_IF_ADDREF(*result = gMemory);
464 return rv;
465}
466
467// gDebug will be freed during shutdown.
468static nsIDebug* gDebug = nsnull;
469nsresult NS_COM NS_GetDebug(nsIDebug** result)
470{
471 nsresult rv = NS_OK;
472 if (!gDebug)
473 {
474 rv = nsDebugImpl::Create(nsnull,
475 NS_GET_IID(nsIDebug),
476 (void**)&gDebug);
477 }
478 NS_IF_ADDREF(*result = gDebug);
479 return rv;
480}
481
482#ifdef NS_BUILD_REFCNT_LOGGING
483// gTraceRefcnt will be freed during shutdown.
484static nsITraceRefcnt* gTraceRefcnt = nsnull;
485#endif
486
487nsresult NS_COM NS_GetTraceRefcnt(nsITraceRefcnt** result)
488{
489#ifdef NS_BUILD_REFCNT_LOGGING
490 nsresult rv = NS_OK;
491 if (!gTraceRefcnt)
492 {
493 rv = nsTraceRefcntImpl::Create(nsnull,
494 NS_GET_IID(nsITraceRefcnt),
495 (void**)&gTraceRefcnt);
496 }
497 NS_IF_ADDREF(*result = gTraceRefcnt);
498 return rv;
499#else
500 return NS_ERROR_NOT_INITIALIZED;
501#endif
502}
503
504nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result,
505 nsIFile* binDirectory)
506{
507 return NS_InitXPCOM2(result, binDirectory, nsnull);
508}
509
510nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
511 nsIFile* binDirectory,
512 nsIDirectoryServiceProvider* appFileLocationProvider)
513{
514 nsresult rv = NS_OK;
515
516 // We are not shutting down
517 gXPCOMShuttingDown = PR_FALSE;
518
519#ifdef NS_BUILD_REFCNT_LOGGING
520 nsTraceRefcntImpl::Startup();
521#endif
522
523 // Establish the main thread here.
524 rv = nsIThread::SetMainThread();
525 if (NS_FAILED(rv)) return rv;
526
527 // Set up the timer globals/timer thread
528 rv = nsTimerImpl::Startup();
529 NS_ENSURE_SUCCESS(rv, rv);
530
531 // Startup the memory manager
532 rv = nsMemoryImpl::Startup();
533 if (NS_FAILED(rv)) return rv;
534
535 // If the locale hasn't already been setup by our embedder,
536 // get us out of the "C" locale and into the system
537 if (strcmp(setlocale(LC_ALL, NULL), "C") == 0)
538 setlocale(LC_ALL, "");
539
540#if defined(XP_UNIX) || defined(XP_OS2)
541 NS_StartupNativeCharsetUtils();
542#endif
543 NS_StartupLocalFile();
544
545 StartupSpecialSystemDirectory();
546
547 // Start the directory service so that the component manager init can use it.
548 rv = nsDirectoryService::Create(nsnull,
549 NS_GET_IID(nsIProperties),
550 (void**)&gDirectoryService);
551 if (NS_FAILED(rv))
552 return rv;
553
554 nsCOMPtr<nsIDirectoryService> dirService = do_QueryInterface(gDirectoryService, &rv);
555 if (NS_FAILED(rv))
556 return rv;
557 rv = dirService->Init();
558 if (NS_FAILED(rv))
559 return rv;
560
561 // Create the Component/Service Manager
562 nsComponentManagerImpl *compMgr = NULL;
563
564 if (nsComponentManagerImpl::gComponentManager == NULL)
565 {
566 compMgr = new nsComponentManagerImpl();
567 if (compMgr == NULL)
568 return NS_ERROR_OUT_OF_MEMORY;
569 NS_ADDREF(compMgr);
570
571 nsCOMPtr<nsIFile> xpcomLib;
572
573 PRBool value;
574 if (binDirectory)
575 {
576 rv = binDirectory->IsDirectory(&value);
577
578 if (NS_SUCCEEDED(rv) && value) {
579 gDirectoryService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory);
580 binDirectory->Clone(getter_AddRefs(xpcomLib));
581 }
582 }
583 else {
584 gDirectoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
585 NS_GET_IID(nsIFile),
586 getter_AddRefs(xpcomLib));
587 }
588
589 if (xpcomLib) {
590 xpcomLib->AppendNative(nsDependentCString(XPCOM_DLL));
591 gDirectoryService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib);
592 }
593
594 if (appFileLocationProvider) {
595 rv = dirService->RegisterProvider(appFileLocationProvider);
596 if (NS_FAILED(rv)) return rv;
597 }
598
599 rv = compMgr->Init();
600 if (NS_FAILED(rv))
601 {
602 NS_RELEASE(compMgr);
603 return rv;
604 }
605
606 nsComponentManagerImpl::gComponentManager = compMgr;
607
608 if (result) {
609 nsIServiceManager *serviceManager =
610 NS_STATIC_CAST(nsIServiceManager*, compMgr);
611
612 NS_ADDREF(*result = serviceManager);
613 }
614 }
615
616 nsCOMPtr<nsIMemory> memory;
617 NS_GetMemoryManager(getter_AddRefs(memory));
618 // dougt - these calls will be moved into a new interface when nsIComponentManager is frozen.
619 rv = compMgr->RegisterService(kMemoryCID, memory);
620 if (NS_FAILED(rv)) return rv;
621
622 rv = compMgr->RegisterService(kComponentManagerCID, NS_STATIC_CAST(nsIComponentManager*, compMgr));
623 if (NS_FAILED(rv)) return rv;
624
625 // 2. Register the global services with the component manager so that
626 // clients can create new objects.
627
628 // Category Manager
629 {
630 nsCOMPtr<nsIFactory> categoryManagerFactory;
631 if ( NS_FAILED(rv = NS_CategoryManagerGetFactory(getter_AddRefs(categoryManagerFactory))) )
632 return rv;
633
634 NS_DEFINE_CID(kCategoryManagerCID, NS_CATEGORYMANAGER_CID);
635
636 rv = compMgr->RegisterFactory(kCategoryManagerCID,
637 NS_CATEGORYMANAGER_CLASSNAME,
638 NS_CATEGORYMANAGER_CONTRACTID,
639 categoryManagerFactory,
640 PR_TRUE);
641 if ( NS_FAILED(rv) ) return rv;
642 }
643
644 // what I want to do here is QI for a Component Registration Manager. Since this
645 // has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
646 nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(
647 NS_STATIC_CAST(nsIComponentManager*,compMgr), &rv);
648 if (registrar) {
649 for (int i = 0; i < components_length; i++)
650 RegisterGenericFactory(registrar, &components[i]);
651 }
652 rv = nsComponentManagerImpl::gComponentManager->ReadPersistentRegistry();
653#ifdef DEBUG
654 if (NS_FAILED(rv)) {
655 printf("No Persistent Registry Found.\n");
656 }
657#endif
658
659#if 0 /// @todo later
660 rv = IPC_Init();
661 if (NS_FAILED(rv))
662 return rv;
663#endif
664
665 if ( NS_FAILED(rv) || CheckUpdateFile()) {
666 // if we find no persistent registry, we will try to autoregister
667 // the default components directory.
668 nsComponentManagerImpl::gComponentManager->AutoRegister(nsnull);
669
670 // If the application is using a GRE, then,
671 // auto register components in the GRE directory as well.
672 //
673 // The application indicates that it's using an GRE by
674 // returning a valid nsIFile when queried (via appFileLocProvider)
675 // for the NS_GRE_DIR atom as shown below
676 //
677
678 if ( appFileLocationProvider ) {
679 nsCOMPtr<nsIFile> greDir;
680 PRBool persistent = PR_TRUE;
681
682 appFileLocationProvider->GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(greDir));
683
684 if (greDir) {
685#ifdef DEBUG_dougt
686 printf("start - Registering GRE components\n");
687#endif
688 rv = gDirectoryService->Get(NS_GRE_COMPONENT_DIR,
689 NS_GET_IID(nsIFile),
690 getter_AddRefs(greDir));
691 if (NS_FAILED(rv)) {
692 NS_ERROR("Could not get GRE components directory!");
693 return rv;
694 }
695
696 // If the GRE contains any loaders, we want to know about it so that we can cause another
697 // autoregistration of the applications component directory.
698 int loaderCount = nsComponentManagerImpl::gComponentManager->GetLoaderCount();
699 rv = nsComponentManagerImpl::gComponentManager->AutoRegister(greDir);
700
701 if (loaderCount != nsComponentManagerImpl::gComponentManager->GetLoaderCount())
702 nsComponentManagerImpl::gComponentManager->AutoRegisterNonNativeComponents(nsnull);
703
704#ifdef DEBUG_dougt
705 printf("end - Registering GRE components\n");
706#endif
707 if (NS_FAILED(rv)) {
708 NS_ERROR("Could not AutoRegister GRE components");
709 return rv;
710 }
711 }
712 }
713
714 //
715 // If additional component directories have been specified, then
716 // register them as well.
717 //
718
719 nsCOMPtr<nsISimpleEnumerator> dirList;
720 gDirectoryService->Get(NS_XPCOM_COMPONENT_DIR_LIST,
721 NS_GET_IID(nsISimpleEnumerator),
722 getter_AddRefs(dirList));
723 if (dirList) {
724 PRBool hasMore;
725 while (NS_SUCCEEDED(dirList->HasMoreElements(&hasMore)) && hasMore) {
726 nsCOMPtr<nsISupports> elem;
727 dirList->GetNext(getter_AddRefs(elem));
728 if (elem) {
729 nsCOMPtr<nsIFile> dir = do_QueryInterface(elem);
730 if (dir)
731 nsComponentManagerImpl::gComponentManager->AutoRegister(dir);
732
733 // XXX should we worry about new component loaders being
734 // XXX defined by this process?
735 }
736 }
737 }
738
739
740 // Make sure the compreg file's mod time is current.
741 nsCOMPtr<nsIFile> compregFile;
742 rv = gDirectoryService->Get(NS_XPCOM_COMPONENT_REGISTRY_FILE,
743 NS_GET_IID(nsIFile),
744 getter_AddRefs(compregFile));
745 compregFile->SetLastModifiedTime(PR_Now() / 1000);
746 }
747
748 // Pay the cost at startup time of starting this singleton.
749 nsIInterfaceInfoManager* iim = XPTI_GetInterfaceInfoManager();
750 NS_IF_RELEASE(iim);
751#ifdef VBOX
752 // Must initialize the EventQueueService singleton before anyone is
753 // using it. The notification below creates a thread which races creating
754 // the EventQueueService creation otherwise, no matter what.
755 nsCOMPtr<nsIEventQueue> eventQ;
756 rv = NS_GetMainEventQ(getter_AddRefs(eventQ));
757 if (NS_FAILED(rv)) {
758 NS_ERROR("Could not create event queue for main thread");
759 /* this is just a build-time hack, to reference NS_ProxyRelease */
760 if (rv == 666)
761 NS_ProxyRelease(nsnull, nsnull);
762 return rv;
763 }
764#endif /* VBOX */
765
766 // Notify observers of xpcom autoregistration start
767 NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_OBSERVER_ID,
768 nsnull,
769 NS_XPCOM_STARTUP_OBSERVER_ID);
770
771 return NS_OK;
772}
773
774
775static nsVoidArray* gExitRoutines;
776
777static void CallExitRoutines()
778{
779 if (!gExitRoutines)
780 return;
781
782 PRInt32 count = gExitRoutines->Count();
783 for (PRInt32 i = 0; i < count; i++) {
784 XPCOMExitRoutine func = (XPCOMExitRoutine) gExitRoutines->ElementAt(i);
785 func();
786 }
787 gExitRoutines->Clear();
788 delete gExitRoutines;
789 gExitRoutines = nsnull;
790}
791
792nsresult NS_COM
793NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority)
794{
795 // priority are not used right now. It will need to be implemented as more
796 // classes are moved into the glue library --dougt
797 if (!gExitRoutines) {
798 gExitRoutines = new nsVoidArray();
799 if (!gExitRoutines) {
800 NS_WARNING("Failed to allocate gExitRoutines");
801 return NS_ERROR_FAILURE;
802 }
803 }
804
805 PRBool okay = gExitRoutines->AppendElement((void*)exitRoutine);
806 return okay ? NS_OK : NS_ERROR_FAILURE;
807}
808
809nsresult NS_COM
810NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
811{
812 if (!gExitRoutines)
813 return NS_ERROR_FAILURE;
814
815 PRBool okay = gExitRoutines->RemoveElement((void*)exitRoutine);
816 return okay ? NS_OK : NS_ERROR_FAILURE;
817}
818
819
820//
821// NS_ShutdownXPCOM()
822//
823// The shutdown sequence for xpcom would be
824//
825// - Release the Global Service Manager
826// - Release all service instances held by the global service manager
827// - Release the Global Service Manager itself
828// - Release the Component Manager
829// - Release all factories cached by the Component Manager
830// - Unload Libraries
831// - Release Contractid Cache held by Component Manager
832// - Release dll abstraction held by Component Manager
833// - Release the Registry held by Component Manager
834// - Finally, release the component manager itself
835//
836nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr)
837{
838
839 // Notify observers of xpcom shutting down
840 nsresult rv = NS_OK;
841 {
842 // Block it so that the COMPtr will get deleted before we hit
843 // servicemanager shutdown
844 nsCOMPtr<nsIObserverService> observerService =
845 do_GetService("@mozilla.org/observer-service;1", &rv);
846 if (NS_SUCCEEDED(rv))
847 {
848 nsCOMPtr<nsIServiceManager> mgr;
849 rv = NS_GetServiceManager(getter_AddRefs(mgr));
850 if (NS_SUCCEEDED(rv))
851 {
852 (void) observerService->NotifyObservers(mgr,
853 NS_XPCOM_SHUTDOWN_OBSERVER_ID,
854 nsnull);
855 }
856 }
857 }
858
859 // grab the event queue so that we can process events one last time before exiting
860 nsCOMPtr <nsIEventQueue> currentQ;
861 {
862 nsCOMPtr<nsIEventQueueService> eventQService =
863 do_GetService(kEventQueueServiceCID, &rv);
864
865 if (eventQService) {
866 eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(currentQ));
867 }
868 }
869 // XPCOM is officially in shutdown mode NOW
870 // Set this only after the observers have been notified as this
871 // will cause servicemanager to become inaccessible.
872 gXPCOMShuttingDown = PR_TRUE;
873
874#ifdef DEBUG_dougt
875 fprintf(stderr, "* * * * XPCOM shutdown. Access will be denied * * * * \n");
876#endif
877
878#if 0 /// @todo later
879 IPC_Shutdown();
880#endif
881
882 // We may have AddRef'd for the caller of NS_InitXPCOM, so release it
883 // here again:
884 NS_IF_RELEASE(servMgr);
885
886 // Shutdown global servicemanager
887 if (nsComponentManagerImpl::gComponentManager) {
888 nsComponentManagerImpl::gComponentManager->FreeServices();
889 }
890 nsServiceManager::ShutdownGlobalServiceManager(nsnull);
891
892 if (currentQ) {
893 currentQ->ProcessPendingEvents();
894 currentQ = 0;
895 }
896
897 nsProxyObjectManager::Shutdown();
898
899 // Release the directory service
900 NS_IF_RELEASE(gDirectoryService);
901
902 // Shutdown nsLocalFile string conversion
903 NS_ShutdownLocalFile();
904#ifdef XP_UNIX
905 NS_ShutdownNativeCharsetUtils();
906#endif
907
908 // Shutdown the timer thread and all timers that might still be alive before
909 // shutting down the component manager
910 nsTimerImpl::Shutdown();
911
912 CallExitRoutines();
913
914 // Shutdown xpcom. This will release all loaders and cause others holding
915 // a refcount to the component manager to release it.
916 if (nsComponentManagerImpl::gComponentManager) {
917 rv = (nsComponentManagerImpl::gComponentManager)->Shutdown();
918 NS_ASSERTION(NS_SUCCEEDED(rv), "Component Manager shutdown failed.");
919 } else
920 NS_WARNING("Component Manager was never created ...");
921
922 // Release our own singletons
923 // Do this _after_ shutting down the component manager, because the
924 // JS component loader will use XPConnect to call nsIModule::canUnload,
925 // and that will spin up the InterfaceInfoManager again -- bad mojo
926 XPTI_FreeInterfaceInfoManager();
927
928 // Finally, release the component manager last because it unloads the
929 // libraries:
930 if (nsComponentManagerImpl::gComponentManager) {
931 nsrefcnt cnt;
932 NS_RELEASE2(nsComponentManagerImpl::gComponentManager, cnt);
933 NS_WARN_IF_FALSE(cnt == 0, "Component Manager being held past XPCOM shutdown.");
934 }
935 nsComponentManagerImpl::gComponentManager = nsnull;
936
937#ifdef DEBUG
938 _FreeAutoLockStatics();
939#endif
940
941 ShutdownSpecialSystemDirectory();
942
943 EmptyEnumeratorImpl::Shutdown();
944 nsMemoryImpl::Shutdown();
945 NS_IF_RELEASE(gMemory);
946
947 nsThread::Shutdown();
948 NS_PurgeAtomTable();
949
950 NS_IF_RELEASE(gDebug);
951
952#ifdef NS_BUILD_REFCNT_LOGGING
953 nsTraceRefcntImpl::DumpStatistics();
954 nsTraceRefcntImpl::ResetStatistics();
955 nsTraceRefcntImpl::Shutdown();
956#endif
957
958 return NS_OK;
959}
960
961#define GET_FUNC(_tag, _decl, _name) \
962 functions->_tag = (_decl) PR_FindSymbol(xpcomLib, _name); \
963 if (!functions->_tag) goto end
964
965nsresult NS_COM PR_CALLBACK
966NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* libraryPath)
967{
968 if (!functions)
969 return NS_ERROR_OUT_OF_MEMORY;
970
971 if (functions->version != XPCOM_GLUE_VERSION)
972 return NS_ERROR_FAILURE;
973
974 PRLibrary *xpcomLib = PR_LoadLibrary(libraryPath);
975 if (!xpcomLib)
976 return NS_ERROR_FAILURE;
977
978 nsresult rv = NS_ERROR_FAILURE;
979
980#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
981 GET_FUNC(init, InitFunc, "VBoxNsxpNS_InitXPCOM2");
982 GET_FUNC(shutdown, ShutdownFunc, "VBoxNsxpNS_ShutdownXPCOM");
983 GET_FUNC(getServiceManager, GetServiceManagerFunc, "VBoxNsxpNS_GetServiceManager");
984 GET_FUNC(getComponentManager, GetComponentManagerFunc, "VBoxNsxpNS_GetComponentManager");
985 GET_FUNC(getComponentRegistrar, GetComponentRegistrarFunc, "VBoxNsxpNS_GetComponentRegistrar");
986 GET_FUNC(getMemoryManager, GetMemoryManagerFunc, "VBoxNsxpNS_GetMemoryManager");
987 GET_FUNC(newLocalFile, NewLocalFileFunc, "VBoxNsxpNS_NewLocalFile");
988 GET_FUNC(newNativeLocalFile, NewNativeLocalFileFunc, "VBoxNsxpNS_NewNativeLocalFile");
989 GET_FUNC(registerExitRoutine, RegisterXPCOMExitRoutineFunc, "VBoxNsxpNS_RegisterXPCOMExitRoutine");
990 GET_FUNC(unregisterExitRoutine, UnregisterXPCOMExitRoutineFunc, "VBoxNsxpNS_UnregisterXPCOMExitRoutine");
991#else /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
992 GET_FUNC(init, InitFunc, "NS_InitXPCOM2");
993 GET_FUNC(shutdown, ShutdownFunc, "NS_ShutdownXPCOM");
994 GET_FUNC(getServiceManager, GetServiceManagerFunc, "NS_GetServiceManager");
995 GET_FUNC(getComponentManager, GetComponentManagerFunc, "NS_GetComponentManager");
996 GET_FUNC(getComponentRegistrar, GetComponentRegistrarFunc, "NS_GetComponentRegistrar");
997 GET_FUNC(getMemoryManager, GetMemoryManagerFunc, "NS_GetMemoryManager");
998 GET_FUNC(newLocalFile, NewLocalFileFunc, "NS_NewLocalFile");
999 GET_FUNC(newNativeLocalFile, NewNativeLocalFileFunc, "NS_NewNativeLocalFile");
1000 GET_FUNC(registerExitRoutine, RegisterXPCOMExitRoutineFunc, "NS_RegisterXPCOMExitRoutine");
1001 GET_FUNC(unregisterExitRoutine, UnregisterXPCOMExitRoutineFunc, "NS_UnregisterXPCOMExitRoutine");
1002#endif /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
1003
1004 // these functions were added post 1.4 (need to check size of |functions|)
1005 if (functions->size > offsetof(XPCOMFunctions, getTraceRefcnt)) {
1006#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
1007 GET_FUNC(getDebug, GetDebugFunc, "VBoxNsxpNS_GetDebug");
1008 GET_FUNC(getTraceRefcnt, GetTraceRefcntFunc, "VBoxNsxpNS_GetTraceRefcnt");
1009#else /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
1010 GET_FUNC(getDebug, GetDebugFunc, "NS_GetDebug");
1011 GET_FUNC(getTraceRefcnt, GetTraceRefcntFunc, "NS_GetTraceRefcnt");
1012#endif /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
1013 }
1014
1015 // these functions were added post 1.6 (need to check size of |functions|)
1016 if (functions->size > offsetof(XPCOMFunctions, cstringCloneData)) {
1017#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
1018 GET_FUNC(stringContainerInit, StringContainerInitFunc, "VBoxNsxpNS_StringContainerInit");
1019 GET_FUNC(stringContainerFinish, StringContainerFinishFunc, "VBoxNsxpNS_StringContainerFinish");
1020 GET_FUNC(stringGetData, StringGetDataFunc, "VBoxNsxpNS_StringGetData");
1021 GET_FUNC(stringSetData, StringSetDataFunc, "VBoxNsxpNS_StringSetData");
1022 GET_FUNC(stringSetDataRange, StringSetDataRangeFunc, "VBoxNsxpNS_StringSetDataRange");
1023 GET_FUNC(stringCopy, StringCopyFunc, "VBoxNsxpNS_StringCopy");
1024 GET_FUNC(cstringContainerInit, CStringContainerInitFunc, "VBoxNsxpNS_CStringContainerInit");
1025 GET_FUNC(cstringContainerFinish, CStringContainerFinishFunc, "VBoxNsxpNS_CStringContainerFinish");
1026 GET_FUNC(cstringGetData, CStringGetDataFunc, "VBoxNsxpNS_CStringGetData");
1027 GET_FUNC(cstringSetData, CStringSetDataFunc, "VBoxNsxpNS_CStringSetData");
1028 GET_FUNC(cstringSetDataRange, CStringSetDataRangeFunc, "VBoxNsxpNS_CStringSetDataRange");
1029 GET_FUNC(cstringCopy, CStringCopyFunc, "VBoxNsxpNS_CStringCopy");
1030 GET_FUNC(cstringToUTF16, CStringToUTF16, "VBoxNsxpNS_CStringToUTF16");
1031 GET_FUNC(utf16ToCString, UTF16ToCString, "VBoxNsxpNS_UTF16ToCString");
1032 GET_FUNC(stringCloneData, StringCloneDataFunc, "VBoxNsxpNS_StringCloneData");
1033 GET_FUNC(cstringCloneData, CStringCloneDataFunc, "VBoxNsxpNS_CStringCloneData");
1034#else /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
1035 GET_FUNC(stringContainerInit, StringContainerInitFunc, "NS_StringContainerInit");
1036 GET_FUNC(stringContainerFinish, StringContainerFinishFunc, "NS_StringContainerFinish");
1037 GET_FUNC(stringGetData, StringGetDataFunc, "NS_StringGetData");
1038 GET_FUNC(stringSetData, StringSetDataFunc, "NS_StringSetData");
1039 GET_FUNC(stringSetDataRange, StringSetDataRangeFunc, "NS_StringSetDataRange");
1040 GET_FUNC(stringCopy, StringCopyFunc, "NS_StringCopy");
1041 GET_FUNC(cstringContainerInit, CStringContainerInitFunc, "NS_CStringContainerInit");
1042 GET_FUNC(cstringContainerFinish, CStringContainerFinishFunc, "NS_CStringContainerFinish");
1043 GET_FUNC(cstringGetData, CStringGetDataFunc, "NS_CStringGetData");
1044 GET_FUNC(cstringSetData, CStringSetDataFunc, "NS_CStringSetData");
1045 GET_FUNC(cstringSetDataRange, CStringSetDataRangeFunc, "NS_CStringSetDataRange");
1046 GET_FUNC(cstringCopy, CStringCopyFunc, "NS_CStringCopy");
1047 GET_FUNC(cstringToUTF16, CStringToUTF16, "NS_CStringToUTF16");
1048 GET_FUNC(utf16ToCString, UTF16ToCString, "NS_UTF16ToCString");
1049 GET_FUNC(stringCloneData, StringCloneDataFunc, "NS_StringCloneData");
1050 GET_FUNC(cstringCloneData, CStringCloneDataFunc, "NS_CStringCloneData");
1051#endif /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
1052 }
1053
1054 rv = NS_OK;
1055end:
1056 PR_UnloadLibrary(xpcomLib); // the library is refcnt'ed above by the caller.
1057 return rv;
1058}
Note: See TracBrowser for help on using the repository browser.

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