Backed out changeset 0f5799df920b (bug 1093934) for various test failures CLOSED TREE
This commit is contained in:
@@ -141,7 +141,7 @@ MOZ_ReportAssertionFailure(const char* aStr, const char* aFilename, int aLine)
|
||||
aStr, aFilename, aLine);
|
||||
#else
|
||||
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", aStr, aFilename, aLine);
|
||||
#if defined (MOZ_DUMP_ASSERTION_STACK) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#ifdef MOZ_DUMP_ASSERTION_STACK
|
||||
nsTraceRefcnt::WalkTheStack(stderr);
|
||||
#endif
|
||||
fflush(stderr);
|
||||
@@ -157,7 +157,7 @@ MOZ_ReportCrash(const char* aStr, const char* aFilename, int aLine)
|
||||
"Hit MOZ_CRASH(%s) at %s:%d\n", aStr, aFilename, aLine);
|
||||
#else
|
||||
fprintf(stderr, "Hit MOZ_CRASH(%s) at %s:%d\n", aStr, aFilename, aLine);
|
||||
#if defined(MOZ_DUMP_ASSERTION_STACK) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#ifdef MOZ_DUMP_ASSERTION_STACK
|
||||
nsTraceRefcnt::WalkTheStack(stderr);
|
||||
#endif
|
||||
fflush(stderr);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#endif
|
||||
|
||||
#if defined(MOZILLA_INTERNAL_API) && \
|
||||
!defined(MOZILLA_XPCOMRT_API) && \
|
||||
(defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
|
||||
#define MOZ_REFCOUNTED_LEAK_CHECKING
|
||||
#endif
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
* symbols. We add the weak attribute to the import version of the MFBT API
|
||||
* macros to exploit this.
|
||||
*/
|
||||
# if defined(MOZ_GLUE_IN_PROGRAM) && !defined(MOZILLA_XPCOMRT_API)
|
||||
# if defined(MOZ_GLUE_IN_PROGRAM)
|
||||
# define MFBT_API __attribute__((weak)) MOZ_IMPORT_API
|
||||
# define MFBT_DATA __attribute__((weak)) MOZ_IMPORT_DATA
|
||||
# else
|
||||
|
||||
@@ -237,7 +237,7 @@ class ProcessedStack;
|
||||
* @param aFirefoxUptime - Firefox uptime at the time of the hang, in minutes
|
||||
* @param aAnnotations - Any annotations to be added to the report
|
||||
*/
|
||||
#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#if defined(MOZ_ENABLE_PROFILER_SPS)
|
||||
void RecordChromeHang(uint32_t aDuration,
|
||||
ProcessedStack &aStack,
|
||||
int32_t aSystemUptime,
|
||||
|
||||
@@ -51,8 +51,6 @@
|
||||
|
||||
#include "js/TypeDecls.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/GuardObjects.h"
|
||||
#include "ProfilerBacktrace.h"
|
||||
|
||||
namespace mozilla {
|
||||
class TimeStamp;
|
||||
@@ -66,7 +64,7 @@ enum TracingMetadata {
|
||||
TRACING_EVENT_BACKTRACE
|
||||
};
|
||||
|
||||
#if !defined(MOZ_ENABLE_PROFILER_SPS) || defined(MOZILLA_XPCOMRT_API)
|
||||
#ifndef MOZ_ENABLE_PROFILER_SPS
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -353,9 +353,7 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
|
||||
if (sMultiprocessDescription) {
|
||||
PrintToBuffer("%s ", sMultiprocessDescription);
|
||||
}
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
PrintToBuffer("%d] ", base::GetCurrentProcId());
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
PrintToBuffer("%s: ", sevString);
|
||||
|
||||
@@ -405,7 +403,7 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
|
||||
return;
|
||||
|
||||
case NS_DEBUG_ABORT: {
|
||||
#if defined(MOZ_CRASHREPORTER) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
// Updating crash annotations in the child causes us to do IPC. This can
|
||||
// really cause trouble if we're asserting from within IPC code. So we
|
||||
// have to do without the annotations in that case.
|
||||
@@ -422,7 +420,7 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
|
||||
#if defined(DEBUG) && defined(_WIN32)
|
||||
RealBreak();
|
||||
#endif
|
||||
#if defined(DEBUG) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#ifdef DEBUG
|
||||
nsTraceRefcnt::WalkTheStack(stderr);
|
||||
#endif
|
||||
Abort(buf.buffer);
|
||||
@@ -447,15 +445,11 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
|
||||
return;
|
||||
|
||||
case NS_ASSERT_STACK:
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
nsTraceRefcnt::WalkTheStack(stderr);
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
return;
|
||||
|
||||
case NS_ASSERT_STACK_AND_ABORT:
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
nsTraceRefcnt::WalkTheStack(stderr);
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
// Fall through to abort
|
||||
|
||||
case NS_ASSERT_ABORT:
|
||||
@@ -622,7 +616,7 @@ NS_ErrorAccordingToNSPR()
|
||||
void
|
||||
NS_ABORT_OOM(size_t aSize)
|
||||
{
|
||||
#if defined(MOZ_CRASHREPORTER) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::AnnotateOOMAllocationSize(aSize);
|
||||
#endif
|
||||
MOZ_CRASH();
|
||||
|
||||
@@ -516,7 +516,7 @@ nsresult RegisterNonJSSizeOfTab(NonJSSizeOfTabFn aSizeOfTabFn);
|
||||
|
||||
}
|
||||
|
||||
#if defined(MOZ_DMD) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#if defined(MOZ_DMD)
|
||||
namespace mozilla {
|
||||
namespace dmd {
|
||||
// This runs all the memory reporters in the current process but does nothing
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "FileLocation.h"
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
#include "nsZipArchive.h"
|
||||
#include "nsURLHelper.h"
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@@ -33,12 +31,9 @@ FileLocation::FileLocation(const FileLocation& aFile, const char* aPath)
|
||||
if (aFile.IsZip()) {
|
||||
if (aFile.mBaseFile) {
|
||||
Init(aFile.mBaseFile, aFile.mPath.get());
|
||||
}
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
else {
|
||||
} else {
|
||||
Init(aFile.mBaseZip, aFile.mPath.get());
|
||||
}
|
||||
#endif
|
||||
if (aPath) {
|
||||
int32_t i = mPath.RFindChar('/');
|
||||
if (kNotFound == i) {
|
||||
@@ -76,9 +71,7 @@ FileLocation::FileLocation(const FileLocation& aFile, const char* aPath)
|
||||
void
|
||||
FileLocation::Init(nsIFile* aFile)
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
mBaseZip = nullptr;
|
||||
#endif //!defined(MOZILLA_XPCOMRT_API)
|
||||
mBaseFile = aFile;
|
||||
mPath.Truncate();
|
||||
}
|
||||
@@ -86,9 +79,7 @@ FileLocation::Init(nsIFile* aFile)
|
||||
void
|
||||
FileLocation::Init(nsIFile* aFile, const char* aPath)
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
mBaseZip = nullptr;
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
mBaseFile = aFile;
|
||||
mPath = aPath;
|
||||
}
|
||||
@@ -96,9 +87,7 @@ FileLocation::Init(nsIFile* aFile, const char* aPath)
|
||||
void
|
||||
FileLocation::Init(nsZipArchive* aZip, const char* aPath)
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
mBaseZip = aZip;
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
mBaseFile = nullptr;
|
||||
mPath = aPath;
|
||||
}
|
||||
@@ -106,7 +95,6 @@ FileLocation::Init(nsZipArchive* aZip, const char* aPath)
|
||||
void
|
||||
FileLocation::GetURIString(nsACString& aResult) const
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
if (mBaseFile) {
|
||||
net_GetURLSpecFromActualFile(mBaseFile, aResult);
|
||||
} else if (mBaseZip) {
|
||||
@@ -118,13 +106,11 @@ FileLocation::GetURIString(nsACString& aResult) const
|
||||
aResult += "!/";
|
||||
aResult += mPath;
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
|
||||
already_AddRefed<nsIFile>
|
||||
FileLocation::GetBaseFile()
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
if (IsZip() && mBaseZip) {
|
||||
nsRefPtr<nsZipHandle> handler = mBaseZip->GetFD();
|
||||
if (handler) {
|
||||
@@ -132,7 +118,6 @@ FileLocation::GetBaseFile()
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
nsCOMPtr<nsIFile> file = mBaseFile;
|
||||
return file.forget();
|
||||
@@ -152,7 +137,6 @@ FileLocation::Equals(const FileLocation& aFile) const
|
||||
|
||||
const FileLocation* a = this;
|
||||
const FileLocation* b = &aFile;
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
if (a->mBaseZip) {
|
||||
nsRefPtr<nsZipHandle> handler = a->mBaseZip->GetFD();
|
||||
a = &handler->mFile;
|
||||
@@ -161,15 +145,12 @@ FileLocation::Equals(const FileLocation& aFile) const
|
||||
nsRefPtr<nsZipHandle> handler = b->mBaseZip->GetFD();
|
||||
b = &handler->mFile;
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
return a->Equals(*b);
|
||||
}
|
||||
|
||||
nsresult
|
||||
FileLocation::GetData(Data& aData)
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
if (!IsZip()) {
|
||||
return mBaseFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &aData.mFd.rwget());
|
||||
}
|
||||
@@ -182,7 +163,6 @@ FileLocation::GetData(Data& aData)
|
||||
if (aData.mItem) {
|
||||
return NS_OK;
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
|
||||
}
|
||||
|
||||
@@ -201,13 +181,10 @@ FileLocation::Data::GetSize(uint32_t* aResult)
|
||||
|
||||
*aResult = fileInfo.size;
|
||||
return NS_OK;
|
||||
}
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
else if (mItem) {
|
||||
} else if (mItem) {
|
||||
*aResult = mItem->RealSize();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
@@ -224,16 +201,13 @@ FileLocation::Data::Copy(char* aBuf, uint32_t aLen)
|
||||
totalRead += read;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
else if (mItem) {
|
||||
} else if (mItem) {
|
||||
nsZipCursor cursor(mItem, mZip, reinterpret_cast<uint8_t*>(aBuf),
|
||||
aLen, true);
|
||||
uint32_t readLen;
|
||||
cursor.Copy(&readLen);
|
||||
return (readLen == aLen) ? NS_OK : NS_ERROR_FILE_CORRUPTED;
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,11 +87,7 @@ public:
|
||||
* Boolean value corresponding to whether the file location is initialized
|
||||
* or not.
|
||||
*/
|
||||
#if defined(MOZILLA_XPCOMRT_API)
|
||||
operator bool() const { return mBaseFile; }
|
||||
#else
|
||||
operator bool() const { return mBaseFile || mBaseZip; }
|
||||
#endif // defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
/**
|
||||
* Returns whether another FileLocation points to the same resource
|
||||
@@ -115,9 +111,7 @@ public:
|
||||
nsresult Copy(char* aBuf, uint32_t aLen);
|
||||
protected:
|
||||
friend class FileLocation;
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
nsZipItem* mItem;
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
nsRefPtr<nsZipArchive> mZip;
|
||||
mozilla::AutoFDClose mFd;
|
||||
};
|
||||
@@ -129,9 +123,7 @@ public:
|
||||
nsresult GetData(Data& aData);
|
||||
private:
|
||||
nsCOMPtr<nsIFile> mBaseFile;
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
nsRefPtr<nsZipArchive> mBaseZip;
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
nsCString mPath;
|
||||
}; /* class FileLocation */
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
// IWYU pragma: private, include "mozilla/Services.h"
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
#ifdef ACCESSIBILITY
|
||||
MOZ_SERVICE(AccessibilityService, nsIAccessibilityService,
|
||||
"@mozilla.org/accessibilityService;1")
|
||||
@@ -18,10 +17,8 @@ MOZ_SERVICE(XULOverlayProviderService, nsIXULOverlayProvider,
|
||||
"@mozilla.org/chrome/chrome-registry;1")
|
||||
MOZ_SERVICE(IOService, nsIIOService,
|
||||
"@mozilla.org/network/io-service;1")
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
MOZ_SERVICE(ObserverService, nsIObserverService,
|
||||
"@mozilla.org/observer-service;1")
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
MOZ_SERVICE(StringBundleService, nsIStringBundleService,
|
||||
"@mozilla.org/intl/stringbundle;1")
|
||||
MOZ_SERVICE(XPConnect, nsIXPConnect,
|
||||
@@ -47,4 +44,3 @@ MOZ_SERVICE(HistoryService, IHistory,
|
||||
#ifdef MOZ_USE_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
@@ -6,17 +6,16 @@
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsComponentManager.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsObserverService.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIDirectoryService.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
#include "nsIChromeRegistry.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsObserverService.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIToolkitChromeRegistry.h"
|
||||
#include "nsIXULOverlayProvider.h"
|
||||
@@ -26,7 +25,6 @@
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIServiceWorkerManager.h"
|
||||
#include "nsIAsyncShutdown.h"
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::services;
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
#define ManifestParser_h
|
||||
|
||||
#include "nsComponentManager.h"
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
#include "nsChromeRegistry.h"
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
#include "mozilla/FileLocation.h"
|
||||
|
||||
class nsIFile;
|
||||
|
||||
@@ -469,9 +469,7 @@ nsCategoryManager::nsCategoryManager()
|
||||
void
|
||||
nsCategoryManager::InitMemoryReporter()
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
RegisterStrongMemoryReporter(this);
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
|
||||
nsCategoryManager::~nsCategoryManager()
|
||||
@@ -864,10 +862,8 @@ NS_CreateServicesFromCategory(const char* aCategory,
|
||||
|
||||
nsCOMPtr<nsISupports> instance = do_GetService(contractID);
|
||||
if (!instance) {
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
LogMessage("While creating services from category '%s', could not create service for entry '%s', contract ID '%s'",
|
||||
aCategory, entryString.get(), contractID.get());
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -877,10 +873,8 @@ NS_CreateServicesFromCategory(const char* aCategory,
|
||||
if (observer) {
|
||||
observer->Observe(aOrigin, aObserverTopic, EmptyString().get());
|
||||
} else {
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
LogMessage("While creating services from category '%s', service for entry '%s', contract ID '%s' does not implement nsIObserver.",
|
||||
aCategory, entryString.get(), contractID.get());
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,7 @@
|
||||
#include "private/pprthred.h"
|
||||
#include "nsTArray.h"
|
||||
#include "prio.h"
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
#include "ManifestParser.h"
|
||||
#include "nsNetUtil.h"
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "mozilla/GenericFactory.h"
|
||||
@@ -71,6 +68,7 @@
|
||||
#include "nsArrayEnumerator.h"
|
||||
#include "nsStringEnumerator.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
||||
#include <new> // for placement new
|
||||
@@ -252,7 +250,6 @@ private:
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
// this is safe to call during InitXPCOM
|
||||
static already_AddRefed<nsIFile>
|
||||
GetLocationFromDirectoryService(const char* aProp)
|
||||
@@ -289,7 +286,6 @@ CloneAndAppend(nsIFile* aBase, const nsACString& aAppend)
|
||||
f->AppendNative(aAppend);
|
||||
return f.forget();
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsComponentManagerImpl
|
||||
@@ -322,10 +318,8 @@ nsComponentManagerImpl::nsComponentManagerImpl()
|
||||
|
||||
nsTArray<const mozilla::Module*>* nsComponentManagerImpl::sStaticModules;
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
NSMODULE_DEFN(start_kPStaticModules);
|
||||
NSMODULE_DEFN(end_kPStaticModules);
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
/* The content between start_kPStaticModules and end_kPStaticModules is gathered
|
||||
* by the linker from various objects containing symbols in a specific section.
|
||||
@@ -341,14 +335,12 @@ nsComponentManagerImpl::InitializeStaticModules()
|
||||
}
|
||||
|
||||
sStaticModules = new nsTArray<const mozilla::Module*>;
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
for (const mozilla::Module * const* staticModules =
|
||||
&NSMODULE_NAME(start_kPStaticModules) + 1;
|
||||
staticModules < &NSMODULE_NAME(end_kPStaticModules); ++staticModules)
|
||||
if (*staticModules) { // ASAN adds padding
|
||||
sStaticModules->AppendElement(*staticModules);
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
|
||||
nsTArray<nsComponentManagerImpl::ComponentLocation>*
|
||||
@@ -376,35 +368,26 @@ nsComponentManagerImpl::Init()
|
||||
// Initialize our arena
|
||||
PL_INIT_ARENA_POOL(&mArena, "ComponentManagerArena", NS_CM_BLOCK_SIZE);
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
nsCOMPtr<nsIFile> greDir =
|
||||
GetLocationFromDirectoryService(NS_GRE_DIR);
|
||||
nsCOMPtr<nsIFile> appDir =
|
||||
GetLocationFromDirectoryService(NS_XPCOM_CURRENT_PROCESS_DIR);
|
||||
#endif
|
||||
|
||||
InitializeStaticModules();
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
nsresult rv = mNativeModuleLoader.Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCategoryManager::GetSingleton()->SuppressNotifications(true);
|
||||
#endif
|
||||
|
||||
#if defined(MOZILLA_XPCOMRT_API)
|
||||
RegisterModule(&kXPCOMRTModule, nullptr);
|
||||
#else
|
||||
RegisterModule(&kXPCOMModule, nullptr);
|
||||
#endif // defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
for (uint32_t i = 0; i < sStaticModules->Length(); ++i) {
|
||||
RegisterModule((*sStaticModules)[i], nullptr);
|
||||
}
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
// The overall order in which chrome.manifests are expected to be treated
|
||||
// is the following:
|
||||
// - greDir
|
||||
@@ -449,7 +432,6 @@ nsComponentManagerImpl::Init()
|
||||
nsCategoryManager::GetSingleton()->SuppressNotifications(false);
|
||||
|
||||
RegisterWeakMemoryReporter(this);
|
||||
#endif
|
||||
|
||||
// Unfortunately, we can't register the nsCategoryManager memory reporter
|
||||
// in its constructor (which is triggered by the GetSingleton() call
|
||||
@@ -558,12 +540,10 @@ nsComponentManagerImpl::RegisterCIDEntryLocked(
|
||||
existing = "<unknown module>";
|
||||
}
|
||||
SafeMutexAutoUnlock unlock(mLock);
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
LogMessage("While registering XPCOM module %s, trying to re-register CID '%s' already registered by %s.",
|
||||
aModule->Description().get(),
|
||||
idstr,
|
||||
existing.get());
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -589,11 +569,9 @@ nsComponentManagerImpl::RegisterContractIDLocked(
|
||||
aEntry->cid->ToProvidedString(idstr);
|
||||
|
||||
SafeMutexAutoUnlock unlock(mLock);
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
LogMessage("Could not map contract ID '%s' to CID %s because no implementation of the CID is registered.",
|
||||
aEntry->contractid,
|
||||
idstr);
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -601,7 +579,6 @@ nsComponentManagerImpl::RegisterContractIDLocked(
|
||||
mContractIDs.Put(nsDependentCString(aEntry->contractid), f);
|
||||
}
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
static void
|
||||
CutExtension(nsCString& aPath)
|
||||
{
|
||||
@@ -844,12 +821,10 @@ nsComponentManagerImpl::RereadChromeManifests(bool aChromeOnly)
|
||||
RegisterManifest(l.type, l.location, aChromeOnly);
|
||||
}
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
bool
|
||||
nsComponentManagerImpl::KnownModule::EnsureLoader()
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
if (!mLoader) {
|
||||
nsCString extension;
|
||||
mFile.GetURIString(extension);
|
||||
@@ -857,7 +832,6 @@ nsComponentManagerImpl::KnownModule::EnsureLoader()
|
||||
mLoader =
|
||||
nsComponentManagerImpl::gComponentManager->LoaderForExtension(extension);
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
return !!mLoader;
|
||||
}
|
||||
|
||||
@@ -914,9 +888,7 @@ nsresult nsComponentManagerImpl::Shutdown(void)
|
||||
PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG,
|
||||
("nsComponentManager: Beginning Shutdown."));
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
UnregisterWeakMemoryReporter(this);
|
||||
#endif
|
||||
|
||||
// Release all cached factories
|
||||
mContractIDs.Clear();
|
||||
@@ -932,10 +904,8 @@ nsresult nsComponentManagerImpl::Shutdown(void)
|
||||
sXPTIInfosBook = nullptr;
|
||||
#endif
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
// Unload libraries
|
||||
mNativeModuleLoader.UnloadLibraries();
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
// delete arena for strings and small objects
|
||||
PL_FinishArenaPool(&mArena);
|
||||
@@ -1619,7 +1589,6 @@ nsComponentManagerImpl::GetServiceByContractID(const char* aContractID,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
already_AddRefed<mozilla::ModuleLoader>
|
||||
nsComponentManagerImpl::LoaderForExtension(const nsACString& aExt)
|
||||
{
|
||||
@@ -1636,7 +1605,6 @@ nsComponentManagerImpl::LoaderForExtension(const nsACString& aExt)
|
||||
|
||||
return loader.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::RegisterFactory(const nsCID& aClass,
|
||||
@@ -1709,12 +1677,8 @@ nsComponentManagerImpl::UnregisterFactory(const nsCID& aClass,
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::AutoRegister(nsIFile* aLocation)
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
XRE_AddManifestLocation(NS_COMPONENT_LOCATION, aLocation);
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -2050,7 +2014,6 @@ XRE_AddStaticComponent(const mozilla::Module* aComponent)
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::AddBootstrappedManifestLocation(nsIFile* aLocation)
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
nsString path;
|
||||
nsresult rv = aLocation->GetPath(path);
|
||||
if (NS_FAILED(rv)) {
|
||||
@@ -2064,15 +2027,11 @@ nsComponentManagerImpl::AddBootstrappedManifestLocation(nsIFile* aLocation)
|
||||
nsCOMPtr<nsIFile> manifest =
|
||||
CloneAndAppend(aLocation, NS_LITERAL_CSTRING("chrome.manifest"));
|
||||
return XRE_AddManifestLocation(NS_BOOTSTRAPPED_LOCATION, manifest);
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::RemoveBootstrappedManifestLocation(nsIFile* aLocation)
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
nsCOMPtr<nsIChromeRegistry> cr = mozilla::services::GetChromeRegistryService();
|
||||
if (!cr) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@@ -2102,15 +2061,11 @@ nsComponentManagerImpl::RemoveBootstrappedManifestLocation(nsIFile* aLocation)
|
||||
|
||||
rv = cr->CheckForNewChrome();
|
||||
return rv;
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::GetManifestLocations(nsIArray** aLocations)
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
NS_ENSURE_ARG_POINTER(aLocations);
|
||||
*aLocations = nullptr;
|
||||
|
||||
@@ -2134,9 +2089,6 @@ nsComponentManagerImpl::GetManifestLocations(nsIArray** aLocations)
|
||||
|
||||
locations.forget(aLocations);
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_LOADER
|
||||
@@ -2185,7 +2137,6 @@ PreloadXPT(nsIFile* aOmnijarFile)
|
||||
|
||||
#endif /* MOZ_B2G_LOADER */
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
EXPORT_XPCOM_API(nsresult)
|
||||
XRE_AddManifestLocation(NSLocationType aType, nsIFile* aLocation)
|
||||
{
|
||||
@@ -2226,5 +2177,4 @@ XRE_AddJarManifestLocation(NSLocationType aType, nsIFile* aLocation)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
|
||||
@@ -67,11 +67,7 @@ extern const char staticComponentType[];
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(MOZILLA_XPCOMRT_API)
|
||||
extern const mozilla::Module kXPCOMRTModule;
|
||||
#else
|
||||
extern const mozilla::Module kXPCOMModule;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is a wrapper around mozilla::Mutex which provides runtime
|
||||
|
||||
@@ -104,13 +104,11 @@ nsObserverList::NotifyObservers(nsISupports* aSubject,
|
||||
void
|
||||
nsObserverList::UnmarkGrayStrongObservers()
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
for (uint32_t i = 0; i < mObservers.Length(); ++i) {
|
||||
if (!mObservers[i].isWeakRef) {
|
||||
xpc_TryUnmarkWrappedGrayObject(mObservers[i].asObserver());
|
||||
}
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsObserverEnumerator, nsISimpleEnumerator)
|
||||
|
||||
@@ -205,17 +205,13 @@ nsObserverService::~nsObserverService(void)
|
||||
void
|
||||
nsObserverService::RegisterReporter()
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
RegisterWeakMemoryReporter(this);
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
|
||||
void
|
||||
nsObserverService::Shutdown()
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
UnregisterWeakMemoryReporter(this);
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
mShuttingDown = true;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
||||
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
#include "GeckoProfiler.h"
|
||||
#endif //MOZILLA_INTERNAL_API
|
||||
|
||||
@@ -461,7 +461,7 @@ ReentrantMonitor::Wait(PRIntervalTime aInterval)
|
||||
mChainPrev = 0;
|
||||
|
||||
nsresult rv;
|
||||
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
{
|
||||
GeckoProfilerSleepRAII profiler_sleep;
|
||||
#endif //MOZILLA_INTERNAL_API
|
||||
@@ -470,7 +470,7 @@ ReentrantMonitor::Wait(PRIntervalTime aInterval)
|
||||
rv = PR_Wait(mReentrantMonitor, aInterval) == PR_SUCCESS ? NS_OK :
|
||||
NS_ERROR_FAILURE;
|
||||
|
||||
#if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
}
|
||||
#endif //MOZILLA_INTERNAL_API
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ private:
|
||||
|
||||
// Macros for reference-count and constructor logging
|
||||
|
||||
#if defined(NS_BUILD_REFCNT_LOGGING) && !defined(MOZILLA_XPCOMRT_API)
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
|
||||
#define NS_LOG_ADDREF(_p, _rc, _type, _size) \
|
||||
NS_LogAddRef((_p), (_rc), (_type), (uint32_t) (_size))
|
||||
@@ -181,11 +181,6 @@ do { \
|
||||
NS_LogCtor((void*)this, #_type, sizeof(*this) - sizeof(_base)); \
|
||||
} while (0)
|
||||
|
||||
#define MOZ_LOG_CTOR(_ptr, _name, _size) \
|
||||
do { \
|
||||
NS_LogCtor((void*)_ptr, _name, _size); \
|
||||
} while (0)
|
||||
|
||||
#define MOZ_COUNT_DTOR(_type) \
|
||||
do { \
|
||||
MOZ_ASSERT_CLASSNAME(_type); \
|
||||
@@ -199,11 +194,6 @@ do { \
|
||||
NS_LogDtor((void*)this, #_type, sizeof(*this) - sizeof(_base)); \
|
||||
} while (0)
|
||||
|
||||
#define MOZ_LOG_DTOR(_ptr, _name, _size) \
|
||||
do { \
|
||||
NS_LogDtor((void*)_ptr, _name, _size); \
|
||||
} while (0)
|
||||
|
||||
/* nsCOMPtr.h allows these macros to be defined by clients
|
||||
* These logging functions require dynamic_cast<void*>, so they don't
|
||||
* do anything useful if we don't have dynamic_cast<void*>. */
|
||||
@@ -221,10 +211,8 @@ do { \
|
||||
#define NS_LOG_RELEASE(_p, _rc, _type)
|
||||
#define MOZ_COUNT_CTOR(_type)
|
||||
#define MOZ_COUNT_CTOR_INHERITED(_type, _base)
|
||||
#define MOZ_LOG_CTOR(_ptr, _name, _size)
|
||||
#define MOZ_COUNT_DTOR(_type)
|
||||
#define MOZ_COUNT_DTOR_INHERITED(_type, _base)
|
||||
#define MOZ_LOG_DTOR(_ptr, _name, _size)
|
||||
|
||||
#endif /* NS_BUILD_REFCNT_LOGGING */
|
||||
|
||||
|
||||
@@ -1,190 +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 "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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
nsRefPtr<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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
@@ -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__
|
||||
@@ -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)
|
||||
@@ -1,47 +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;
|
||||
}
|
||||
|
||||
#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 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;
|
||||
}
|
||||
|
||||
} // Telemetry
|
||||
} // mozilla
|
||||
@@ -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.
|
||||
@@ -1,153 +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 += [
|
||||
'%s/xpcom/base/%s' % (TOPSRCDIR, s) for s in xpcom_base_src
|
||||
]
|
||||
|
||||
xpcom_build_src = [
|
||||
'FileLocation.cpp',
|
||||
'Services.cpp',
|
||||
]
|
||||
src_list += [
|
||||
'%s/xpcom/build/%s' % (TOPSRCDIR, s) for s in xpcom_build_src
|
||||
]
|
||||
|
||||
xpcom_components_src = [
|
||||
'nsCategoryManager.cpp',
|
||||
'nsComponentManager.cpp',
|
||||
]
|
||||
src_list += [
|
||||
'%s/xpcom/components/%s' % (TOPSRCDIR, s) for s in xpcom_components_src
|
||||
]
|
||||
|
||||
xpcom_ds_src = [
|
||||
'nsObserverList.cpp',
|
||||
'nsObserverService.cpp',
|
||||
'nsStringEnumerator.cpp',
|
||||
'nsSupportsPrimitives.cpp',
|
||||
]
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
xpcom_ds_src += [
|
||||
'TimeStamp_windows.cpp',
|
||||
]
|
||||
elif CONFIG['HAVE_CLOCK_MONOTONIC']:
|
||||
xpcom_ds_src += [
|
||||
'TimeStamp_posix.cpp',
|
||||
]
|
||||
elif CONFIG['OS_ARCH'] == 'Darwin':
|
||||
xpcom_ds_src += [
|
||||
'TimeStamp_darwin.cpp',
|
||||
]
|
||||
elif CONFIG['COMPILE_ENVIRONMENT']:
|
||||
error('No TimeStamp implementation on this platform. Build will not succeed')
|
||||
src_list += [
|
||||
'%s/xpcom/ds/%s' % (TOPSRCDIR, 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',
|
||||
'nsProxyRelease.cpp',
|
||||
'nsQuickSort.cpp',
|
||||
'nsTArray.cpp',
|
||||
'nsTHashtable.cpp',
|
||||
'nsTObserverArray.cpp',
|
||||
'nsThreadUtils.cpp',
|
||||
'nsWeakReference.cpp',
|
||||
'pldhash.cpp',
|
||||
]
|
||||
src_list += [
|
||||
'%s/xpcom/glue/%s' % (TOPSRCDIR, s) for s in xpcom_glue_src
|
||||
]
|
||||
|
||||
xpcom_io_src = [
|
||||
'nsNativeCharsetUtils.cpp',
|
||||
]
|
||||
src_list += [
|
||||
'%s/xpcom/io/%s' % (TOPSRCDIR, 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 += [
|
||||
'%s/xpcom/string/%s' % (TOPSRCDIR, 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 += [
|
||||
'%s/xpcom/threads/%s' % (TOPSRCDIR, s) for s in xpcom_threads_src
|
||||
]
|
||||
|
||||
|
||||
SOURCES += sorted(src_list)
|
||||
|
||||
if CONFIG['INTEL_ARCHITECTURE']:
|
||||
sse_string_path = '%s/xpcom/string/nsUTF8UtilsSSE2.cpp' % TOPSRCDIR
|
||||
SOURCES[sse_string_path].flags += CONFIG['SSE2_FLAGS']
|
||||
|
||||
GENERATED_INCLUDES += ['..']
|
||||
LOCAL_INCLUDES = [
|
||||
'../base',
|
||||
'../build',
|
||||
'../components',
|
||||
'../ds',
|
||||
'../glue',
|
||||
'../threads',
|
||||
'/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'
|
||||
@@ -24,7 +24,6 @@ DIRS += [
|
||||
'system',
|
||||
'../chrome',
|
||||
'build',
|
||||
'libxpcomrt',
|
||||
]
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_DEBUG']:
|
||||
|
||||
@@ -114,9 +114,11 @@ ReleaseData(void* aData, uint32_t aFlags)
|
||||
} else if (aFlags & nsSubstring::F_OWNED) {
|
||||
free(aData);
|
||||
STRING_STAT_INCREMENT(AdoptFree);
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
// Treat this as destruction of a "StringAdopt" object for leak
|
||||
// tracking purposes.
|
||||
MOZ_LOG_DTOR(aData, "StringAdopt", 1);
|
||||
NS_LogDtor(aData, "StringAdopt", 1);
|
||||
#endif // NS_BUILD_REFCNT_LOGGING
|
||||
}
|
||||
// otherwise, nothing to do.
|
||||
}
|
||||
|
||||
@@ -18,7 +18,9 @@ nsTSubstring_CharT::nsTSubstring_CharT(char_type* aData, size_type aLength,
|
||||
{
|
||||
if (aFlags & F_OWNED) {
|
||||
STRING_STAT_INCREMENT(Adopt);
|
||||
MOZ_LOG_CTOR(mData, "StringAdopt", 1);
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
NS_LogCtor(mData, "StringAdopt", 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif /* XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE */
|
||||
@@ -458,9 +460,11 @@ nsTSubstring_CharT::Adopt(char_type* aData, size_type aLength)
|
||||
SetDataFlags(F_TERMINATED | F_OWNED);
|
||||
|
||||
STRING_STAT_INCREMENT(Adopt);
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
// Treat this as construction of a "StringAdopt" object for leak
|
||||
// tracking purposes.
|
||||
MOZ_LOG_CTOR(mData, "StringAdopt", 1);
|
||||
NS_LogCtor(mData, "StringAdopt", 1);
|
||||
#endif // NS_BUILD_REFCNT_LOGGING
|
||||
} else {
|
||||
SetIsVoid(true);
|
||||
}
|
||||
|
||||
@@ -179,10 +179,8 @@ LazyIdleThread::EnsureThread()
|
||||
void
|
||||
LazyIdleThread::InitThread()
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
char aLocal;
|
||||
profiler_register_thread(mName.get(), &aLocal);
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
PR_SetCurrentThreadName(mName.get());
|
||||
|
||||
@@ -213,9 +211,7 @@ LazyIdleThread::CleanupThread()
|
||||
mThreadIsShuttingDown = true;
|
||||
}
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
profiler_unregister_thread();
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
|
||||
#include "nsThread.h"
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
#include "base/message_loop.h"
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
// Chromium's logging can sometimes leak through...
|
||||
#ifdef LOG
|
||||
@@ -24,16 +22,13 @@
|
||||
#include "pratom.h"
|
||||
#include "prlog.h"
|
||||
#include "nsIObserverService.h"
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
#include "mozilla/HangMonitor.h"
|
||||
#include "mozilla/IOInterposer.h"
|
||||
#include "mozilla/ipc/MessageChannel.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#endif // defined(MOZILLA_XPCOMRT_API)
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#include "mozilla/ChaosMode.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsServiceManagerUtils.h"
|
||||
@@ -270,9 +265,7 @@ public:
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mThread->mShutdownContext = mShutdownContext;
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
MessageLoop::current()->Quit();
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
@@ -323,9 +316,7 @@ SetupCurrentThreadForChaosMode()
|
||||
/*static*/ void
|
||||
nsThread::ThreadFunc(void* aArg)
|
||||
{
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
using mozilla::ipc::BackgroundChild;
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
nsThread* self = static_cast<nsThread*>(aArg); // strong reference
|
||||
self->mThread = PR_GetCurrentThread();
|
||||
@@ -338,9 +329,7 @@ nsThread::ThreadFunc(void* aArg)
|
||||
static_cast<void*>(nsThreadManager::get()->GetCurrentThreadStatusInfo());
|
||||
#endif
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
mozilla::IOInterposer::RegisterCurrentThread();
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
// Wait for and process startup event
|
||||
nsCOMPtr<nsIRunnable> event;
|
||||
@@ -352,11 +341,6 @@ nsThread::ThreadFunc(void* aArg)
|
||||
event = nullptr;
|
||||
|
||||
{
|
||||
#if defined(MOZILLA_XPCOMRT_API)
|
||||
while(!self->mShutdownContext) {
|
||||
NS_ProcessNextEvent();
|
||||
}
|
||||
#else
|
||||
// Scope for MessageLoop.
|
||||
nsAutoPtr<MessageLoop> loop(
|
||||
new MessageLoop(MessageLoop::TYPE_MOZILLA_NONMAINTHREAD));
|
||||
@@ -365,7 +349,6 @@ nsThread::ThreadFunc(void* aArg)
|
||||
loop->Run();
|
||||
|
||||
BackgroundChild::CloseForCurrentThread();
|
||||
#endif // defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
// Do NS_ProcessPendingEvents but with special handling to set
|
||||
// mEventsAreDoomed atomically with the removal of the last event. The key
|
||||
@@ -388,9 +371,7 @@ nsThread::ThreadFunc(void* aArg)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
mozilla::IOInterposer::UnregisterCurrentThread();
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
// Inform the threadmanager that this thread is going away
|
||||
nsThreadManager::get()->UnregisterCurrentThread(self);
|
||||
@@ -762,11 +743,9 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
||||
{
|
||||
LOG(("THRD(%p) ProcessNextEvent [%u %u]\n", this, aMayWait, mRunningEvent));
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
// If we're on the main thread, we shouldn't be dispatching CPOWs.
|
||||
MOZ_RELEASE_ASSERT(mIsMainThread != MAIN_THREAD ||
|
||||
!ipc::ParentProcessIsBlocked());
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
if (NS_WARN_IF(PR_GetCurrentThread() != mThread)) {
|
||||
return NS_ERROR_NOT_SAME_THREAD;
|
||||
@@ -782,11 +761,9 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
||||
// and repeat the nested event loop since its state change hasn't happened yet.
|
||||
bool reallyWait = aMayWait && (mRunningEvent > 0 || !ShuttingDown());
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
if (MAIN_THREAD == mIsMainThread && reallyWait) {
|
||||
HangMonitor::Suspend();
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
|
||||
// Fire a memory pressure notification, if we're the main thread and one is
|
||||
// pending.
|
||||
@@ -865,11 +842,9 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
||||
|
||||
if (event) {
|
||||
LOG(("THRD(%p) running [%p]\n", this, event.get()));
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
if (MAIN_THREAD == mIsMainThread) {
|
||||
HangMonitor::NotifyActivity();
|
||||
}
|
||||
#endif // !defined(MOZILLA_XPCOMRT_API)
|
||||
event->Run();
|
||||
} else if (aMayWait) {
|
||||
MOZ_ASSERT(ShuttingDown(),
|
||||
|
||||
@@ -566,10 +566,8 @@ nsTimerImpl::Fire()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
PROFILER_LABEL("Timer", "Fire",
|
||||
js::ProfileEntry::Category::OTHER);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
// mTracedTask is an instance of FakeTracedTask created by
|
||||
|
||||
Reference in New Issue
Block a user