author | Eric Rahm <erahm@mozilla.com> |
Thu, 25 Feb 2016 16:31:17 -0800 | |
changeset 285944 | 1625e18519d391d49f4cd72462a2af8c98441ab7 |
parent 285943 | d6820d2419d7dbbc42cd9d9cde332064e344c207 |
child 285945 | afd1b8342a53046d3bc516ac8ae586919c0f5f88 |
push id | 30036 |
push user | cbook@mozilla.com |
push date | Mon, 29 Feb 2016 10:35:59 +0000 |
treeherder | mozilla-central@9da51cb4974e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | froydnj |
bugs | 1251473 |
milestone | 47.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
xpcom/libxpcomrt/XPCOMRTInit.cpp | file | annotate | diff | comparison | revisions | |
xpcom/libxpcomrt/XPCOMRTInit.h | file | annotate | diff | comparison | revisions | |
xpcom/libxpcomrt/XPCOMRTModule.inc | file | annotate | diff | comparison | revisions | |
xpcom/libxpcomrt/XPCOMRTStubs.cpp | file | annotate | diff | comparison | revisions | |
xpcom/libxpcomrt/docs/index.rst | file | annotate | diff | comparison | revisions | |
xpcom/libxpcomrt/moz.build | file | annotate | diff | comparison | revisions | |
xpcom/moz.build | file | annotate | diff | comparison | revisions |
deleted file mode 100644 --- a/xpcom/libxpcomrt/XPCOMRTInit.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* vim:set ts=4 sw=4 sts=4 ci et: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/Module.h" -#include "mozilla/ModuleUtils.h" -#include "mozilla/NullPtr.h" -#include "mozilla/TimeStamp.h" -#include "nsCategoryManager.h" -#include "nsComponentManager.h" -#include "nsDebugImpl.h" -#include "nsIErrorService.h" -#include "nsMemoryImpl.h" -#include "nsNetCID.h" -#include "nsNetModuleStandalone.h" -#include "nsObserverService.h" -#include "nsThreadManager.h" -#include "nsThreadPool.h" -#include "nsUUIDGenerator.h" -#include "nsXPCOMCIDInternal.h" -#include "nsXPCOMPrivate.h" -#include "TimerThread.h" -#include "XPCOMRTInit.h" - -static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimerImpl) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUUIDGenerator, Init) - -static nsresult -nsThreadManagerGetSingleton(nsISupports* aOuter, - const nsIID& aIID, - void** aInstancePtr) -{ - NS_ASSERTION(aInstancePtr, "null outptr"); - if (NS_WARN_IF(aOuter)) { - return NS_ERROR_NO_AGGREGATION; - } - - return nsThreadManager::get()->QueryInterface(aIID, aInstancePtr); -} - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsThreadPool) - -nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = nullptr; -bool gXPCOMShuttingDown = false; -bool gXPCOMThreadsShutDown = false; - -#define COMPONENT(NAME, Ctor) static NS_DEFINE_CID(kNS_##NAME##_CID, NS_##NAME##_CID); -#include "XPCOMRTModule.inc" -#undef COMPONENT - -#define COMPONENT(NAME, Ctor) { &kNS_##NAME##_CID, false, nullptr, Ctor }, -const mozilla::Module::CIDEntry kXPCOMCIDEntries[] = { - { &kComponentManagerCID, true, nullptr, nsComponentManagerImpl::Create }, -#include "XPCOMRTModule.inc" - { nullptr } -}; -#undef COMPONENT - -#define COMPONENT(NAME, Ctor) { NS_##NAME##_CONTRACTID, &kNS_##NAME##_CID }, -const mozilla::Module::ContractIDEntry kXPCOMContracts[] = { -#include "XPCOMRTModule.inc" - { nullptr } -}; -#undef COMPONENT - -const mozilla::Module kXPCOMRTModule = { - mozilla::Module::kVersion, kXPCOMCIDEntries, kXPCOMContracts -}; - -nsresult -NS_InitXPCOMRT() -{ - nsresult rv = NS_OK; - - NS_SetMainThread(); - - mozilla::TimeStamp::Startup(); - - rv = nsThreadManager::get()->Init(); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - // Set up the timer globals/timer thread - rv = nsTimerImpl::Startup(); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl(); - NS_ADDREF(nsComponentManagerImpl::gComponentManager); - - rv = nsComponentManagerImpl::gComponentManager->Init(); - if (NS_FAILED(rv)) { - NS_RELEASE(nsComponentManagerImpl::gComponentManager); - return rv; - } - - mozilla::InitNetModuleStandalone(); - - return NS_OK; -} - -nsresult -NS_ShutdownXPCOMRT() -{ - nsresult rv = NS_OK; - - // Notify observers of xpcom shutting down - { - // Block it so that the COMPtr will get deleted before we hit - // servicemanager shutdown - - nsCOMPtr<nsIThread> thread = do_GetCurrentThread(); - - if (NS_WARN_IF(!thread)) { - return NS_ERROR_UNEXPECTED; - } - - RefPtr<nsObserverService> observerService; - CallGetService("@mozilla.org/observer-service;1", - (nsObserverService**)getter_AddRefs(observerService)); - - if (observerService) { - observerService->NotifyObservers(nullptr, - NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID, - nullptr); - - nsCOMPtr<nsIServiceManager> mgr; - rv = NS_GetServiceManager(getter_AddRefs(mgr)); - if (NS_SUCCEEDED(rv)) { - observerService->NotifyObservers(mgr, NS_XPCOM_SHUTDOWN_OBSERVER_ID, - nullptr); - } - } - - // This must happen after the shutdown of media and widgets, which - // are triggered by the NS_XPCOM_SHUTDOWN_OBSERVER_ID notification. - NS_ProcessPendingEvents(thread); - - if (observerService) - observerService->NotifyObservers(nullptr, - NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID, - nullptr); - - gXPCOMThreadsShutDown = true; - NS_ProcessPendingEvents(thread); - - // Shutdown the timer thread and all timers that might still be alive before - // shutting down the component manager - nsTimerImpl::Shutdown(); - - NS_ProcessPendingEvents(thread); - - // Net module needs to be shutdown before the thread manager or else - // the thread manager will hang waiting for the socket transport - // service to shutdown. - mozilla::ShutdownNetModuleStandalone(); - - // Shutdown all remaining threads. This method does not return until - // all threads created using the thread manager (with the exception of - // the main thread) have exited. - nsThreadManager::get()->Shutdown(); - - NS_ProcessPendingEvents(thread); - } - - mozilla::services::Shutdown(); - - // Shutdown global servicemanager - if (nsComponentManagerImpl::gComponentManager) { - nsComponentManagerImpl::gComponentManager->FreeServices(); - } - - // Shutdown xpcom. This will release all loaders and cause others holding - // a refcount to the component manager to release it. - if (nsComponentManagerImpl::gComponentManager) { - rv = (nsComponentManagerImpl::gComponentManager)->Shutdown(); - NS_ASSERTION(NS_SUCCEEDED(rv), "Component Manager shutdown failed."); - } else { - NS_WARNING("Component Manager was never created ..."); - } - - // Finally, release the component manager last because it unloads the - // libraries: - if (nsComponentManagerImpl::gComponentManager) { - nsrefcnt cnt; - NS_RELEASE2(nsComponentManagerImpl::gComponentManager, cnt); - NS_ASSERTION(cnt == 0, "Component Manager being held past XPCOM shutdown."); - } - nsComponentManagerImpl::gComponentManager = nullptr; - nsCategoryManager::Destroy(); - - return NS_OK; -}
deleted file mode 100644 --- a/xpcom/libxpcomrt/XPCOMRTInit.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* vim:set ts=4 sw=4 sts=4 ci et: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef XPCOMRT_INIT_H__ -#define XPCOMRT_INIT_H__ - -#include "nsError.h" - -nsresult NS_InitXPCOMRT(); -nsresult NS_ShutdownXPCOMRT(); - -#endif // define XPCOMRT_INIT_H__
deleted file mode 100644 --- a/xpcom/libxpcomrt/XPCOMRTModule.inc +++ /dev/null @@ -1,8 +0,0 @@ - COMPONENT(MEMORY, nsMemoryImpl::Create) - COMPONENT(DEBUG, nsDebugImpl::Create) - COMPONENT(CATEGORYMANAGER, nsCategoryManager::Create) - COMPONENT(OBSERVERSERVICE, nsObserverService::Create) - COMPONENT(TIMER, nsTimerImplConstructor) - COMPONENT(THREADMANAGER, nsThreadManagerGetSingleton) - COMPONENT(THREADPOOL, nsThreadPoolConstructor) - COMPONENT(UUID_GENERATOR, nsUUIDGeneratorConstructor)
deleted file mode 100644 --- a/xpcom/libxpcomrt/XPCOMRTStubs.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* vim:set ts=4 sw=4 sts=4 ci et: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsXULAppAPI.h" -#include "mozilla/TimeStamp.h" - - -GeckoProcessType -XRE_GetProcessType() -{ - return GeckoProcessType_Default; -} - -bool -XRE_IsParentProcess() -{ - return XRE_GetProcessType() == GeckoProcessType_Default; -} - -bool -XRE_IsContentProcess() -{ - return XRE_GetProcessType() == GeckoProcessType_Content; -} - -#define PRINT_CALLED fprintf(stderr, "!!! ERROR: function %s defined in file %s should not be called, needs to be correctly implemented.\n", __FUNCTION__, __FILE__) - -class nsAString; -class nsCString; - -namespace base { - class Histogram; -} // namespace base - -namespace mozilla { -namespace Telemetry { - -#include "mozilla/TelemetryHistogramEnums.h" - -void Accumulate(ID id, uint32_t sample) {} -void Accumulate(ID id, const nsCString& key, uint32_t sample) {} -void Accumulate(const char* name, uint32_t sample) {} -void AccumulateTimeDelta(ID id, TimeStamp start, TimeStamp end) {} - -base::Histogram* GetHistogramById(ID id) -{ - return nullptr; -} - -base::Histogram* GetKeyedHistogramById(ID id, const nsAString&) -{ - return nullptr; -} - -} // namespace Telemetry - -namespace detail { - -void log_print(const PRLogModuleInfo* aModule, LogLevel aLevel, const char* aFmt, ...) {} - -} // namespace detail -} // namespace mozilla
deleted file mode 100644 --- a/xpcom/libxpcomrt/docs/index.rst +++ /dev/null @@ -1,40 +0,0 @@ -========================== - XPCOM Standalone Library -========================== - -What it is for --------------- -The XPCOM standalone library, libxpcomrt, was created to support building the WebRTC -standalone library. The libxpcomrt library contains only the parts of XPCOM that are required -to run WebRTC; parts such as the cycle collector and the startup cache required only by Gecko -are not included. A library containing a small subset of Necko was also -created to support the WebRTC standalone library. - -The libxcomrt library was created specifically to support the WebRTC standalone library. -It is not intended to be used as a general purpose library to add XPCOM functionality to -an application. It is likely that some of the code contained in the libxpcomrt library -has unresolved symbols that may be exposed if used for purposes other than being linked -into the WebRTC standalone library. - -How to use it -------------- -When compiling code utilizing libxpcomrt, both ``MOZILLA_INTERNAL_API`` and ``MOZILLA_XPCOMRT_API`` -must be defined in addition to whatever standard flags are used to compile Gecko. -The library is initialized with ``NS_InitXPCOMRT()`` and shutdown with ``NS_ShutdownXPCOMRT()``. -Both functions are declared in xpcom/libxpcomrt/XPCOMRTInit.h. -Only a small number of services which are required for the WebRTC -standalone library to function are included with libxpcomrt. The dynamic loading of services is not -supported. Including a service through ``NSMODULE_DEFN`` and static linking is also not supported. -The only way to add a service to libxpcomrt is to explicitly start the service during -``nsComponentManagerImpl::Init`` in xpcom/components/nsComponentManager.cpp. -The best method to determine what parts of XPCOM are included in libxpcomrt is to examine the -xpcom/libxpcomrt/moz.build file. It contains all of the XPCOM source files used to build libxpcomrt. -A few of the services that are included are: - -* UUID Generator -* DNS Service -* Socket Transport Service -* IDN Service - -All dependencies on ipc/chromium have been removed. -IO and preference services are not included making this library of limited utility.
deleted file mode 100644 --- a/xpcom/libxpcomrt/moz.build +++ /dev/null @@ -1,142 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': - Library('xpcomrt') - -src_list = [ - 'XPCOMRTInit.cpp', - 'XPCOMRTStubs.cpp', -] - -xpcom_base_src = [ - 'nsDebugImpl.cpp', - 'nsMemoryImpl.cpp', - 'nsUUIDGenerator.cpp', -] -src_list += [ - '/xpcom/base/%s' % s for s in xpcom_base_src -] - -xpcom_build_src = [ - 'FileLocation.cpp', - 'Services.cpp', -] -src_list += [ - '/xpcom/build/%s' % s for s in xpcom_build_src -] - -xpcom_components_src = [ - 'nsCategoryManager.cpp', - 'nsComponentManager.cpp', -] -src_list += [ - '/xpcom/components/%s' % s for s in xpcom_components_src -] - -xpcom_ds_src = [ - 'nsObserverList.cpp', - 'nsObserverService.cpp', - 'nsStringEnumerator.cpp', - 'nsSupportsPrimitives.cpp', -] - -src_list += [ - '/xpcom/ds/%s' % s for s in xpcom_ds_src -] - -xpcom_glue_src = [ - 'BlockingResourceBase.cpp', - 'nsArrayEnumerator.cpp', - 'nsClassInfoImpl.cpp', - 'nsCOMArray.cpp', - 'nsCOMPtr.cpp', - 'nsCRTGlue.cpp', - 'nsComponentManagerUtils.cpp', - 'nsEnumeratorUtils.cpp', - 'GenericFactory.cpp', - 'nsID.cpp', - 'nsISupportsImpl.cpp', - 'nsMemory.cpp', - 'nsQuickSort.cpp', - 'nsTArray.cpp', - 'nsTObserverArray.cpp', - 'nsThreadUtils.cpp', - 'nsWeakReference.cpp', - 'PLDHashTable.cpp', -] -src_list += [ - '/xpcom/glue/%s' % s for s in xpcom_glue_src -] - -xpcom_io_src = [ - 'nsNativeCharsetUtils.cpp', -] -src_list += [ - '/xpcom/io/%s' % s for s in xpcom_io_src -] - -xpcom_string_src = [ - 'nsDependentSubstring.cpp', - 'nsPromiseFlatString.cpp', - 'nsReadableUtils.cpp', - 'nsString.cpp', - 'nsStringComparator.cpp', - 'nsStringObsolete.cpp', - 'nsSubstring.cpp', - 'nsSubstringTuple.cpp', -] -if CONFIG['INTEL_ARCHITECTURE']: - xpcom_string_src += ['nsUTF8UtilsSSE2.cpp'] -src_list += [ - '/xpcom/string/%s' % s for s in xpcom_string_src -] - -xpcom_threads_src = [ - 'LazyIdleThread.cpp', - 'nsEnvironment.cpp', - 'nsEventQueue.cpp', - 'nsMemoryPressure.cpp', - 'nsProcessCommon.cpp', - 'nsThread.cpp', - 'nsThreadManager.cpp', - 'nsThreadPool.cpp', - 'nsTimerImpl.cpp', - 'TimerThread.cpp', -] -src_list += [ - '/xpcom/threads/%s' % s for s in xpcom_threads_src -] - - -SOURCES += sorted(src_list) - -if CONFIG['INTEL_ARCHITECTURE']: - sse_string_path = '/xpcom/string/nsUTF8UtilsSSE2.cpp' - SOURCES[sse_string_path].flags += CONFIG['SSE2_FLAGS'] - -LOCAL_INCLUDES = [ - '!..', - '../base', - '../build', - '../components', - '../ds', - '../glue', - '../threads', - '/netwerk/standalone/', - '/xpcom/reflect/xptinfo/', -] - -DEFINES['MOZILLA_INTERNAL_API'] = True -DEFINES['MOZILLA_XPCOMRT_API'] = True -DEFINES['MOZILLA_EXTERNAL_LINKAGE'] = True - -include('/ipc/chromium/chromium-config.mozbuild') - -SPHINX_TREES['libxpcomrt'] = 'docs' - -if CONFIG['GNU_CXX']: - CXXFLAGS += ['-Wshadow']