mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1046841 - Fix more style violations in previously touched .cpp files in xpcom/. r=froydnj
This commit is contained in:
parent
6bf06cece4
commit
6ea79dfc7c
@ -149,18 +149,16 @@ volatile PRIntervalTime sLastLowMemoryNotificationTime;
|
|||||||
|
|
||||||
// These are function pointers to the functions we wrap in Init().
|
// These are function pointers to the functions we wrap in Init().
|
||||||
|
|
||||||
void* (WINAPI* sVirtualAllocOrig)
|
void* (WINAPI* sVirtualAllocOrig)(LPVOID aAddress, SIZE_T aSize,
|
||||||
(LPVOID aAddress, SIZE_T aSize, DWORD aAllocationType, DWORD aProtect);
|
DWORD aAllocationType, DWORD aProtect);
|
||||||
|
|
||||||
void* (WINAPI* sMapViewOfFileOrig)
|
void* (WINAPI* sMapViewOfFileOrig)(HANDLE aFileMappingObject,
|
||||||
(HANDLE aFileMappingObject, DWORD aDesiredAccess,
|
DWORD aDesiredAccess, DWORD aFileOffsetHigh,
|
||||||
DWORD aFileOffsetHigh, DWORD aFileOffsetLow,
|
DWORD aFileOffsetLow, SIZE_T aNumBytesToMap);
|
||||||
SIZE_T aNumBytesToMap);
|
|
||||||
|
|
||||||
HBITMAP (WINAPI* sCreateDIBSectionOrig)
|
HBITMAP(WINAPI* sCreateDIBSectionOrig)(HDC aDC, const BITMAPINFO* aBitmapInfo,
|
||||||
(HDC aDC, const BITMAPINFO* aBitmapInfo,
|
UINT aUsage, VOID** aBits,
|
||||||
UINT aUsage, VOID** aBits,
|
HANDLE aSection, DWORD aOffset);
|
||||||
HANDLE aSection, DWORD aOffset);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fire a memory pressure event if it's been long enough since the last one we
|
* Fire a memory pressure event if it's been long enough since the last one we
|
||||||
|
@ -157,7 +157,8 @@ TraceWeakMappingChild(JSTracer* aTrc, void** aThingp, JSGCTraceKind aKind)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (AddToCCKind(aKind)) {
|
if (AddToCCKind(aKind)) {
|
||||||
tracer->mCb.NoteWeakMapping(tracer->mMap, tracer->mKey, tracer->mKeyDelegate, thing);
|
tracer->mCb.NoteWeakMapping(tracer->mMap, tracer->mKey,
|
||||||
|
tracer->mKeyDelegate, thing);
|
||||||
tracer->mTracedAny = true;
|
tracer->mTracedAny = true;
|
||||||
} else {
|
} else {
|
||||||
JS_TraceChildren(aTrc, thing, aKind);
|
JS_TraceChildren(aTrc, thing, aKind);
|
||||||
@ -305,7 +306,8 @@ struct Closure
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CheckParticipatesInCycleCollection(void* aThing, const char* aName, void* aClosure)
|
CheckParticipatesInCycleCollection(void* aThing, const char* aName,
|
||||||
|
void* aClosure)
|
||||||
{
|
{
|
||||||
Closure* closure = static_cast<Closure*>(aClosure);
|
Closure* closure = static_cast<Closure*>(aClosure);
|
||||||
|
|
||||||
@ -346,9 +348,9 @@ NS_IMETHODIMP
|
|||||||
JSGCThingParticipant::Traverse(void* aPtr,
|
JSGCThingParticipant::Traverse(void* aPtr,
|
||||||
nsCycleCollectionTraversalCallback& aCb)
|
nsCycleCollectionTraversalCallback& aCb)
|
||||||
{
|
{
|
||||||
CycleCollectedJSRuntime* runtime = reinterpret_cast<CycleCollectedJSRuntime*>
|
auto runtime = reinterpret_cast<CycleCollectedJSRuntime*>(
|
||||||
(reinterpret_cast<char*>(this) -
|
reinterpret_cast<char*>(this) - offsetof(CycleCollectedJSRuntime,
|
||||||
offsetof(CycleCollectedJSRuntime, mGCThingCycleCollectorGlobal));
|
mGCThingCycleCollectorGlobal));
|
||||||
|
|
||||||
runtime->TraverseGCThing(CycleCollectedJSRuntime::TRAVERSE_FULL,
|
runtime->TraverseGCThing(CycleCollectedJSRuntime::TRAVERSE_FULL,
|
||||||
aPtr, js::GCThingTraceKind(aPtr), aCb);
|
aPtr, js::GCThingTraceKind(aPtr), aCb);
|
||||||
@ -362,9 +364,9 @@ static JSGCThingParticipant sGCThingCycleCollectorGlobal;
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
JSZoneParticipant::Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb)
|
JSZoneParticipant::Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb)
|
||||||
{
|
{
|
||||||
CycleCollectedJSRuntime* runtime = reinterpret_cast<CycleCollectedJSRuntime*>
|
auto runtime = reinterpret_cast<CycleCollectedJSRuntime*>(
|
||||||
(reinterpret_cast<char*>(this) -
|
reinterpret_cast<char*>(this) - offsetof(CycleCollectedJSRuntime,
|
||||||
offsetof(CycleCollectedJSRuntime, mJSZoneCycleCollectorGlobal));
|
mJSZoneCycleCollectorGlobal));
|
||||||
|
|
||||||
MOZ_ASSERT(!aCb.WantAllTraces());
|
MOZ_ASSERT(!aCb.WantAllTraces());
|
||||||
JS::Zone* zone = static_cast<JS::Zone*>(aPtr);
|
JS::Zone* zone = static_cast<JS::Zone*>(aPtr);
|
||||||
@ -489,7 +491,8 @@ CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSRuntime* aParentRuntime,
|
|||||||
JS_SetGrayGCRootsTracer(mJSRuntime, TraceGrayJS, this);
|
JS_SetGrayGCRootsTracer(mJSRuntime, TraceGrayJS, this);
|
||||||
JS_SetGCCallback(mJSRuntime, GCCallback, this);
|
JS_SetGCCallback(mJSRuntime, GCCallback, this);
|
||||||
JS::SetOutOfMemoryCallback(mJSRuntime, OutOfMemoryCallback, this);
|
JS::SetOutOfMemoryCallback(mJSRuntime, OutOfMemoryCallback, this);
|
||||||
JS::SetLargeAllocationFailureCallback(mJSRuntime, LargeAllocationFailureCallback, this);
|
JS::SetLargeAllocationFailureCallback(mJSRuntime,
|
||||||
|
LargeAllocationFailureCallback, this);
|
||||||
JS_SetContextCallback(mJSRuntime, ContextCallback, this);
|
JS_SetContextCallback(mJSRuntime, ContextCallback, this);
|
||||||
JS_SetDestroyZoneCallback(mJSRuntime, XPCStringConvert::FreeZoneCache);
|
JS_SetDestroyZoneCallback(mJSRuntime, XPCStringConvert::FreeZoneCache);
|
||||||
JS_SetSweepZoneCallback(mJSRuntime, XPCStringConvert::ClearZoneCache);
|
JS_SetSweepZoneCallback(mJSRuntime, XPCStringConvert::ClearZoneCache);
|
||||||
@ -612,7 +615,8 @@ CycleCollectedJSRuntime::NoteGCThingJSChildren(void* aThing,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CycleCollectedJSRuntime::NoteGCThingXPCOMChildren(const js::Class* aClasp, JSObject* aObj,
|
CycleCollectedJSRuntime::NoteGCThingXPCOMChildren(const js::Class* aClasp,
|
||||||
|
JSObject* aObj,
|
||||||
nsCycleCollectionTraversalCallback& aCb) const
|
nsCycleCollectionTraversalCallback& aCb) const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aClasp);
|
MOZ_ASSERT(aClasp);
|
||||||
@ -765,7 +769,7 @@ CycleCollectedJSRuntime::GCCallback(JSRuntime* aRuntime,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
CycleCollectedJSRuntime::OutOfMemoryCallback(JSContext *aContext,
|
CycleCollectedJSRuntime::OutOfMemoryCallback(JSContext* aContext,
|
||||||
void* aData)
|
void* aData)
|
||||||
{
|
{
|
||||||
CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
|
CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
|
||||||
@ -1101,7 +1105,8 @@ IncrementalFinalizeRunnable::IncrementalFinalizeRunnable(CycleCollectedJSRuntime
|
|||||||
, mFinalizeFunctionToRun(0)
|
, mFinalizeFunctionToRun(0)
|
||||||
{
|
{
|
||||||
this->mSupports.SwapElements(aSupports);
|
this->mSupports.SwapElements(aSupports);
|
||||||
DeferredFinalizeFunctionHolder* function = mDeferredFinalizeFunctions.AppendElement();
|
DeferredFinalizeFunctionHolder* function =
|
||||||
|
mDeferredFinalizeFunctions.AppendElement();
|
||||||
function->run = ReleaseSliceNow;
|
function->run = ReleaseSliceNow;
|
||||||
function->data = &this->mSupports;
|
function->data = &this->mSupports;
|
||||||
|
|
||||||
@ -1201,8 +1206,9 @@ CycleCollectedJSRuntime::FinalizeDeferredThings(DeferredFinalizeType aType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState *aStatePtr, OOMState aNewState)
|
CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
|
||||||
|
OOMState aNewState)
|
||||||
{
|
{
|
||||||
*aStatePtr = aNewState;
|
*aStatePtr = aNewState;
|
||||||
#ifdef MOZ_CRASHREPORTER
|
#ifdef MOZ_CRASHREPORTER
|
||||||
|
@ -163,8 +163,9 @@ public:
|
|||||||
{
|
{
|
||||||
// There is lots of privacy-sensitive data in /proc. Just skip this
|
// There is lots of privacy-sensitive data in /proc. Just skip this
|
||||||
// reporter entirely when anonymization is required.
|
// reporter entirely when anonymization is required.
|
||||||
if (aAnonymize)
|
if (aAnonymize) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Preferences::GetBool("memory.system_memory_reporter")) {
|
if (!Preferences::GetBool("memory.system_memory_reporter")) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -213,12 +214,12 @@ private:
|
|||||||
class ProcessSizes
|
class ProcessSizes
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Add(const nsACString &aKey, size_t aSize)
|
void Add(const nsACString& aKey, size_t aSize)
|
||||||
{
|
{
|
||||||
mTagged.Put(aKey, mTagged.Get(aKey) + aSize);
|
mTagged.Put(aKey, mTagged.Get(aKey) + aSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Report(nsIHandleReportCallback *aHandleReport, nsISupports *aData)
|
void Report(nsIHandleReportCallback* aHandleReport, nsISupports* aData)
|
||||||
{
|
{
|
||||||
EnumArgs env = { aHandleReport, aData };
|
EnumArgs env = { aHandleReport, aData };
|
||||||
mTagged.EnumerateRead(ReportSizes, &env);
|
mTagged.EnumerateRead(ReportSizes, &env);
|
||||||
@ -227,16 +228,17 @@ private:
|
|||||||
private:
|
private:
|
||||||
nsDataHashtable<nsCStringHashKey, size_t> mTagged;
|
nsDataHashtable<nsCStringHashKey, size_t> mTagged;
|
||||||
|
|
||||||
struct EnumArgs {
|
struct EnumArgs
|
||||||
|
{
|
||||||
nsIHandleReportCallback* mHandleReport;
|
nsIHandleReportCallback* mHandleReport;
|
||||||
nsISupports* mData;
|
nsISupports* mData;
|
||||||
};
|
};
|
||||||
|
|
||||||
static PLDHashOperator ReportSizes(nsCStringHashKey::KeyType aKey,
|
static PLDHashOperator ReportSizes(nsCStringHashKey::KeyType aKey,
|
||||||
size_t aAmount,
|
size_t aAmount,
|
||||||
void *aUserArg)
|
void* aUserArg)
|
||||||
{
|
{
|
||||||
const EnumArgs *envp = reinterpret_cast<const EnumArgs*>(aUserArg);
|
const EnumArgs* envp = reinterpret_cast<const EnumArgs*>(aUserArg);
|
||||||
|
|
||||||
nsAutoCString path("processes/");
|
nsAutoCString path("processes/");
|
||||||
path.Append(aKey);
|
path.Append(aKey);
|
||||||
@ -335,8 +337,8 @@ private:
|
|||||||
|
|
||||||
// Report the open file descriptors for this process.
|
// Report the open file descriptors for this process.
|
||||||
nsPrintfCString procFdPath("/proc/%s/fd", pidStr);
|
nsPrintfCString procFdPath("/proc/%s/fd", pidStr);
|
||||||
rv = CollectOpenFileReports(
|
rv = CollectOpenFileReports(aHandleReport, aData, procFdPath,
|
||||||
aHandleReport, aData, procFdPath, processName);
|
processName);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -947,12 +949,12 @@ private:
|
|||||||
#undef CHECK_PREFIX
|
#undef CHECK_PREFIX
|
||||||
|
|
||||||
const nsCString processName(aProcessName);
|
const nsCString processName(aProcessName);
|
||||||
nsPrintfCString entryPath(
|
nsPrintfCString entryPath("open-fds/%s/%s%s/%s",
|
||||||
"open-fds/%s/%s%s/%s", processName.get(), category, linkPath, fd);
|
processName.get(), category, linkPath, fd);
|
||||||
nsPrintfCString entryDescription(
|
nsPrintfCString entryDescription("%s file descriptor opened by the process",
|
||||||
"%s file descriptor opened by the process", descriptionPrefix);
|
descriptionPrefix);
|
||||||
REPORT_WITH_CLEANUP(
|
REPORT_WITH_CLEANUP(entryPath, UNITS_COUNT, 1, entryDescription,
|
||||||
entryPath, UNITS_COUNT, 1, entryDescription, closedir(d));
|
closedir(d));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -973,8 +975,8 @@ private:
|
|||||||
|
|
||||||
// For simplicity numbers will be uint64_t, strings 63 chars max.
|
// For simplicity numbers will be uint64_t, strings 63 chars max.
|
||||||
const char* const kScanFormat =
|
const char* const kScanFormat =
|
||||||
"%" SCNx64 " %" SCNx64 " %" SCNu64 " %" SCNu64
|
"%" SCNx64 " %" SCNx64 " %" SCNu64 " %" SCNu64
|
||||||
" %63s %63s %63s %" SCNu64;
|
" %63s %63s %63s %" SCNu64;
|
||||||
const int kNumFields = 8;
|
const int kNumFields = 8;
|
||||||
const size_t kStringSize = 64;
|
const size_t kStringSize = 64;
|
||||||
|
|
||||||
|
@ -439,7 +439,8 @@ Init()
|
|||||||
gEventFilter = EventFilter::Build(logEvents);
|
gEventFilter = EventFilter::Build(logEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRStatus status = PR_NewThreadPrivateIndex(&gThreadPrivateIndex, &RecordBatch::Close);
|
PRStatus status = PR_NewThreadPrivateIndex(&gThreadPrivateIndex,
|
||||||
|
&RecordBatch::Close);
|
||||||
if (status != PR_SUCCESS) {
|
if (status != PR_SUCCESS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -497,8 +498,8 @@ Mark(uint32_t aType, void* aItem, const char* aText, const char* aText2)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordBatch* threadLogPrivate = static_cast<RecordBatch*>(
|
RecordBatch* threadLogPrivate =
|
||||||
PR_GetThreadPrivate(gThreadPrivateIndex));
|
static_cast<RecordBatch*>(PR_GetThreadPrivate(gThreadPrivateIndex));
|
||||||
if (!threadLogPrivate) {
|
if (!threadLogPrivate) {
|
||||||
threadLogPrivate = RecordBatch::Register();
|
threadLogPrivate = RecordBatch::Register();
|
||||||
if (!threadLogPrivate) {
|
if (!threadLogPrivate) {
|
||||||
|
@ -34,7 +34,9 @@ using namespace mozilla;
|
|||||||
|
|
||||||
NS_IMPL_ADDREF(nsConsoleService)
|
NS_IMPL_ADDREF(nsConsoleService)
|
||||||
NS_IMPL_RELEASE(nsConsoleService)
|
NS_IMPL_RELEASE(nsConsoleService)
|
||||||
NS_IMPL_CLASSINFO(nsConsoleService, nullptr, nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON, NS_CONSOLESERVICE_CID)
|
NS_IMPL_CLASSINFO(nsConsoleService, nullptr,
|
||||||
|
nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON,
|
||||||
|
NS_CONSOLESERVICE_CID)
|
||||||
NS_IMPL_QUERY_INTERFACE_CI(nsConsoleService, nsIConsoleService)
|
NS_IMPL_QUERY_INTERFACE_CI(nsConsoleService, nsIConsoleService)
|
||||||
NS_IMPL_CI_INTERFACE_GETTER(nsConsoleService, nsIConsoleService)
|
NS_IMPL_CI_INTERFACE_GETTER(nsConsoleService, nsIConsoleService)
|
||||||
|
|
||||||
@ -57,7 +59,7 @@ nsConsoleService::nsConsoleService()
|
|||||||
nsConsoleService::~nsConsoleService()
|
nsConsoleService::~nsConsoleService()
|
||||||
{
|
{
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
while (i < mBufferSize && mMessages[i] != nullptr) {
|
while (i < mBufferSize && mMessages[i]) {
|
||||||
NS_RELEASE(mMessages[i]);
|
NS_RELEASE(mMessages[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -266,7 +268,8 @@ nsConsoleService::LogStringMessage(const char16_t* aMessage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsConsoleService::GetMessageArray(uint32_t* aCount, nsIConsoleMessage*** aMessages)
|
nsConsoleService::GetMessageArray(uint32_t* aCount,
|
||||||
|
nsIConsoleMessage*** aMessages)
|
||||||
{
|
{
|
||||||
nsIConsoleMessage** messageArray;
|
nsIConsoleMessage** messageArray;
|
||||||
|
|
||||||
|
@ -383,7 +383,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct Block;
|
struct Block;
|
||||||
union PtrInfoOrBlock {
|
union PtrInfoOrBlock
|
||||||
|
{
|
||||||
// Use a union to avoid reinterpret_cast and the ensuing
|
// Use a union to avoid reinterpret_cast and the ensuing
|
||||||
// potential aliasing bugs.
|
// potential aliasing bugs.
|
||||||
PtrInfo* ptrInfo;
|
PtrInfo* ptrInfo;
|
||||||
@ -430,15 +431,9 @@ public:
|
|||||||
class Iterator
|
class Iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Iterator() : mPointer(nullptr)
|
Iterator() : mPointer(nullptr) {}
|
||||||
{
|
explicit Iterator(PtrInfoOrBlock* aPointer) : mPointer(aPointer) {}
|
||||||
}
|
Iterator(const Iterator& aOther) : mPointer(aOther.mPointer) {}
|
||||||
explicit Iterator(PtrInfoOrBlock* aPointer) : mPointer(aPointer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
Iterator(const Iterator& aOther) : mPointer(aOther.mPointer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator& operator++()
|
Iterator& operator++()
|
||||||
{
|
{
|
||||||
@ -963,7 +958,8 @@ CanonicalizeParticipant(void** aParti, nsCycleCollectionParticipant** aCp)
|
|||||||
|
|
||||||
struct nsPurpleBufferEntry
|
struct nsPurpleBufferEntry
|
||||||
{
|
{
|
||||||
union {
|
union
|
||||||
|
{
|
||||||
void* mObject; // when low bit unset
|
void* mObject; // when low bit unset
|
||||||
nsPurpleBufferEntry* mNextInFreeList; // when low bit set
|
nsPurpleBufferEntry* mNextInFreeList; // when low bit set
|
||||||
};
|
};
|
||||||
@ -998,7 +994,7 @@ private:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class PurpleVisitor>
|
template<class PurpleVisitor>
|
||||||
void VisitEntries(nsPurpleBuffer& aBuffer, PurpleVisitor& aVisitor)
|
void VisitEntries(nsPurpleBuffer& aBuffer, PurpleVisitor& aVisitor)
|
||||||
{
|
{
|
||||||
nsPurpleBufferEntry* eEnd = ArrayEnd(mEntries);
|
nsPurpleBufferEntry* eEnd = ArrayEnd(mEntries);
|
||||||
@ -1027,7 +1023,7 @@ public:
|
|||||||
FreeBlocks();
|
FreeBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class PurpleVisitor>
|
template<class PurpleVisitor>
|
||||||
void VisitEntries(PurpleVisitor& aVisitor)
|
void VisitEntries(PurpleVisitor& aVisitor)
|
||||||
{
|
{
|
||||||
for (Block* b = &mFirstBlock; b; b = b->mNext) {
|
for (Block* b = &mFirstBlock; b; b = b->mNext) {
|
||||||
@ -1218,14 +1214,16 @@ nsPurpleBuffer::SelectPointers(CCGraphBuilder& aBuilder)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ccPhase {
|
enum ccPhase
|
||||||
|
{
|
||||||
IdlePhase,
|
IdlePhase,
|
||||||
GraphBuildingPhase,
|
GraphBuildingPhase,
|
||||||
ScanAndCollectWhitePhase,
|
ScanAndCollectWhitePhase,
|
||||||
CleanupPhase
|
CleanupPhase
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ccType {
|
enum ccType
|
||||||
|
{
|
||||||
SliceCC, /* If a CC is in progress, continue it. Otherwise, start a new one. */
|
SliceCC, /* If a CC is in progress, continue it. Otherwise, start a new one. */
|
||||||
ManualCC, /* Explicitly triggered. */
|
ManualCC, /* Explicitly triggered. */
|
||||||
ShutdownCC /* Shutdown CC, used for finding leaks. */
|
ShutdownCC /* Shutdown CC, used for finding leaks. */
|
||||||
@ -1355,7 +1353,7 @@ NS_IMPL_ISUPPORTS(nsCycleCollector, nsIMemoryReporter)
|
|||||||
* bool ShouldVisitNode(PtrInfo const *pi);
|
* bool ShouldVisitNode(PtrInfo const *pi);
|
||||||
* void VisitNode(PtrInfo *pi);
|
* void VisitNode(PtrInfo *pi);
|
||||||
*/
|
*/
|
||||||
template <class Visitor>
|
template<class Visitor>
|
||||||
class GraphWalker
|
class GraphWalker
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -1428,7 +1426,7 @@ ToParticipant(nsISupports* aPtr, nsXPCOMCycleCollectionParticipant** aCp)
|
|||||||
CallQueryInterface(aPtr, aCp);
|
CallQueryInterface(aPtr, aCp);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Visitor>
|
template<class Visitor>
|
||||||
MOZ_NEVER_INLINE void
|
MOZ_NEVER_INLINE void
|
||||||
GraphWalker<Visitor>::Walk(PtrInfo* aPi)
|
GraphWalker<Visitor>::Walk(PtrInfo* aPi)
|
||||||
{
|
{
|
||||||
@ -1437,7 +1435,7 @@ GraphWalker<Visitor>::Walk(PtrInfo* aPi)
|
|||||||
DoWalk(queue);
|
DoWalk(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Visitor>
|
template<class Visitor>
|
||||||
MOZ_NEVER_INLINE void
|
MOZ_NEVER_INLINE void
|
||||||
GraphWalker<Visitor>::WalkFromRoots(CCGraph& aGraph)
|
GraphWalker<Visitor>::WalkFromRoots(CCGraph& aGraph)
|
||||||
{
|
{
|
||||||
@ -1449,7 +1447,7 @@ GraphWalker<Visitor>::WalkFromRoots(CCGraph& aGraph)
|
|||||||
DoWalk(queue);
|
DoWalk(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Visitor>
|
template<class Visitor>
|
||||||
MOZ_NEVER_INLINE void
|
MOZ_NEVER_INLINE void
|
||||||
GraphWalker<Visitor>::DoWalk(nsDeque& aQueue)
|
GraphWalker<Visitor>::DoWalk(nsDeque& aQueue)
|
||||||
{
|
{
|
||||||
@ -1476,7 +1474,8 @@ struct CCGraphDescriber : public LinkedListElement<CCGraphDescriber>
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Type {
|
enum Type
|
||||||
|
{
|
||||||
eRefCountedObject,
|
eRefCountedObject,
|
||||||
eGCedObject,
|
eGCedObject,
|
||||||
eGCMarkedObject,
|
eGCMarkedObject,
|
||||||
@ -1590,7 +1589,8 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FileInfo {
|
struct FileInfo
|
||||||
|
{
|
||||||
const char* const mPrefix;
|
const char* const mPrefix;
|
||||||
nsCOMPtr<nsIFile> mFile;
|
nsCOMPtr<nsIFile> mFile;
|
||||||
FILE* mStream;
|
FILE* mStream;
|
||||||
@ -1627,9 +1627,7 @@ private:
|
|||||||
// aFilename under a memory-reporting-specific folder
|
// aFilename under a memory-reporting-specific folder
|
||||||
// (/data/local/tmp/memory-reports). Otherwise, it will open a
|
// (/data/local/tmp/memory-reports). Otherwise, it will open a
|
||||||
// file named aFilename under "NS_OS_TEMP_DIR".
|
// file named aFilename under "NS_OS_TEMP_DIR".
|
||||||
nsresult rv = nsDumpUtils::OpenTempFile(
|
nsresult rv = nsDumpUtils::OpenTempFile(filename, &logFile,
|
||||||
filename,
|
|
||||||
&logFile,
|
|
||||||
NS_LITERAL_CSTRING("memory-reports"));
|
NS_LITERAL_CSTRING("memory-reports"));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_IF_RELEASE(logFile);
|
NS_IF_RELEASE(logFile);
|
||||||
@ -1651,13 +1649,15 @@ private:
|
|||||||
incomplete += aLog->mPrefix;
|
incomplete += aLog->mPrefix;
|
||||||
MOZ_ASSERT(!aLog->mFile);
|
MOZ_ASSERT(!aLog->mFile);
|
||||||
aLog->mFile = CreateTempFile(incomplete.get());
|
aLog->mFile = CreateTempFile(incomplete.get());
|
||||||
if (NS_WARN_IF(!aLog->mFile))
|
if (NS_WARN_IF(!aLog->mFile)) {
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(!aLog->mStream);
|
MOZ_ASSERT(!aLog->mStream);
|
||||||
aLog->mFile->OpenANSIFileDesc("w", &aLog->mStream);
|
aLog->mFile->OpenANSIFileDesc("w", &aLog->mStream);
|
||||||
if (NS_WARN_IF(!aLog->mStream))
|
if (NS_WARN_IF(!aLog->mStream)) {
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
MozillaRegisterDebugFILE(aLog->mStream);
|
MozillaRegisterDebugFILE(aLog->mStream);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -1674,13 +1674,15 @@ private:
|
|||||||
// Strip off "incomplete-".
|
// Strip off "incomplete-".
|
||||||
nsCOMPtr<nsIFile> logFileFinalDestination =
|
nsCOMPtr<nsIFile> logFileFinalDestination =
|
||||||
CreateTempFile(aLog->mPrefix);
|
CreateTempFile(aLog->mPrefix);
|
||||||
if (NS_WARN_IF(!logFileFinalDestination))
|
if (NS_WARN_IF(!logFileFinalDestination)) {
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
nsAutoString logFileFinalDestinationName;
|
nsAutoString logFileFinalDestinationName;
|
||||||
logFileFinalDestination->GetLeafName(logFileFinalDestinationName);
|
logFileFinalDestination->GetLeafName(logFileFinalDestinationName);
|
||||||
if (NS_WARN_IF(logFileFinalDestinationName.IsEmpty()))
|
if (NS_WARN_IF(logFileFinalDestinationName.IsEmpty())) {
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
aLog->mFile->MoveTo(/* directory */ nullptr, logFileFinalDestinationName);
|
aLog->mFile->MoveTo(/* directory */ nullptr, logFileFinalDestinationName);
|
||||||
|
|
||||||
@ -1695,8 +1697,8 @@ private:
|
|||||||
nsAutoString logPath;
|
nsAutoString logPath;
|
||||||
logFileFinalDestination->GetPath(logPath);
|
logFileFinalDestination->GetPath(logPath);
|
||||||
|
|
||||||
nsString msg = aCollectorKind
|
nsString msg = aCollectorKind +
|
||||||
+ NS_LITERAL_STRING(" Collector log dumped to ") + logPath;
|
NS_LITERAL_STRING(" Collector log dumped to ") + logPath;
|
||||||
cs->LogStringMessage(msg.get());
|
cs->LogStringMessage(msg.get());
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -1844,7 +1846,7 @@ public:
|
|||||||
mCurrentAddress.AssignLiteral("0x");
|
mCurrentAddress.AssignLiteral("0x");
|
||||||
mCurrentAddress.AppendInt(aAddress, 16);
|
mCurrentAddress.AppendInt(aAddress, 16);
|
||||||
d->mType = aMarked ? CCGraphDescriber::eGCMarkedObject :
|
d->mType = aMarked ? CCGraphDescriber::eGCMarkedObject :
|
||||||
CCGraphDescriber::eGCedObject;
|
CCGraphDescriber::eGCedObject;
|
||||||
d->mAddress = mCurrentAddress;
|
d->mAddress = mCurrentAddress;
|
||||||
d->mName.Append(aObjectDescription);
|
d->mName.Append(aObjectDescription);
|
||||||
if (aCompartmentAddress) {
|
if (aCompartmentAddress) {
|
||||||
@ -2356,7 +2358,8 @@ CCGraphBuilder::AddWeakMapNode(void* aNode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(void)
|
NS_IMETHODIMP_(void)
|
||||||
CCGraphBuilder::NoteWeakMapping(void* aMap, void* aKey, void* aKdelegate, void* aVal)
|
CCGraphBuilder::NoteWeakMapping(void* aMap, void* aKey, void* aKdelegate,
|
||||||
|
void* aVal)
|
||||||
{
|
{
|
||||||
// Don't try to optimize away the entry here, as we've already attempted to
|
// Don't try to optimize away the entry here, as we've already attempted to
|
||||||
// do that in TraceWeakMapping in nsXPConnect.
|
// do that in TraceWeakMapping in nsXPConnect.
|
||||||
@ -2650,7 +2653,7 @@ public:
|
|||||||
if (val.isMarkable()) {
|
if (val.isMarkable()) {
|
||||||
void* thing = val.toGCThing();
|
void* thing = val.toGCThing();
|
||||||
if (thing && xpc_GCThingIsGrayCCThing(thing)) {
|
if (thing && xpc_GCThingIsGrayCCThing(thing)) {
|
||||||
MOZ_ASSERT(!js::gc::IsInsideNursery((js::gc::Cell *)thing));
|
MOZ_ASSERT(!js::gc::IsInsideNursery((js::gc::Cell*)thing));
|
||||||
mCollector->GetJSPurpleBuffer()->mValues.AppendElement(val);
|
mCollector->GetJSPurpleBuffer()->mValues.AppendElement(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2661,7 +2664,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppendJSObjectToPurpleBuffer(JSObject *obj) const
|
void AppendJSObjectToPurpleBuffer(JSObject* obj) const
|
||||||
{
|
{
|
||||||
if (obj && xpc_GCThingIsGrayCCThing(obj)) {
|
if (obj && xpc_GCThingIsGrayCCThing(obj)) {
|
||||||
MOZ_ASSERT(!js::gc::IsInsideNursery(JS::AsCell(obj)));
|
MOZ_ASSERT(!js::gc::IsInsideNursery(JS::AsCell(obj)));
|
||||||
@ -2902,9 +2905,10 @@ private:
|
|||||||
static void
|
static void
|
||||||
FloodBlackNode(uint32_t& aWhiteNodeCount, bool& aFailed, PtrInfo* aPi)
|
FloodBlackNode(uint32_t& aWhiteNodeCount, bool& aFailed, PtrInfo* aPi)
|
||||||
{
|
{
|
||||||
GraphWalker<ScanBlackVisitor>(ScanBlackVisitor(aWhiteNodeCount, aFailed)).Walk(aPi);
|
GraphWalker<ScanBlackVisitor>(ScanBlackVisitor(aWhiteNodeCount,
|
||||||
MOZ_ASSERT(aPi->mColor == black || !aPi->WasTraversed(),
|
aFailed)).Walk(aPi);
|
||||||
"FloodBlackNode should make aPi black");
|
MOZ_ASSERT(aPi->mColor == black || !aPi->WasTraversed(),
|
||||||
|
"FloodBlackNode should make aPi black");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate over the WeakMaps. If we mark anything while iterating
|
// Iterate over the WeakMaps. If we mark anything while iterating
|
||||||
@ -3011,13 +3015,16 @@ nsCycleCollector::ScanIncrementalRoots()
|
|||||||
// buffer here, so these objects will be suspected and freed in the next CC
|
// buffer here, so these objects will be suspected and freed in the next CC
|
||||||
// if they are garbage.
|
// if they are garbage.
|
||||||
bool failed = false;
|
bool failed = false;
|
||||||
PurpleScanBlackVisitor purpleScanBlackVisitor(mGraph, mListener, mWhiteNodeCount, failed);
|
PurpleScanBlackVisitor purpleScanBlackVisitor(mGraph, mListener,
|
||||||
|
mWhiteNodeCount, failed);
|
||||||
mPurpleBuf.VisitEntries(purpleScanBlackVisitor);
|
mPurpleBuf.VisitEntries(purpleScanBlackVisitor);
|
||||||
timeLog.Checkpoint("ScanIncrementalRoots::fix purple");
|
timeLog.Checkpoint("ScanIncrementalRoots::fix purple");
|
||||||
|
|
||||||
bool hasJSRuntime = !!mJSRuntime;
|
bool hasJSRuntime = !!mJSRuntime;
|
||||||
nsCycleCollectionParticipant* jsParticipant = hasJSRuntime ? mJSRuntime->GCThingParticipant() : nullptr;
|
nsCycleCollectionParticipant* jsParticipant =
|
||||||
nsCycleCollectionParticipant* zoneParticipant = hasJSRuntime ? mJSRuntime->ZoneParticipant() : nullptr;
|
hasJSRuntime ? mJSRuntime->GCThingParticipant() : nullptr;
|
||||||
|
nsCycleCollectionParticipant* zoneParticipant =
|
||||||
|
hasJSRuntime ? mJSRuntime->ZoneParticipant() : nullptr;
|
||||||
bool hasListener = !!mListener;
|
bool hasListener = !!mListener;
|
||||||
|
|
||||||
NodePool::Enumerator etor(mGraph.mNodes);
|
NodePool::Enumerator etor(mGraph.mNodes);
|
||||||
@ -3263,7 +3270,8 @@ nsCycleCollector::CollectWhite()
|
|||||||
|
|
||||||
for (uint32_t i = 0; i < count; ++i) {
|
for (uint32_t i = 0; i < count; ++i) {
|
||||||
PtrInfo* pinfo = whiteNodes.ElementAt(i);
|
PtrInfo* pinfo = whiteNodes.ElementAt(i);
|
||||||
MOZ_ASSERT(pinfo->mParticipant, "Unlink shouldn't see objects removed from graph.");
|
MOZ_ASSERT(pinfo->mParticipant,
|
||||||
|
"Unlink shouldn't see objects removed from graph.");
|
||||||
pinfo->mParticipant->Unlink(pinfo->mPointer);
|
pinfo->mParticipant->Unlink(pinfo->mPointer);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (mJSRuntime) {
|
if (mJSRuntime) {
|
||||||
@ -3275,7 +3283,8 @@ nsCycleCollector::CollectWhite()
|
|||||||
|
|
||||||
for (uint32_t i = 0; i < count; ++i) {
|
for (uint32_t i = 0; i < count; ++i) {
|
||||||
PtrInfo* pinfo = whiteNodes.ElementAt(i);
|
PtrInfo* pinfo = whiteNodes.ElementAt(i);
|
||||||
MOZ_ASSERT(pinfo->mParticipant, "Unroot shouldn't see objects removed from graph.");
|
MOZ_ASSERT(pinfo->mParticipant,
|
||||||
|
"Unroot shouldn't see objects removed from graph.");
|
||||||
pinfo->mParticipant->Unroot(pinfo->mPointer);
|
pinfo->mParticipant->Unroot(pinfo->mPointer);
|
||||||
}
|
}
|
||||||
timeLog.Checkpoint("CollectWhite::Unroot");
|
timeLog.Checkpoint("CollectWhite::Unroot");
|
||||||
@ -3476,8 +3485,8 @@ nsCycleCollector::FixGrayBits(bool aForceGC)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TimeLog timeLog;
|
TimeLog timeLog;
|
||||||
mJSRuntime->GarbageCollect(aForceGC ? JS::gcreason::SHUTDOWN_CC
|
mJSRuntime->GarbageCollect(aForceGC ? JS::gcreason::SHUTDOWN_CC :
|
||||||
: JS::gcreason::CC_FORCED);
|
JS::gcreason::CC_FORCED);
|
||||||
timeLog.Checkpoint("GC()");
|
timeLog.Checkpoint("GC()");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3743,7 +3752,8 @@ nsCycleCollector::BeginCollection(ccType aCCType,
|
|||||||
mResults.mMergedZones = mergeZones;
|
mResults.mMergedZones = mergeZones;
|
||||||
|
|
||||||
MOZ_ASSERT(!mBuilder, "Forgot to clear mBuilder");
|
MOZ_ASSERT(!mBuilder, "Forgot to clear mBuilder");
|
||||||
mBuilder = new CCGraphBuilder(mGraph, mResults, mJSRuntime, mListener, mergeZones);
|
mBuilder = new CCGraphBuilder(mGraph, mResults, mJSRuntime, mListener,
|
||||||
|
mergeZones);
|
||||||
|
|
||||||
if (mJSRuntime) {
|
if (mJSRuntime) {
|
||||||
mJSRuntime->TraverseRoots(*mBuilder);
|
mJSRuntime->TraverseRoots(*mBuilder);
|
||||||
@ -4105,7 +4115,7 @@ nsCycleCollector_forgetSkippable(bool aRemoveChildlessNodes,
|
|||||||
MOZ_ASSERT(data->mCollector);
|
MOZ_ASSERT(data->mCollector);
|
||||||
|
|
||||||
PROFILER_LABEL("nsCycleCollector", "forgetSkippable",
|
PROFILER_LABEL("nsCycleCollector", "forgetSkippable",
|
||||||
js::ProfileEntry::Category::CC);
|
js::ProfileEntry::Category::CC);
|
||||||
|
|
||||||
TimeLog timeLog;
|
TimeLog timeLog;
|
||||||
data->mCollector->ForgetSkippable(aRemoveChildlessNodes,
|
data->mCollector->ForgetSkippable(aRemoveChildlessNodes,
|
||||||
@ -4155,7 +4165,7 @@ nsCycleCollector_collect(nsICycleCollectorListener* aManualListener)
|
|||||||
MOZ_ASSERT(data->mCollector);
|
MOZ_ASSERT(data->mCollector);
|
||||||
|
|
||||||
PROFILER_LABEL("nsCycleCollector", "collect",
|
PROFILER_LABEL("nsCycleCollector", "collect",
|
||||||
js::ProfileEntry::Category::CC);
|
js::ProfileEntry::Category::CC);
|
||||||
|
|
||||||
SliceBudget unlimitedBudget;
|
SliceBudget unlimitedBudget;
|
||||||
data->mCollector->Collect(ManualCC, unlimitedBudget, aManualListener);
|
data->mCollector->Collect(ManualCC, unlimitedBudget, aManualListener);
|
||||||
@ -4171,7 +4181,7 @@ nsCycleCollector_collectSlice(int64_t aSliceTime)
|
|||||||
MOZ_ASSERT(data->mCollector);
|
MOZ_ASSERT(data->mCollector);
|
||||||
|
|
||||||
PROFILER_LABEL("nsCycleCollector", "collectSlice",
|
PROFILER_LABEL("nsCycleCollector", "collectSlice",
|
||||||
js::ProfileEntry::Category::CC);
|
js::ProfileEntry::Category::CC);
|
||||||
|
|
||||||
SliceBudget budget;
|
SliceBudget budget;
|
||||||
if (aSliceTime >= 0) {
|
if (aSliceTime >= 0) {
|
||||||
@ -4190,7 +4200,7 @@ nsCycleCollector_collectSliceWork(int64_t aSliceWork)
|
|||||||
MOZ_ASSERT(data->mCollector);
|
MOZ_ASSERT(data->mCollector);
|
||||||
|
|
||||||
PROFILER_LABEL("nsCycleCollector", "collectSliceWork",
|
PROFILER_LABEL("nsCycleCollector", "collectSliceWork",
|
||||||
js::ProfileEntry::Category::CC);
|
js::ProfileEntry::Category::CC);
|
||||||
|
|
||||||
SliceBudget budget;
|
SliceBudget budget;
|
||||||
if (aSliceWork >= 0) {
|
if (aSliceWork >= 0) {
|
||||||
@ -4235,7 +4245,7 @@ nsCycleCollector_shutdown()
|
|||||||
if (data) {
|
if (data) {
|
||||||
MOZ_ASSERT(data->mCollector);
|
MOZ_ASSERT(data->mCollector);
|
||||||
PROFILER_LABEL("nsCycleCollector", "shutdown",
|
PROFILER_LABEL("nsCycleCollector", "shutdown",
|
||||||
js::ProfileEntry::Category::CC);
|
js::ProfileEntry::Category::CC);
|
||||||
|
|
||||||
data->mCollector->Shutdown();
|
data->mCollector->Shutdown();
|
||||||
data->mCollector = nullptr;
|
data->mCollector = nullptr;
|
||||||
|
@ -236,7 +236,8 @@ InitLog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum nsAssertBehavior {
|
enum nsAssertBehavior
|
||||||
|
{
|
||||||
NS_ASSERT_UNINITIALIZED,
|
NS_ASSERT_UNINITIALIZED,
|
||||||
NS_ASSERT_WARN,
|
NS_ASSERT_WARN,
|
||||||
NS_ASSERT_SUSPEND,
|
NS_ASSERT_SUSPEND,
|
||||||
@ -511,7 +512,8 @@ Break(const char* aMsg)
|
|||||||
static int ignoreDebugger;
|
static int ignoreDebugger;
|
||||||
if (!ignoreDebugger) {
|
if (!ignoreDebugger) {
|
||||||
const char* shouldIgnoreDebugger = getenv("XPCOM_DEBUG_DLG");
|
const char* shouldIgnoreDebugger = getenv("XPCOM_DEBUG_DLG");
|
||||||
ignoreDebugger = 1 + (shouldIgnoreDebugger && !strcmp(shouldIgnoreDebugger, "1"));
|
ignoreDebugger =
|
||||||
|
1 + (shouldIgnoreDebugger && !strcmp(shouldIgnoreDebugger, "1"));
|
||||||
}
|
}
|
||||||
if ((ignoreDebugger == 2) || !::IsDebuggerPresent()) {
|
if ((ignoreDebugger == 2) || !::IsDebuggerPresent()) {
|
||||||
DWORD code = IDRETRY;
|
DWORD code = IDRETRY;
|
||||||
@ -587,8 +589,7 @@ nsDebugImpl::Create(nsISupports* aOuter, const nsIID& aIID, void** aInstancePtr)
|
|||||||
return NS_ERROR_NO_AGGREGATION;
|
return NS_ERROR_NO_AGGREGATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
return const_cast<nsDebugImpl*>(&kImpl)->
|
return const_cast<nsDebugImpl*>(&kImpl)->QueryInterface(aIID, aInstancePtr);
|
||||||
QueryInterface(aIID, aInstancePtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -475,8 +475,7 @@ nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (chmod(dirPath.get(), 0777) == -1 && errno == EINTR)
|
while (chmod(dirPath.get(), 0777) == -1 && errno == EINTR) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -503,8 +502,7 @@ nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (chmod(path.get(), 0666) == -1 && errno == EINTR)
|
while (chmod(path.get(), 0666) == -1 && errno == EINTR) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
NS_IMPL_ISUPPORTS(nsErrorService, nsIErrorService)
|
NS_IMPL_ISUPPORTS(nsErrorService, nsIErrorService)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsErrorService::Create(nsISupports* aOuter, const nsIID& aIID, void** aInstancePtr)
|
nsErrorService::Create(nsISupports* aOuter, const nsIID& aIID,
|
||||||
|
void** aInstancePtr)
|
||||||
{
|
{
|
||||||
if (NS_WARN_IF(aOuter)) {
|
if (NS_WARN_IF(aOuter)) {
|
||||||
return NS_ERROR_NO_AGGREGATION;
|
return NS_ERROR_NO_AGGREGATION;
|
||||||
@ -21,7 +22,8 @@ nsErrorService::Create(nsISupports* aOuter, const nsIID& aIID, void** aInstanceP
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsErrorService::RegisterErrorStringBundle(int16_t aErrorModule, const char* aStringBundleURL)
|
nsErrorService::RegisterErrorStringBundle(int16_t aErrorModule,
|
||||||
|
const char* aStringBundleURL)
|
||||||
{
|
{
|
||||||
mErrorStringBundleURLMap.Put(aErrorModule, new nsCString(aStringBundleURL));
|
mErrorStringBundleURLMap.Put(aErrorModule, new nsCString(aStringBundleURL));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -37,7 +37,8 @@ nsMacUtilsImpl::GetArchString(nsAString& aArchString)
|
|||||||
|
|
||||||
CFIndex archCount = ::CFArrayGetCount(archList);
|
CFIndex archCount = ::CFArrayGetCount(archList);
|
||||||
for (CFIndex i = 0; i < archCount; i++) {
|
for (CFIndex i = 0; i < archCount; i++) {
|
||||||
CFNumberRef arch = static_cast<CFNumberRef>(::CFArrayGetValueAtIndex(archList, i));
|
CFNumberRef arch =
|
||||||
|
static_cast<CFNumberRef>(::CFArrayGetValueAtIndex(archList, i));
|
||||||
|
|
||||||
int archInt = 0;
|
int archInt = 0;
|
||||||
if (!::CFNumberGetValue(arch, kCFNumberIntType, &archInt)) {
|
if (!::CFNumberGetValue(arch, kCFNumberIntType, &archInt)) {
|
||||||
|
@ -124,7 +124,8 @@ private:
|
|||||||
const bool mDumpChildProcesses;
|
const bool mDumpChildProcesses;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED(GCAndCCLogDumpRunnable, nsRunnable, nsIDumpGCAndCCLogsCallback)
|
NS_IMPL_ISUPPORTS_INHERITED(GCAndCCLogDumpRunnable, nsRunnable,
|
||||||
|
nsIDumpGCAndCCLogsCallback)
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
@ -178,10 +179,9 @@ void doGCCCDump(const uint8_t aRecvSig)
|
|||||||
LOG("SignalWatcher(sig %d) dispatching GC/CC log runnable.", aRecvSig);
|
LOG("SignalWatcher(sig %d) dispatching GC/CC log runnable.", aRecvSig);
|
||||||
// Dump GC and CC logs (from the main thread).
|
// Dump GC and CC logs (from the main thread).
|
||||||
nsRefPtr<GCAndCCLogDumpRunnable> runnable =
|
nsRefPtr<GCAndCCLogDumpRunnable> runnable =
|
||||||
new GCAndCCLogDumpRunnable(
|
new GCAndCCLogDumpRunnable(/* identifier = */ EmptyString(),
|
||||||
/* identifier = */ EmptyString(),
|
/* allTraces = */ true,
|
||||||
/* allTraces = */ true,
|
/* dumpChildProcesses = */ true);
|
||||||
/* dumpChildProcesses = */ true);
|
|
||||||
NS_DispatchToMainThread(runnable);
|
NS_DispatchToMainThread(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,8 @@ void
|
|||||||
doMemoryReport(const nsCString& aInputStr)
|
doMemoryReport(const nsCString& aInputStr)
|
||||||
{
|
{
|
||||||
bool minimize = aInputStr.EqualsLiteral("minimize memory report");
|
bool minimize = aInputStr.EqualsLiteral("minimize memory report");
|
||||||
LOG("FifoWatcher(command:%s) dispatching memory report runnable.", aInputStr.get());
|
LOG("FifoWatcher(command:%s) dispatching memory report runnable.",
|
||||||
|
aInputStr.get());
|
||||||
nsRefPtr<DumpMemoryInfoToTempDirRunnable> runnable =
|
nsRefPtr<DumpMemoryInfoToTempDirRunnable> runnable =
|
||||||
new DumpMemoryInfoToTempDirRunnable(/* identifier = */ EmptyString(),
|
new DumpMemoryInfoToTempDirRunnable(/* identifier = */ EmptyString(),
|
||||||
/* anonymize = */ false,
|
/* anonymize = */ false,
|
||||||
@ -314,7 +315,8 @@ EnsureNonEmptyIdentifier(nsAString& aIdentifier)
|
|||||||
// Use XPCOM refcounting to fire |onFinish| when all reference-holders
|
// Use XPCOM refcounting to fire |onFinish| when all reference-holders
|
||||||
// (remote dump actors or the |DumpGCAndCCLogsToFile| activation itself)
|
// (remote dump actors or the |DumpGCAndCCLogsToFile| activation itself)
|
||||||
// have gone away.
|
// have gone away.
|
||||||
class nsDumpGCAndCCLogsCallbackHolder MOZ_FINAL : public nsIDumpGCAndCCLogsCallback
|
class nsDumpGCAndCCLogsCallbackHolder MOZ_FINAL
|
||||||
|
: public nsIDumpGCAndCCLogsCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
@ -1173,7 +1173,8 @@ nsMemoryReporterManager::GetReportsExtended(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (aMinimize) {
|
if (aMinimize) {
|
||||||
rv = MinimizeMemoryUsage(NS_NewRunnableMethod(this, &nsMemoryReporterManager::StartGettingReports));
|
rv = MinimizeMemoryUsage(NS_NewRunnableMethod(
|
||||||
|
this, &nsMemoryReporterManager::StartGettingReports));
|
||||||
} else {
|
} else {
|
||||||
rv = StartGettingReports();
|
rv = StartGettingReports();
|
||||||
}
|
}
|
||||||
@ -1186,7 +1187,7 @@ nsMemoryReporterManager::StartGettingReports()
|
|||||||
GetReportsState* s = mGetReportsState;
|
GetReportsState* s = mGetReportsState;
|
||||||
|
|
||||||
// Get reports for this process.
|
// Get reports for this process.
|
||||||
FILE *parentDMDFile = nullptr;
|
FILE* parentDMDFile = nullptr;
|
||||||
#ifdef MOZ_DMD
|
#ifdef MOZ_DMD
|
||||||
nsresult rv = nsMemoryInfoDumper::OpenDMDFile(s->mDMDDumpIdent, getpid(),
|
nsresult rv = nsMemoryInfoDumper::OpenDMDFile(s->mDMDDumpIdent, getpid(),
|
||||||
&parentDMDFile);
|
&parentDMDFile);
|
||||||
@ -1200,9 +1201,8 @@ nsMemoryReporterManager::StartGettingReports()
|
|||||||
s->mParentDone = true;
|
s->mParentDone = true;
|
||||||
|
|
||||||
// If there are no remaining child processes, we can finish up immediately.
|
// If there are no remaining child processes, we can finish up immediately.
|
||||||
return (s->mNumChildProcessesCompleted >= s->mNumChildProcesses)
|
return (s->mNumChildProcessesCompleted >= s->mNumChildProcesses) ?
|
||||||
? FinishReporting()
|
FinishReporting() : NS_OK;
|
||||||
: NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef nsCOMArray<nsIMemoryReporter> MemoryReporterArray;
|
typedef nsCOMArray<nsIMemoryReporter> MemoryReporterArray;
|
||||||
|
@ -255,7 +255,7 @@ PrintError(const char* aPrefix)
|
|||||||
nullptr,
|
nullptr,
|
||||||
lastErr,
|
lastErr,
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||||
(LPSTR) &lpMsgBuf,
|
(LPSTR)&lpMsgBuf,
|
||||||
0,
|
0,
|
||||||
nullptr
|
nullptr
|
||||||
);
|
);
|
||||||
@ -286,9 +286,8 @@ EnsureWalkThreadReady()
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned int threadID;
|
unsigned int threadID;
|
||||||
stackWalkThread = (HANDLE)
|
stackWalkThread = (HANDLE)_beginthreadex(nullptr, 0, WalkStackThread,
|
||||||
_beginthreadex(nullptr, 0, WalkStackThread, (void*)readyEvent,
|
(void*)readyEvent, 0, &threadID);
|
||||||
0, &threadID);
|
|
||||||
if (!stackWalkThread) {
|
if (!stackWalkThread) {
|
||||||
PrintError("CreateThread");
|
PrintError("CreateThread");
|
||||||
::CloseHandle(readyEvent);
|
::CloseHandle(readyEvent);
|
||||||
@ -455,7 +454,7 @@ WalkStackThread(void* aData)
|
|||||||
HANDLE readyEvent = (HANDLE)aData;
|
HANDLE readyEvent = (HANDLE)aData;
|
||||||
::SetEvent(readyEvent);
|
::SetEvent(readyEvent);
|
||||||
|
|
||||||
while ((msgRet = ::GetMessage(&msg, (HWND) - 1, 0, 0)) != 0) {
|
while ((msgRet = ::GetMessage(&msg, (HWND)-1, 0, 0)) != 0) {
|
||||||
if (msgRet == -1) {
|
if (msgRet == -1) {
|
||||||
PrintError("GetMessage");
|
PrintError("GetMessage");
|
||||||
} else {
|
} else {
|
||||||
@ -972,7 +971,7 @@ static void
|
|||||||
myinit()
|
myinit()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (! initialized) {
|
if (!initialized) {
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
void *handle;
|
void *handle;
|
||||||
const char *libdem = "libdemangle.so.1";
|
const char *libdem = "libdemangle.so.1";
|
||||||
|
@ -202,7 +202,8 @@ nsSystemInfo::Init()
|
|||||||
versionDouble >= 6.2);
|
versionDouble >= 6.2);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
#else
|
#else
|
||||||
rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16("hasWindowsTouchInterface"), false);
|
rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16("hasWindowsTouchInterface"),
|
||||||
|
false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -235,7 +236,8 @@ nsSystemInfo::Init()
|
|||||||
if (NS_FAILED(GetProfileHDDInfo())) {
|
if (NS_FAILED(GetProfileHDDInfo())) {
|
||||||
// We might have been called before profile-do-change. We'll observe that
|
// We might have been called before profile-do-change. We'll observe that
|
||||||
// event so that we can fill this in later.
|
// event so that we can fill this in later.
|
||||||
nsCOMPtr<nsIObserverService> obsService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv);
|
nsCOMPtr<nsIObserverService> obsService =
|
||||||
|
do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -263,7 +265,8 @@ nsSystemInfo::Init()
|
|||||||
|
|
||||||
#if defined(MOZ_WIDGET_GTK)
|
#if defined(MOZ_WIDGET_GTK)
|
||||||
// This must be done here because NSPR can only separate OS's when compiled, not libraries.
|
// This must be done here because NSPR can only separate OS's when compiled, not libraries.
|
||||||
char* gtkver = PR_smprintf("GTK %u.%u.%u", gtk_major_version, gtk_minor_version, gtk_micro_version);
|
char* gtkver = PR_smprintf("GTK %u.%u.%u", gtk_major_version,
|
||||||
|
gtk_minor_version, gtk_micro_version);
|
||||||
if (gtkver) {
|
if (gtkver) {
|
||||||
rv = SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"),
|
rv = SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"),
|
||||||
nsDependentCString(gtkver));
|
nsDependentCString(gtkver));
|
||||||
@ -396,8 +399,8 @@ nsSystemInfo::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
{
|
{
|
||||||
if (!strcmp(aTopic, "profile-do-change")) {
|
if (!strcmp(aTopic, "profile-do-change")) {
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIObserverService> obsService = do_GetService(
|
nsCOMPtr<nsIObserverService> obsService =
|
||||||
NS_OBSERVERSERVICE_CONTRACTID, &rv);
|
do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,8 @@ public:
|
|||||||
(aStats->mCreates != aStats->mDestroys));
|
(aStats->mCreates != aStats->mDestroys));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrintDumpHeader(FILE* aOut, const char* aMsg, nsTraceRefcnt::StatisticsType aType)
|
bool PrintDumpHeader(FILE* aOut, const char* aMsg,
|
||||||
|
nsTraceRefcnt::StatisticsType aType)
|
||||||
{
|
{
|
||||||
fprintf(aOut, "\n== BloatView: %s, %s process %d\n", aMsg,
|
fprintf(aOut, "\n== BloatView: %s, %s process %d\n", aMsg,
|
||||||
XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid());
|
XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid());
|
||||||
@ -447,7 +448,8 @@ public:
|
|||||||
|
|
||||||
void Dump(int aIndex, FILE* aOut, nsTraceRefcnt::StatisticsType aType)
|
void Dump(int aIndex, FILE* aOut, nsTraceRefcnt::StatisticsType aType)
|
||||||
{
|
{
|
||||||
nsTraceRefcntStats* stats = (aType == nsTraceRefcnt::NEW_STATS) ? &mNewStats : &mAllStats;
|
nsTraceRefcntStats* stats =
|
||||||
|
(aType == nsTraceRefcnt::NEW_STATS) ? &mNewStats : &mAllStats;
|
||||||
if (gLogLeaksOnly && !HaveLeaks(stats)) {
|
if (gLogLeaksOnly && !HaveLeaks(stats)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -573,7 +575,7 @@ DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <>
|
template<>
|
||||||
class nsDefaultComparator<BloatEntry*, BloatEntry*>
|
class nsDefaultComparator<BloatEntry*, BloatEntry*>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -677,7 +679,9 @@ LogThisType(const char* aTypeName)
|
|||||||
static intptr_t
|
static intptr_t
|
||||||
GetSerialNumber(void* aPtr, bool aCreate)
|
GetSerialNumber(void* aPtr, bool aCreate)
|
||||||
{
|
{
|
||||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
|
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
|
||||||
|
PLHashNumber(NS_PTR_TO_INT32(aPtr)),
|
||||||
|
aPtr);
|
||||||
if (hep && *hep) {
|
if (hep && *hep) {
|
||||||
return reinterpret_cast<serialNumberRecord*>((*hep)->value)->serialNumber;
|
return reinterpret_cast<serialNumberRecord*>((*hep)->value)->serialNumber;
|
||||||
} else if (aCreate) {
|
} else if (aCreate) {
|
||||||
@ -685,7 +689,8 @@ GetSerialNumber(void* aPtr, bool aCreate)
|
|||||||
record->serialNumber = ++gNextSerialNumber;
|
record->serialNumber = ++gNextSerialNumber;
|
||||||
record->refCount = 0;
|
record->refCount = 0;
|
||||||
record->COMPtrCount = 0;
|
record->COMPtrCount = 0;
|
||||||
PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr, reinterpret_cast<void*>(record));
|
PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(NS_PTR_TO_INT32(aPtr)),
|
||||||
|
aPtr, reinterpret_cast<void*>(record));
|
||||||
return gNextSerialNumber;
|
return gNextSerialNumber;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -694,7 +699,9 @@ GetSerialNumber(void* aPtr, bool aCreate)
|
|||||||
static int32_t*
|
static int32_t*
|
||||||
GetRefCount(void* aPtr)
|
GetRefCount(void* aPtr)
|
||||||
{
|
{
|
||||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
|
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
|
||||||
|
PLHashNumber(NS_PTR_TO_INT32(aPtr)),
|
||||||
|
aPtr);
|
||||||
if (hep && *hep) {
|
if (hep && *hep) {
|
||||||
return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->refCount);
|
return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->refCount);
|
||||||
} else {
|
} else {
|
||||||
@ -706,7 +713,9 @@ GetRefCount(void* aPtr)
|
|||||||
static int32_t*
|
static int32_t*
|
||||||
GetCOMPtrCount(void* aPtr)
|
GetCOMPtrCount(void* aPtr)
|
||||||
{
|
{
|
||||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
|
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
|
||||||
|
PLHashNumber(NS_PTR_TO_INT32(aPtr)),
|
||||||
|
aPtr);
|
||||||
if (hep && *hep) {
|
if (hep && *hep) {
|
||||||
return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->COMPtrCount);
|
return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->COMPtrCount);
|
||||||
}
|
}
|
||||||
@ -959,7 +968,7 @@ PrintStackFrame(void* aPC, void* aSP, void* aClosure)
|
|||||||
static void
|
static void
|
||||||
PrintStackFrameCached(void* aPC, void* aSP, void* aClosure)
|
PrintStackFrameCached(void* aPC, void* aSP, void* aClosure)
|
||||||
{
|
{
|
||||||
CodeAddressServiceWriter *writer = static_cast<CodeAddressServiceWriter*>(aClosure);
|
auto writer = static_cast<CodeAddressServiceWriter*>(aClosure);
|
||||||
gCodeAddressService->WriteLocation(*writer, aPC);
|
gCodeAddressService->WriteLocation(*writer, aPC);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -983,8 +992,8 @@ nsTraceRefcnt::WalkTheStackCached(FILE* aStream)
|
|||||||
gCodeAddressService = new WalkTheStackCodeAddressService();
|
gCodeAddressService = new WalkTheStackCodeAddressService();
|
||||||
}
|
}
|
||||||
CodeAddressServiceWriter writer(aStream);
|
CodeAddressServiceWriter writer(aStream);
|
||||||
NS_StackWalk(PrintStackFrameCached, /* skipFrames */ 2, /* maxFrames */ 0, &writer,
|
NS_StackWalk(PrintStackFrameCached, /* skipFrames */ 2, /* maxFrames */ 0,
|
||||||
0, nullptr);
|
&writer, 0, nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1092,7 +1101,7 @@ LogTerm()
|
|||||||
|
|
||||||
EXPORT_XPCOM_API(void)
|
EXPORT_XPCOM_API(void)
|
||||||
NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
|
NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
|
||||||
const char* aClazz, uint32_t aClassSize)
|
const char* aClass, uint32_t aClassSize)
|
||||||
{
|
{
|
||||||
#ifdef NS_IMPL_REFCNT_LOGGING
|
#ifdef NS_IMPL_REFCNT_LOGGING
|
||||||
ASSERT_ACTIVITY_IS_LEGAL;
|
ASSERT_ACTIVITY_IS_LEGAL;
|
||||||
@ -1103,7 +1112,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
|
|||||||
LOCK_TRACELOG();
|
LOCK_TRACELOG();
|
||||||
|
|
||||||
if (gBloatLog) {
|
if (gBloatLog) {
|
||||||
BloatEntry* entry = GetBloatEntry(aClazz, aClassSize);
|
BloatEntry* entry = GetBloatEntry(aClass, aClassSize);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
entry->AddRef(aRefcnt);
|
entry->AddRef(aRefcnt);
|
||||||
}
|
}
|
||||||
@ -1112,7 +1121,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
|
|||||||
// Here's the case where MOZ_COUNT_CTOR was not used,
|
// Here's the case where MOZ_COUNT_CTOR was not used,
|
||||||
// yet we still want to see creation information:
|
// yet we still want to see creation information:
|
||||||
|
|
||||||
bool loggingThisType = (!gTypesToLog || LogThisType(aClazz));
|
bool loggingThisType = (!gTypesToLog || LogThisType(aClass));
|
||||||
intptr_t serialno = 0;
|
intptr_t serialno = 0;
|
||||||
if (gSerialNumbers && loggingThisType) {
|
if (gSerialNumbers && loggingThisType) {
|
||||||
serialno = GetSerialNumber(aPtr, aRefcnt == 1);
|
serialno = GetSerialNumber(aPtr, aRefcnt == 1);
|
||||||
@ -1129,14 +1138,15 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
|
|||||||
bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||||
if (aRefcnt == 1 && gAllocLog && loggingThisType && loggingThisObject) {
|
if (aRefcnt == 1 && gAllocLog && loggingThisType && loggingThisObject) {
|
||||||
fprintf(gAllocLog, "\n<%s> 0x%08X %" PRIdPTR " Create\n",
|
fprintf(gAllocLog, "\n<%s> 0x%08X %" PRIdPTR " Create\n",
|
||||||
aClazz, NS_PTR_TO_INT32(aPtr), serialno);
|
aClass, NS_PTR_TO_INT32(aPtr), serialno);
|
||||||
nsTraceRefcnt::WalkTheStackCached(gAllocLog);
|
nsTraceRefcnt::WalkTheStackCached(gAllocLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gRefcntsLog && loggingThisType && loggingThisObject) {
|
if (gRefcntsLog && loggingThisType && loggingThisObject) {
|
||||||
// Can't use PR_LOG(), b/c it truncates the line
|
// Can't use PR_LOG(), b/c it truncates the line
|
||||||
fprintf(gRefcntsLog,
|
fprintf(gRefcntsLog,
|
||||||
"\n<%s> 0x%08X %" PRIuPTR " AddRef %" PRIuPTR "\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
|
"\n<%s> 0x%08X %" PRIuPTR " AddRef %" PRIuPTR "\n",
|
||||||
|
aClass, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
|
||||||
nsTraceRefcnt::WalkTheStackCached(gRefcntsLog);
|
nsTraceRefcnt::WalkTheStackCached(gRefcntsLog);
|
||||||
fflush(gRefcntsLog);
|
fflush(gRefcntsLog);
|
||||||
}
|
}
|
||||||
@ -1146,7 +1156,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_XPCOM_API(void)
|
EXPORT_XPCOM_API(void)
|
||||||
NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz)
|
NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClass)
|
||||||
{
|
{
|
||||||
#ifdef NS_IMPL_REFCNT_LOGGING
|
#ifdef NS_IMPL_REFCNT_LOGGING
|
||||||
ASSERT_ACTIVITY_IS_LEGAL;
|
ASSERT_ACTIVITY_IS_LEGAL;
|
||||||
@ -1157,13 +1167,13 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz)
|
|||||||
LOCK_TRACELOG();
|
LOCK_TRACELOG();
|
||||||
|
|
||||||
if (gBloatLog) {
|
if (gBloatLog) {
|
||||||
BloatEntry* entry = GetBloatEntry(aClazz, 0);
|
BloatEntry* entry = GetBloatEntry(aClass, 0);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
entry->Release(aRefcnt);
|
entry->Release(aRefcnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool loggingThisType = (!gTypesToLog || LogThisType(aClazz));
|
bool loggingThisType = (!gTypesToLog || LogThisType(aClass));
|
||||||
intptr_t serialno = 0;
|
intptr_t serialno = 0;
|
||||||
if (gSerialNumbers && loggingThisType) {
|
if (gSerialNumbers && loggingThisType) {
|
||||||
serialno = GetSerialNumber(aPtr, false);
|
serialno = GetSerialNumber(aPtr, false);
|
||||||
@ -1181,7 +1191,8 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz)
|
|||||||
if (gRefcntsLog && loggingThisType && loggingThisObject) {
|
if (gRefcntsLog && loggingThisType && loggingThisObject) {
|
||||||
// Can't use PR_LOG(), b/c it truncates the line
|
// Can't use PR_LOG(), b/c it truncates the line
|
||||||
fprintf(gRefcntsLog,
|
fprintf(gRefcntsLog,
|
||||||
"\n<%s> 0x%08X %" PRIuPTR " Release %" PRIuPTR "\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
|
"\n<%s> 0x%08X %" PRIuPTR " Release %" PRIuPTR "\n", aClass,
|
||||||
|
NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
|
||||||
nsTraceRefcnt::WalkTheStackCached(gRefcntsLog);
|
nsTraceRefcnt::WalkTheStackCached(gRefcntsLog);
|
||||||
fflush(gRefcntsLog);
|
fflush(gRefcntsLog);
|
||||||
}
|
}
|
||||||
@ -1192,7 +1203,7 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz)
|
|||||||
if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
|
if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
|
||||||
fprintf(gAllocLog,
|
fprintf(gAllocLog,
|
||||||
"\n<%s> 0x%08X %" PRIdPTR " Destroy\n",
|
"\n<%s> 0x%08X %" PRIdPTR " Destroy\n",
|
||||||
aClazz, NS_PTR_TO_INT32(aPtr), serialno);
|
aClass, NS_PTR_TO_INT32(aPtr), serialno);
|
||||||
nsTraceRefcnt::WalkTheStackCached(gAllocLog);
|
nsTraceRefcnt::WalkTheStackCached(gAllocLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "nsUUIDGenerator.h"
|
#include "nsUUIDGenerator.h"
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
extern "C" NS_EXPORT void arc4random_buf(void *, size_t);
|
extern "C" NS_EXPORT void arc4random_buf(void*, size_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
NS_IMPL_ISUPPORTS(nsVersionComparatorImpl, nsIVersionComparator)
|
NS_IMPL_ISUPPORTS(nsVersionComparatorImpl, nsIVersionComparator)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsVersionComparatorImpl::Compare(const nsACString& aStr1, const nsACString& aStr2,
|
nsVersionComparatorImpl::Compare(const nsACString& aStr1,
|
||||||
|
const nsACString& aStr2,
|
||||||
int32_t* aResult)
|
int32_t* aResult)
|
||||||
{
|
{
|
||||||
*aResult = mozilla::CompareVersions(PromiseFlatCString(aStr1).get(),
|
*aResult = mozilla::CompareVersions(PromiseFlatCString(aStr1).get(),
|
||||||
|
@ -447,8 +447,9 @@ CountingAllocatorBase<VPXReporter>::sAmount(0);
|
|||||||
#endif /* MOZ_VPX */
|
#endif /* MOZ_VPX */
|
||||||
|
|
||||||
#ifdef MOZ_WEBM
|
#ifdef MOZ_WEBM
|
||||||
class NesteggReporter MOZ_FINAL : public nsIMemoryReporter
|
class NesteggReporter MOZ_FINAL
|
||||||
, public CountingAllocatorBase<NesteggReporter>
|
: public nsIMemoryReporter
|
||||||
|
, public CountingAllocatorBase<NesteggReporter>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
@ -817,7 +818,7 @@ ShutdownXPCOM(nsIServiceManager* aServMgr)
|
|||||||
|
|
||||||
nsRefPtr<nsObserverService> observerService;
|
nsRefPtr<nsObserverService> observerService;
|
||||||
CallGetService("@mozilla.org/observer-service;1",
|
CallGetService("@mozilla.org/observer-service;1",
|
||||||
(nsObserverService**) getter_AddRefs(observerService));
|
(nsObserverService**)getter_AddRefs(observerService));
|
||||||
|
|
||||||
if (observerService) {
|
if (observerService) {
|
||||||
observerService->NotifyObservers(nullptr,
|
observerService->NotifyObservers(nullptr,
|
||||||
|
@ -225,7 +225,7 @@ LogMessageWithContext(FileLocation& aFile,
|
|||||||
// This can happen early in component registration. Fall back to a
|
// This can happen early in component registration. Fall back to a
|
||||||
// generic console message.
|
// generic console message.
|
||||||
LogMessage("Warning: in '%s', line %i: %s", file.get(),
|
LogMessage("Warning: in '%s', line %i: %s", file.get(),
|
||||||
aLineNumber, (char*) formatted);
|
aLineNumber, (char*)formatted);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,12 +213,7 @@ EntryEnumerator::Create(nsTHashtable<CategoryLeaf>& aTable)
|
|||||||
CategoryNode*
|
CategoryNode*
|
||||||
CategoryNode::Create(PLArenaPool* aArena)
|
CategoryNode::Create(PLArenaPool* aArena)
|
||||||
{
|
{
|
||||||
CategoryNode* node = new(aArena) CategoryNode();
|
return new (aArena) CategoryNode();
|
||||||
if (!node) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CategoryNode::~CategoryNode()
|
CategoryNode::~CategoryNode()
|
||||||
|
@ -35,8 +35,7 @@ namespace mozilla {
|
|||||||
//
|
//
|
||||||
|
|
||||||
// static members
|
// static members
|
||||||
const char* const BlockingResourceBase::kResourceTypeName[] =
|
const char* const BlockingResourceBase::kResourceTypeName[] = {
|
||||||
{
|
|
||||||
// needs to be kept in sync with BlockingResourceType
|
// needs to be kept in sync with BlockingResourceType
|
||||||
"Mutex", "ReentrantMonitor", "CondVar"
|
"Mutex", "ReentrantMonitor", "CondVar"
|
||||||
};
|
};
|
||||||
@ -88,7 +87,8 @@ BlockingResourceBase::GetStackTrace(AcquisitionState& aState)
|
|||||||
* some info is written into |aOut|
|
* some info is written into |aOut|
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
PrintCycle(const BlockingResourceBase::DDT::ResourceAcquisitionArray* aCycle, nsACString& aOut)
|
PrintCycle(const BlockingResourceBase::DDT::ResourceAcquisitionArray* aCycle,
|
||||||
|
nsACString& aOut)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aCycle->Length() > 1, "need > 1 element for cycle!");
|
NS_ASSERTION(aCycle->Length() > 1, "need > 1 element for cycle!");
|
||||||
|
|
||||||
@ -97,12 +97,15 @@ PrintCycle(const BlockingResourceBase::DDT::ResourceAcquisitionArray* aCycle, ns
|
|||||||
fputs("=== Cyclical dependency starts at\n", stderr);
|
fputs("=== Cyclical dependency starts at\n", stderr);
|
||||||
aOut += "Cyclical dependency starts at\n";
|
aOut += "Cyclical dependency starts at\n";
|
||||||
|
|
||||||
const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type res = aCycle->ElementAt(0);
|
const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type res =
|
||||||
|
aCycle->ElementAt(0);
|
||||||
maybeImminent &= res->Print(aOut);
|
maybeImminent &= res->Print(aOut);
|
||||||
|
|
||||||
BlockingResourceBase::DDT::ResourceAcquisitionArray::index_type i;
|
BlockingResourceBase::DDT::ResourceAcquisitionArray::index_type i;
|
||||||
BlockingResourceBase::DDT::ResourceAcquisitionArray::size_type len = aCycle->Length();
|
BlockingResourceBase::DDT::ResourceAcquisitionArray::size_type len =
|
||||||
const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type* it = 1 + aCycle->Elements();
|
aCycle->Length();
|
||||||
|
const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type* it =
|
||||||
|
1 + aCycle->Elements();
|
||||||
for (i = 1; i < len - 1; ++i, ++it) {
|
for (i = 1; i < len - 1; ++i, ++it) {
|
||||||
fputs("\n--- Next dependency:\n", stderr);
|
fputs("\n--- Next dependency:\n", stderr);
|
||||||
aOut += "\nNext dependency:\n";
|
aOut += "\nNext dependency:\n";
|
||||||
|
@ -142,8 +142,8 @@ mozilla::ReadSysFile(
|
|||||||
ssize_t bytesRead;
|
ssize_t bytesRead;
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
do {
|
do {
|
||||||
bytesRead = MOZ_TEMP_FAILURE_RETRY(
|
bytesRead = MOZ_TEMP_FAILURE_RETRY(read(fd, aBuf + offset,
|
||||||
read(fd, aBuf + offset, aBufSize - offset));
|
aBufSize - offset));
|
||||||
if (bytesRead == -1) {
|
if (bytesRead == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,9 @@ nsQueryInterface::operator()(const nsIID& aIID, void** aAnswer) const
|
|||||||
NS_ASSERTION(NS_SUCCEEDED(status),
|
NS_ASSERTION(NS_SUCCEEDED(status),
|
||||||
"interface not found---were you expecting that?");
|
"interface not found---were you expecting that?");
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else {
|
||||||
status = NS_ERROR_NULL_POINTER;
|
status = NS_ERROR_NULL_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -32,8 +33,9 @@ nsQueryInterfaceWithError::operator()(const nsIID& aIID, void** aAnswer) const
|
|||||||
NS_ASSERTION(NS_SUCCEEDED(status),
|
NS_ASSERTION(NS_SUCCEEDED(status),
|
||||||
"interface not found---were you expecting that?");
|
"interface not found---were you expecting that?");
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else {
|
||||||
status = NS_ERROR_NULL_POINTER;
|
status = NS_ERROR_NULL_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
if (mErrorPtr) {
|
if (mErrorPtr) {
|
||||||
*mErrorPtr = status;
|
*mErrorPtr = status;
|
||||||
|
@ -69,7 +69,7 @@ nsDeque::~nsDeque()
|
|||||||
printf("Capacity: %i\n", mCapacity);
|
printf("Capacity: %i\n", mCapacity);
|
||||||
|
|
||||||
static int mCaps[15] = {0};
|
static int mCaps[15] = {0};
|
||||||
switch(mCapacity) {
|
switch (mCapacity) {
|
||||||
case 4: mCaps[0]++; break;
|
case 4: mCaps[0]++; break;
|
||||||
case 8: mCaps[1]++; break;
|
case 8: mCaps[1]++; break;
|
||||||
case 16: mCaps[2]++; break;
|
case 16: mCaps[2]++; break;
|
||||||
@ -366,7 +366,8 @@ nsDeque::RemoveObjectAt(int32_t aIndex)
|
|||||||
// "Shuffle down" all elements in the array by 1, overwritting the element
|
// "Shuffle down" all elements in the array by 1, overwritting the element
|
||||||
// being removed.
|
// being removed.
|
||||||
for (int32_t i = aIndex; i < mSize; ++i) {
|
for (int32_t i = aIndex; i < mSize; ++i) {
|
||||||
mData[modulus(mOrigin + i, mCapacity)] = mData[modulus(mOrigin + i + 1, mCapacity)];
|
mData[modulus(mOrigin + i, mCapacity)] =
|
||||||
|
mData[modulus(mOrigin + i + 1, mCapacity)];
|
||||||
}
|
}
|
||||||
mSize--;
|
mSize--;
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ nsUnionEnumerator::HasMoreElements(bool* aResult)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! mAtSecond) {
|
if (!mAtSecond) {
|
||||||
rv = mFirstEnumerator->HasMoreElements(aResult);
|
rv = mFirstEnumerator->HasMoreElements(aResult);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -266,7 +266,7 @@ nsUnionEnumerator::GetNext(nsISupports** aResult)
|
|||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! mAtSecond) {
|
if (!mAtSecond) {
|
||||||
return mFirstEnumerator->GetNext(aResult);
|
return mFirstEnumerator->GetNext(aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,9 +279,9 @@ NS_NewUnionEnumerator(nsISimpleEnumerator** aResult,
|
|||||||
nsISimpleEnumerator* aSecondEnumerator)
|
nsISimpleEnumerator* aSecondEnumerator)
|
||||||
{
|
{
|
||||||
*aResult = nullptr;
|
*aResult = nullptr;
|
||||||
if (! aFirstEnumerator) {
|
if (!aFirstEnumerator) {
|
||||||
*aResult = aSecondEnumerator;
|
*aResult = aSecondEnumerator;
|
||||||
} else if (! aSecondEnumerator) {
|
} else if (!aSecondEnumerator) {
|
||||||
*aResult = aFirstEnumerator;
|
*aResult = aFirstEnumerator;
|
||||||
} else {
|
} else {
|
||||||
nsUnionEnumerator* enumer = new nsUnionEnumerator(aFirstEnumerator,
|
nsUnionEnumerator* enumer = new nsUnionEnumerator(aFirstEnumerator,
|
||||||
|
@ -258,8 +258,9 @@ PL_DHashTableInit(PLDHashTable* aTable, const PLDHashTableOps* aOps,
|
|||||||
aTable->entryCount = aTable->removedCount = 0;
|
aTable->entryCount = aTable->removedCount = 0;
|
||||||
aTable->generation = 0;
|
aTable->generation = 0;
|
||||||
uint32_t nbytes;
|
uint32_t nbytes;
|
||||||
if (!SizeOfEntryStore(capacity, aEntrySize, &nbytes))
|
if (!SizeOfEntryStore(capacity, aEntrySize, &nbytes)) {
|
||||||
return false; // overflowed
|
return false; // overflowed
|
||||||
|
}
|
||||||
|
|
||||||
aTable->entryStore = (char*)aOps->allocTable(aTable, nbytes);
|
aTable->entryStore = (char*)aOps->allocTable(aTable, nbytes);
|
||||||
if (!aTable->entryStore) {
|
if (!aTable->entryStore) {
|
||||||
|
@ -19,7 +19,7 @@ const unsigned char* base =
|
|||||||
"abcdefghijklmnopqrstuvwxyz"
|
"abcdefghijklmnopqrstuvwxyz"
|
||||||
"0123456789+/";
|
"0123456789+/";
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
static void
|
static void
|
||||||
Encode3to4(const unsigned char* aSrc, T* aDest)
|
Encode3to4(const unsigned char* aSrc, T* aDest)
|
||||||
{
|
{
|
||||||
@ -37,7 +37,7 @@ Encode3to4(const unsigned char* aSrc, T* aDest)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
static void
|
static void
|
||||||
Encode2to4(const unsigned char* aSrc, T* aDest)
|
Encode2to4(const unsigned char* aSrc, T* aDest)
|
||||||
{
|
{
|
||||||
@ -47,7 +47,7 @@ Encode2to4(const unsigned char* aSrc, T* aDest)
|
|||||||
aDest[3] = (unsigned char)'=';
|
aDest[3] = (unsigned char)'=';
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
static void
|
static void
|
||||||
Encode1to4(const unsigned char* aSrc, T* aDest)
|
Encode1to4(const unsigned char* aSrc, T* aDest)
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ Encode1to4(const unsigned char* aSrc, T* aDest)
|
|||||||
aDest[3] = (unsigned char)'=';
|
aDest[3] = (unsigned char)'=';
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
static void
|
static void
|
||||||
Encode(const unsigned char* aSrc, uint32_t aSrcLen, T* aDest)
|
Encode(const unsigned char* aSrc, uint32_t aSrcLen, T* aDest)
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ Encode(const unsigned char* aSrc, uint32_t aSrcLen, T* aDest)
|
|||||||
|
|
||||||
// END base64 encode code copied and modified from NSPR.
|
// END base64 encode code copied and modified from NSPR.
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
struct EncodeInputStream_State
|
struct EncodeInputStream_State
|
||||||
{
|
{
|
||||||
unsigned char c[3];
|
unsigned char c[3];
|
||||||
@ -92,7 +92,7 @@ struct EncodeInputStream_State
|
|||||||
typename T::char_type* buffer;
|
typename T::char_type* buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
NS_METHOD
|
NS_METHOD
|
||||||
EncodeInputStream_Encoder(nsIInputStream* aStream,
|
EncodeInputStream_Encoder(nsIInputStream* aStream,
|
||||||
void* aClosure,
|
void* aClosure,
|
||||||
@ -152,7 +152,7 @@ EncodeInputStream_Encoder(nsIInputStream* aStream,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
nsresult
|
nsresult
|
||||||
EncodeInputStream(nsIInputStream* aInputStream,
|
EncodeInputStream(nsIInputStream* aInputStream,
|
||||||
T& aDest,
|
T& aDest,
|
||||||
|
@ -153,14 +153,16 @@ nsAppFileLocationProvider::GetFile(const char* aProp, bool* aPersistent,
|
|||||||
}
|
}
|
||||||
#ifdef MOZ_WIDGET_COCOA
|
#ifdef MOZ_WIDGET_COCOA
|
||||||
else if (nsCRT::strcmp(aProp, NS_MACOSX_USER_PLUGIN_DIR) == 0) {
|
else if (nsCRT::strcmp(aProp, NS_MACOSX_USER_PLUGIN_DIR) == 0) {
|
||||||
if (::FSFindFolder(kUserDomain, kInternetPlugInFolderType, false, &fileRef) == noErr) {
|
if (::FSFindFolder(kUserDomain, kInternetPlugInFolderType, false,
|
||||||
|
&fileRef) == noErr) {
|
||||||
rv = NS_NewLocalFileWithFSRef(&fileRef, true, getter_AddRefs(macFile));
|
rv = NS_NewLocalFileWithFSRef(&fileRef, true, getter_AddRefs(macFile));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
localFile = macFile;
|
localFile = macFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (nsCRT::strcmp(aProp, NS_MACOSX_LOCAL_PLUGIN_DIR) == 0) {
|
} else if (nsCRT::strcmp(aProp, NS_MACOSX_LOCAL_PLUGIN_DIR) == 0) {
|
||||||
if (::FSFindFolder(kLocalDomain, kInternetPlugInFolderType, false, &fileRef) == noErr) {
|
if (::FSFindFolder(kLocalDomain, kInternetPlugInFolderType, false,
|
||||||
|
&fileRef) == noErr) {
|
||||||
rv = NS_NewLocalFileWithFSRef(&fileRef, true, getter_AddRefs(macFile));
|
rv = NS_NewLocalFileWithFSRef(&fileRef, true, getter_AddRefs(macFile));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
localFile = macFile;
|
localFile = macFile;
|
||||||
@ -169,7 +171,8 @@ nsAppFileLocationProvider::GetFile(const char* aProp, bool* aPersistent,
|
|||||||
} else if (nsCRT::strcmp(aProp, NS_MACOSX_JAVA2_PLUGIN_DIR) == 0) {
|
} else if (nsCRT::strcmp(aProp, NS_MACOSX_JAVA2_PLUGIN_DIR) == 0) {
|
||||||
static const char* const java2PluginDirPath =
|
static const char* const java2PluginDirPath =
|
||||||
"/System/Library/Java/Support/Deploy.bundle/Contents/Resources/";
|
"/System/Library/Java/Support/Deploy.bundle/Contents/Resources/";
|
||||||
rv = NS_NewNativeLocalFile(nsDependentCString(java2PluginDirPath), true, getter_AddRefs(localFile));
|
rv = NS_NewNativeLocalFile(nsDependentCString(java2PluginDirPath), true,
|
||||||
|
getter_AddRefs(localFile));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
else if (nsCRT::strcmp(aProp, NS_ENV_PLUGINS_DIR) == 0) {
|
else if (nsCRT::strcmp(aProp, NS_ENV_PLUGINS_DIR) == 0) {
|
||||||
@ -294,7 +297,8 @@ nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
|
|||||||
|
|
||||||
#if defined(MOZ_WIDGET_COCOA)
|
#if defined(MOZ_WIDGET_COCOA)
|
||||||
FSRef fsRef;
|
FSRef fsRef;
|
||||||
OSType folderType = aLocal ? (OSType) kCachedDataFolderType : (OSType) kDomainLibraryFolderType;
|
OSType folderType = aLocal ? (OSType)kCachedDataFolderType :
|
||||||
|
(OSType)kDomainLibraryFolderType;
|
||||||
OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef);
|
OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef);
|
||||||
if (err) {
|
if (err) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -320,7 +324,8 @@ nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
#elif defined(XP_UNIX)
|
#elif defined(XP_UNIX)
|
||||||
rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true, getter_AddRefs(localDir));
|
rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true,
|
||||||
|
getter_AddRefs(localDir));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -826,7 +826,7 @@ nsBinaryInputStream::ReadByteArray(uint32_t aLength, uint8_t** aResult)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength,
|
nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength,
|
||||||
JS::Handle<JS::Value> aBuffer,
|
JS::Handle<JS::Value> aBuffer,
|
||||||
JSContext* aCx, uint32_t *rLength)
|
JSContext* aCx, uint32_t* aReadLength)
|
||||||
{
|
{
|
||||||
if (!aBuffer.isObject()) {
|
if (!aBuffer.isObject()) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -850,7 +850,7 @@ nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength,
|
|||||||
UniquePtr<char[]> buf = MakeUnique<char[]>(bufSize);
|
UniquePtr<char[]> buf = MakeUnique<char[]>(bufSize);
|
||||||
|
|
||||||
uint32_t remaining = aLength;
|
uint32_t remaining = aLength;
|
||||||
*rLength = 0;
|
*aReadLength = 0;
|
||||||
do {
|
do {
|
||||||
// Read data into temporary buffer.
|
// Read data into temporary buffer.
|
||||||
uint32_t bytesRead;
|
uint32_t bytesRead;
|
||||||
@ -870,7 +870,7 @@ nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*rLength += bytesRead;
|
*aReadLength += bytesRead;
|
||||||
PodCopy(data, buf.get(), bytesRead);
|
PodCopy(data, buf.get(), bytesRead);
|
||||||
|
|
||||||
remaining -= bytesRead;
|
remaining -= bytesRead;
|
||||||
|
@ -77,7 +77,8 @@ nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile)
|
|||||||
|
|
||||||
if (dirService) {
|
if (dirService) {
|
||||||
nsCOMPtr <nsIFile> aLocalFile;
|
nsCOMPtr <nsIFile> aLocalFile;
|
||||||
dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(aLocalFile));
|
dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile),
|
||||||
|
getter_AddRefs(aLocalFile));
|
||||||
if (aLocalFile) {
|
if (aLocalFile) {
|
||||||
*aFile = aLocalFile;
|
*aFile = aLocalFile;
|
||||||
NS_ADDREF(*aFile);
|
NS_ADDREF(*aFile);
|
||||||
@ -86,8 +87,9 @@ nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsLocalFile* localFile = new nsLocalFile;
|
nsLocalFile* localFile = new nsLocalFile;
|
||||||
if (localFile == nullptr)
|
if (!localFile) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
NS_ADDREF(localFile);
|
NS_ADDREF(localFile);
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
@ -474,7 +476,8 @@ nsDirectoryService::RegisterCategoryProviders()
|
|||||||
strings->GetNext(entry);
|
strings->GetNext(entry);
|
||||||
|
|
||||||
nsXPIDLCString contractID;
|
nsXPIDLCString contractID;
|
||||||
catman->GetCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY, entry.get(), getter_Copies(contractID));
|
catman->GetCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY, entry.get(),
|
||||||
|
getter_Copies(contractID));
|
||||||
|
|
||||||
if (contractID) {
|
if (contractID) {
|
||||||
nsCOMPtr<nsIDirectoryServiceProvider> provider = do_GetService(contractID.get());
|
nsCOMPtr<nsIDirectoryServiceProvider> provider = do_GetService(contractID.get());
|
||||||
|
@ -289,7 +289,8 @@ nsLinebreakConverter::ConvertLineBreaks(const char* aSrc,
|
|||||||
|
|
||||||
char* resultString;
|
char* resultString;
|
||||||
if (aSrcBreaks == eLinebreakAny) {
|
if (aSrcBreaks == eLinebreakAny) {
|
||||||
resultString = ConvertUnknownBreaks(aSrc, sourceLen, GetLinebreakString(aDestBreaks));
|
resultString = ConvertUnknownBreaks(aSrc, sourceLen,
|
||||||
|
GetLinebreakString(aDestBreaks));
|
||||||
} else
|
} else
|
||||||
resultString = ConvertBreaks(aSrc, sourceLen,
|
resultString = ConvertBreaks(aSrc, sourceLen,
|
||||||
GetLinebreakString(aSrcBreaks),
|
GetLinebreakString(aSrcBreaks),
|
||||||
@ -376,7 +377,8 @@ nsLinebreakConverter::ConvertUnicharLineBreaks(const char16_t* aSrc,
|
|||||||
|
|
||||||
char16_t* resultString;
|
char16_t* resultString;
|
||||||
if (aSrcBreaks == eLinebreakAny) {
|
if (aSrcBreaks == eLinebreakAny) {
|
||||||
resultString = ConvertUnknownBreaks(aSrc, bufLen, GetLinebreakString(aDestBreaks));
|
resultString = ConvertUnknownBreaks(aSrc, bufLen,
|
||||||
|
GetLinebreakString(aDestBreaks));
|
||||||
} else
|
} else
|
||||||
resultString = ConvertBreaks(aSrc, bufLen, GetLinebreakString(aSrcBreaks),
|
resultString = ConvertBreaks(aSrc, bufLen, GetLinebreakString(aSrcBreaks),
|
||||||
GetLinebreakString(aDestBreaks));
|
GetLinebreakString(aDestBreaks));
|
||||||
|
@ -241,9 +241,11 @@ nsLocalFile::GetRelativeDescriptor(nsIFile* aFromFile, nsACString& aResult)
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (nodeIndex = 0; nodeIndex < thisNodeCnt && nodeIndex < fromNodeCnt; ++nodeIndex) {
|
for (nodeIndex = 0; nodeIndex < thisNodeCnt &&
|
||||||
|
nodeIndex < fromNodeCnt; ++nodeIndex) {
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
if (_wcsicmp(char16ptr_t(thisNodes[nodeIndex]), char16ptr_t(fromNodes[nodeIndex]))) {
|
if (_wcsicmp(char16ptr_t(thisNodes[nodeIndex]),
|
||||||
|
char16ptr_t(fromNodes[nodeIndex]))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -129,7 +129,8 @@ nsDirEnumeratorUnix::~nsDirEnumeratorUnix()
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsDirEnumeratorUnix, nsISimpleEnumerator, nsIDirectoryEnumerator)
|
NS_IMPL_ISUPPORTS(nsDirEnumeratorUnix, nsISimpleEnumerator,
|
||||||
|
nsIDirectoryEnumerator)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDirEnumeratorUnix::Init(nsLocalFile* aParent,
|
nsDirEnumeratorUnix::Init(nsLocalFile* aParent,
|
||||||
@ -394,7 +395,7 @@ nsLocalFile::OpenNSPRFileDesc(int32_t aFlags, int32_t aMode,
|
|||||||
PRFileDesc** aResult)
|
PRFileDesc** aResult)
|
||||||
{
|
{
|
||||||
*aResult = PR_Open(mPath.get(), aFlags, aMode);
|
*aResult = PR_Open(mPath.get(), aFlags, aMode);
|
||||||
if (! *aResult) {
|
if (!*aResult) {
|
||||||
return NS_ErrorAccordingToNSPR();
|
return NS_ErrorAccordingToNSPR();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,7 +416,7 @@ NS_IMETHODIMP
|
|||||||
nsLocalFile::OpenANSIFileDesc(const char* aMode, FILE** aResult)
|
nsLocalFile::OpenANSIFileDesc(const char* aMode, FILE** aResult)
|
||||||
{
|
{
|
||||||
*aResult = fopen(mPath.get(), aMode);
|
*aResult = fopen(mPath.get(), aMode);
|
||||||
if (! *aResult) {
|
if (!*aResult) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1407,7 +1408,8 @@ nsLocalFile::GetDiskSpaceAvailable(int64_t* aDiskSpaceAvailable)
|
|||||||
&& dq.dqb_bhardlimit) {
|
&& dq.dqb_bhardlimit) {
|
||||||
int64_t QuotaSpaceAvailable = 0;
|
int64_t QuotaSpaceAvailable = 0;
|
||||||
if (dq.dqb_bhardlimit > dq.dqb_curspace) {
|
if (dq.dqb_bhardlimit > dq.dqb_curspace) {
|
||||||
QuotaSpaceAvailable = int64_t(fs_buf.F_BSIZE * (dq.dqb_bhardlimit - dq.dqb_curspace));
|
QuotaSpaceAvailable =
|
||||||
|
int64_t(fs_buf.F_BSIZE * (dq.dqb_bhardlimit - dq.dqb_curspace));
|
||||||
}
|
}
|
||||||
if (QuotaSpaceAvailable < *aDiskSpaceAvailable) {
|
if (QuotaSpaceAvailable < *aDiskSpaceAvailable) {
|
||||||
*aDiskSpaceAvailable = QuotaSpaceAvailable;
|
*aDiskSpaceAvailable = QuotaSpaceAvailable;
|
||||||
@ -1949,7 +1951,8 @@ nsLocalFile::SetPersistentDescriptor(const nsACString& aPersistentDescriptor)
|
|||||||
|
|
||||||
Boolean changed;
|
Boolean changed;
|
||||||
FSRef resolvedFSRef;
|
FSRef resolvedFSRef;
|
||||||
OSErr err = ::FSResolveAlias(nullptr, (AliasHandle)newHandle, &resolvedFSRef, &changed);
|
OSErr err = ::FSResolveAlias(nullptr, (AliasHandle)newHandle, &resolvedFSRef,
|
||||||
|
&changed);
|
||||||
|
|
||||||
rv = MacErrorMapper(err);
|
rv = MacErrorMapper(err);
|
||||||
DisposeHandle(newHandle);
|
DisposeHandle(newHandle);
|
||||||
@ -1968,7 +1971,8 @@ nsLocalFile::Reveal()
|
|||||||
{
|
{
|
||||||
#ifdef MOZ_WIDGET_GTK
|
#ifdef MOZ_WIDGET_GTK
|
||||||
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
|
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
|
||||||
nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
|
nsCOMPtr<nsIGnomeVFSService> gnomevfs =
|
||||||
|
do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
|
||||||
if (!giovfs && !gnomevfs) {
|
if (!giovfs && !gnomevfs) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
@ -1986,7 +1990,8 @@ nsLocalFile::Reveal()
|
|||||||
{
|
{
|
||||||
return gnomevfs->ShowURIForInput(mPath);
|
return gnomevfs->ShowURIForInput(mPath);
|
||||||
}
|
}
|
||||||
} else if (giovfs && NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) {
|
} else if (giovfs &&
|
||||||
|
NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
} else {
|
} else {
|
||||||
nsCOMPtr<nsIFile> parentDir;
|
nsCOMPtr<nsIFile> parentDir;
|
||||||
@ -2022,7 +2027,8 @@ nsLocalFile::Launch()
|
|||||||
{
|
{
|
||||||
#ifdef MOZ_WIDGET_GTK
|
#ifdef MOZ_WIDGET_GTK
|
||||||
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
|
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
|
||||||
nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
|
nsCOMPtr<nsIGnomeVFSService> gnomevfs =
|
||||||
|
do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
|
||||||
if (giovfs) {
|
if (giovfs) {
|
||||||
return giovfs->ShowURIForInput(mPath);
|
return giovfs->ShowURIForInput(mPath);
|
||||||
} else if (gnomevfs) {
|
} else if (gnomevfs) {
|
||||||
@ -2403,7 +2409,8 @@ nsLocalFile::GetFSSpec(FSSpec* aResult)
|
|||||||
FSRef fsRef;
|
FSRef fsRef;
|
||||||
nsresult rv = GetFSRef(&fsRef);
|
nsresult rv = GetFSRef(&fsRef);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNone, nullptr, nullptr, aResult, nullptr);
|
OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNone, nullptr, nullptr,
|
||||||
|
aResult, nullptr);
|
||||||
return MacErrorMapper(err);
|
return MacErrorMapper(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2430,7 +2437,8 @@ nsLocalFile::GetFileSizeWithResFork(int64_t* aFileSizeWithResFork)
|
|||||||
return MacErrorMapper(err);
|
return MacErrorMapper(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
*aFileSizeWithResFork = catalogInfo.dataLogicalSize + catalogInfo.rsrcLogicalSize;
|
*aFileSizeWithResFork =
|
||||||
|
catalogInfo.dataLogicalSize + catalogInfo.rsrcLogicalSize;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,10 +409,10 @@ ShortcutResolver::SetShortcut(bool aUpdateExisting,
|
|||||||
|
|
||||||
// Since we reuse our IPersistFile, we have to clear out any values that
|
// Since we reuse our IPersistFile, we have to clear out any values that
|
||||||
// may be left over from previous calls to SetShortcut.
|
// may be left over from previous calls to SetShortcut.
|
||||||
if (FAILED(mShellLink->SetWorkingDirectory(L""))
|
if (FAILED(mShellLink->SetWorkingDirectory(L"")) ||
|
||||||
|| FAILED(mShellLink->SetArguments(L""))
|
FAILED(mShellLink->SetArguments(L"")) ||
|
||||||
|| FAILED(mShellLink->SetDescription(L""))
|
FAILED(mShellLink->SetDescription(L"")) ||
|
||||||
|| FAILED(mShellLink->SetIconLocation(L"", 0))) {
|
FAILED(mShellLink->SetIconLocation(L"", 0))) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -569,7 +569,8 @@ IsShortcutPath(const nsAString& aPath)
|
|||||||
// workaround last beyond the switch, |PRFilePrivate| and |_MDFileDesc|
|
// workaround last beyond the switch, |PRFilePrivate| and |_MDFileDesc|
|
||||||
// need to be changed to match the definitions for WinNT.
|
// need to be changed to match the definitions for WinNT.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
_PR_TRI_TRUE = 1,
|
_PR_TRI_TRUE = 1,
|
||||||
_PR_TRI_FALSE = 0,
|
_PR_TRI_FALSE = 0,
|
||||||
_PR_TRI_UNKNOWN = -1
|
_PR_TRI_UNKNOWN = -1
|
||||||
@ -1006,8 +1007,9 @@ nsLocalFile::nsLocalFileConstructor(nsISupports* aOuter, const nsIID& aIID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsLocalFile* inst = new nsLocalFile();
|
nsLocalFile* inst = new nsLocalFile();
|
||||||
if (inst == nullptr)
|
if (!inst) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult rv = inst->QueryInterface(aIID, aInstancePtr);
|
nsresult rv = inst->QueryInterface(aIID, aInstancePtr);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
@ -1417,9 +1419,9 @@ nsLocalFile::AppendInternal(const nsAFlatString& aNode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check the relative path for validity
|
// check the relative path for validity
|
||||||
if (aNode.First() == L'\\' // can't start with an '\'
|
if (aNode.First() == L'\\' || // can't start with an '\'
|
||||||
|| aNode.FindChar(L'/') != kNotFound // can't contain /
|
aNode.FindChar(L'/') != kNotFound || // can't contain /
|
||||||
|| aNode.EqualsASCII("..")) { // can't be ..
|
aNode.EqualsASCII("..")) { // can't be ..
|
||||||
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
|
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1696,8 +1698,8 @@ nsLocalFile::GetVersionInfoField(const char* aField, nsAString& aResult)
|
|||||||
|
|
||||||
rv = NS_ERROR_FAILURE;
|
rv = NS_ERROR_FAILURE;
|
||||||
|
|
||||||
const WCHAR* path = mFollowSymlinks ? mResolvedPath.get()
|
const WCHAR* path =
|
||||||
: mWorkingPath.get();
|
mFollowSymlinks ? mResolvedPath.get() : mWorkingPath.get();
|
||||||
|
|
||||||
DWORD dummy;
|
DWORD dummy;
|
||||||
DWORD size = ::GetFileVersionInfoSizeW(path, &dummy);
|
DWORD size = ::GetFileVersionInfoSizeW(path, &dummy);
|
||||||
@ -1720,8 +1722,7 @@ nsLocalFile::GetVersionInfoField(const char* aField, nsAString& aResult)
|
|||||||
wchar_t subBlock[MAX_PATH];
|
wchar_t subBlock[MAX_PATH];
|
||||||
_snwprintf(subBlock, MAX_PATH,
|
_snwprintf(subBlock, MAX_PATH,
|
||||||
L"\\StringFileInfo\\%04x%04x\\%s",
|
L"\\StringFileInfo\\%04x%04x\\%s",
|
||||||
(i == 0 ? translate[0].wLanguage
|
(i == 0 ? translate[0].wLanguage : ::GetUserDefaultLangID()),
|
||||||
: ::GetUserDefaultLangID()),
|
|
||||||
translate[0].wCodePage,
|
translate[0].wCodePage,
|
||||||
NS_ConvertASCIItoUTF16(
|
NS_ConvertASCIItoUTF16(
|
||||||
nsDependentCString(aField)).get());
|
nsDependentCString(aField)).get());
|
||||||
@ -1995,8 +1996,9 @@ nsLocalFile::CopyMove(nsIFile* aParentDir, const nsAString& aNewName,
|
|||||||
newParentDir->GetTarget(target);
|
newParentDir->GetTarget(target);
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> realDest = new nsLocalFile();
|
nsCOMPtr<nsIFile> realDest = new nsLocalFile();
|
||||||
if (realDest == nullptr)
|
if (!realDest) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
rv = realDest->InitWithPath(target);
|
rv = realDest->InitWithPath(target);
|
||||||
|
|
||||||
@ -2268,7 +2270,7 @@ nsLocalFile::Load(PRLibrary** aResult)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isFile) {
|
if (!isFile) {
|
||||||
return NS_ERROR_FILE_IS_DIRECTORY;
|
return NS_ERROR_FILE_IS_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2755,7 +2757,8 @@ nsLocalFile::GetParent(nsIFile** aParent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> localFile;
|
nsCOMPtr<nsIFile> localFile;
|
||||||
nsresult rv = NS_NewLocalFile(parentPath, mFollowSymlinks, getter_AddRefs(localFile));
|
nsresult rv = NS_NewLocalFile(parentPath, mFollowSymlinks,
|
||||||
|
getter_AddRefs(localFile));
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -3340,8 +3343,9 @@ nsresult
|
|||||||
NS_NewLocalFile(const nsAString& aPath, bool aFollowLinks, nsIFile** aResult)
|
NS_NewLocalFile(const nsAString& aPath, bool aFollowLinks, nsIFile** aResult)
|
||||||
{
|
{
|
||||||
nsLocalFile* file = new nsLocalFile();
|
nsLocalFile* file = new nsLocalFile();
|
||||||
if (file == nullptr)
|
if (!file) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
NS_ADDREF(file);
|
NS_ADDREF(file);
|
||||||
|
|
||||||
file->SetFollowLinks(aFollowLinks);
|
file->SetFollowLinks(aFollowLinks);
|
||||||
|
@ -150,7 +150,8 @@ SeekableStreamAtBeginning(nsIInputStream* aStream)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMultiplexInputStream::AppendStream(nsIInputStream* aStream)
|
nsMultiplexInputStream::AppendStream(nsIInputStream* aStream)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(SeekableStreamAtBeginning(aStream), "Appended stream not at beginning.");
|
NS_ASSERTION(SeekableStreamAtBeginning(aStream),
|
||||||
|
"Appended stream not at beginning.");
|
||||||
return mStreams.AppendElement(aStream) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
return mStreams.AppendElement(aStream) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +159,8 @@ nsMultiplexInputStream::AppendStream(nsIInputStream* aStream)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMultiplexInputStream::InsertStream(nsIInputStream* aStream, uint32_t aIndex)
|
nsMultiplexInputStream::InsertStream(nsIInputStream* aStream, uint32_t aIndex)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(SeekableStreamAtBeginning(aStream), "Inserted stream not at beginning.");
|
NS_ASSERTION(SeekableStreamAtBeginning(aStream),
|
||||||
|
"Inserted stream not at beginning.");
|
||||||
mStreams.InsertElementAt(aIndex, aStream);
|
mStreams.InsertElementAt(aIndex, aStream);
|
||||||
if (mCurrentStream > aIndex ||
|
if (mCurrentStream > aIndex ||
|
||||||
(mCurrentStream == aIndex && mStartedReadingCurrent)) {
|
(mCurrentStream == aIndex && mStartedReadingCurrent)) {
|
||||||
|
@ -56,7 +56,8 @@ nsScriptableInputStream::Read(uint32_t aCount, char** aResult)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bug716556 - Ensure count+1 doesn't overflow
|
// bug716556 - Ensure count+1 doesn't overflow
|
||||||
uint32_t count = XPCOM_MIN((uint32_t)XPCOM_MIN<uint64_t>(count64, aCount), UINT32_MAX - 1);
|
uint32_t count =
|
||||||
|
XPCOM_MIN((uint32_t)XPCOM_MIN<uint64_t>(count64, aCount), UINT32_MAX - 1);
|
||||||
buffer = (char*)moz_malloc(count + 1); // make room for '\0'
|
buffer = (char*)moz_malloc(count + 1); // make room for '\0'
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
@ -479,7 +479,7 @@ nsStorageInputStream::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
|
|||||||
|
|
||||||
count = XPCOM_MIN(availableInSegment, remainingCapacity);
|
count = XPCOM_MIN(availableInSegment, remainingCapacity);
|
||||||
rv = aWriter(this, aClosure, cur + mReadCursor, aCount - remainingCapacity,
|
rv = aWriter(this, aClosure, cur + mReadCursor, aCount - remainingCapacity,
|
||||||
count, &bytesConsumed);
|
count, &bytesConsumed);
|
||||||
if (NS_FAILED(rv) || (bytesConsumed == 0)) {
|
if (NS_FAILED(rv) || (bytesConsumed == 0)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -609,7 +609,8 @@ nsStorageInputStream::Serialize(InputStreamParams& aParams, FileDescriptorArray&
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsStorageInputStream::Deserialize(const InputStreamParams& aParams, const FileDescriptorArray&)
|
nsStorageInputStream::Deserialize(const InputStreamParams& aParams,
|
||||||
|
const FileDescriptorArray&)
|
||||||
{
|
{
|
||||||
NS_NOTREACHED("We should never attempt to deserialize a storage input stream.");
|
NS_NOTREACHED("We should never attempt to deserialize a storage input stream.");
|
||||||
return false;
|
return false;
|
||||||
|
@ -616,8 +616,7 @@ NS_AsyncCopy(nsIInputStream* aSource,
|
|||||||
aCloseSource, aCloseSink, aProgressCallback);
|
aCloseSource, aCloseSink, aProgressCallback);
|
||||||
|
|
||||||
if (aCopierCtx) {
|
if (aCopierCtx) {
|
||||||
*aCopierCtx = static_cast<nsISupports*>(
|
*aCopierCtx = static_cast<nsISupports*>(static_cast<nsIRunnable*>(copier));
|
||||||
static_cast<nsIRunnable*>(copier));
|
|
||||||
NS_ADDREF(*aCopierCtx);
|
NS_ADDREF(*aCopierCtx);
|
||||||
}
|
}
|
||||||
NS_RELEASE(copier);
|
NS_RELEASE(copier);
|
||||||
@ -630,15 +629,16 @@ NS_AsyncCopy(nsIInputStream* aSource,
|
|||||||
nsresult
|
nsresult
|
||||||
NS_CancelAsyncCopy(nsISupports* aCopierCtx, nsresult aReason)
|
NS_CancelAsyncCopy(nsISupports* aCopierCtx, nsresult aReason)
|
||||||
{
|
{
|
||||||
nsAStreamCopier* copier = static_cast<nsAStreamCopier*>(
|
nsAStreamCopier* copier =
|
||||||
static_cast<nsIRunnable *>(aCopierCtx));
|
static_cast<nsAStreamCopier*>(static_cast<nsIRunnable *>(aCopierCtx));
|
||||||
return copier->Cancel(aReason);
|
return copier->Cancel(aReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_ConsumeStream(nsIInputStream* aStream, uint32_t aMaxCount, nsACString& aResult)
|
NS_ConsumeStream(nsIInputStream* aStream, uint32_t aMaxCount,
|
||||||
|
nsACString& aResult)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
aResult.Truncate();
|
aResult.Truncate();
|
||||||
@ -712,8 +712,7 @@ NS_InputStreamIsBuffered(nsIInputStream* aStream)
|
|||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
nsresult rv = aStream->ReadSegments(TestInputStream,
|
nsresult rv = aStream->ReadSegments(TestInputStream, &result, 1, &n);
|
||||||
&result, 1, &n);
|
|
||||||
return result || NS_SUCCEEDED(rv);
|
return result || NS_SUCCEEDED(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,8 @@ nsStringInputStream::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
|
|||||||
if (aCount > maxCount) {
|
if (aCount > maxCount) {
|
||||||
aCount = maxCount;
|
aCount = maxCount;
|
||||||
}
|
}
|
||||||
nsresult rv = aWriter(this, aClosure, mData.BeginReading() + mOffset, 0, aCount, aResult);
|
nsresult rv = aWriter(this, aClosure, mData.BeginReading() + mOffset, 0,
|
||||||
|
aCount, aResult);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
NS_ASSERTION(*aResult <= aCount,
|
NS_ASSERTION(*aResult <= aCount,
|
||||||
"writer should not write more than we asked it to write");
|
"writer should not write more than we asked it to write");
|
||||||
@ -344,7 +345,7 @@ NS_NewByteInputStream(nsIInputStream** aStreamResult,
|
|||||||
NS_PRECONDITION(aStreamResult, "null out ptr");
|
NS_PRECONDITION(aStreamResult, "null out ptr");
|
||||||
|
|
||||||
nsStringInputStream* stream = new nsStringInputStream();
|
nsStringInputStream* stream = new nsStringInputStream();
|
||||||
if (! stream) {
|
if (!stream) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +391,7 @@ NS_NewCStringInputStream(nsIInputStream** aStreamResult,
|
|||||||
NS_PRECONDITION(aStreamResult, "null out ptr");
|
NS_PRECONDITION(aStreamResult, "null out ptr");
|
||||||
|
|
||||||
nsStringInputStream* stream = new nsStringInputStream();
|
nsStringInputStream* stream = new nsStringInputStream();
|
||||||
if (! stream) {
|
if (!stream) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +405,8 @@ NS_NewCStringInputStream(nsIInputStream** aStreamResult,
|
|||||||
|
|
||||||
// factory method for constructing a nsStringInputStream object
|
// factory method for constructing a nsStringInputStream object
|
||||||
nsresult
|
nsresult
|
||||||
nsStringInputStreamConstructor(nsISupports* aOuter, REFNSIID aIID, void** aResult)
|
nsStringInputStreamConstructor(nsISupports* aOuter, REFNSIID aIID,
|
||||||
|
void** aResult)
|
||||||
{
|
{
|
||||||
*aResult = nullptr;
|
*aResult = nullptr;
|
||||||
|
|
||||||
|
@ -422,8 +422,9 @@ nsSimpleUnicharStreamFactory::CreateInstanceFromString(const nsAString& aString,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSimpleUnicharStreamFactory::CreateInstanceFromUTF8Stream(nsIInputStream* aStreamToWrap,
|
nsSimpleUnicharStreamFactory::CreateInstanceFromUTF8Stream(
|
||||||
nsIUnicharInputStream** aResult)
|
nsIInputStream* aStreamToWrap,
|
||||||
|
nsIUnicharInputStream** aResult)
|
||||||
{
|
{
|
||||||
*aResult = nullptr;
|
*aResult = nullptr;
|
||||||
|
|
||||||
|
@ -87,7 +87,8 @@ LossyAppendUTF16toASCII(const nsAString& aSource, nsACString& aDest)
|
|||||||
// right now, this won't work on multi-fragment destinations
|
// right now, this won't work on multi-fragment destinations
|
||||||
LossyConvertEncoding16to8 converter(dest.get());
|
LossyConvertEncoding16to8 converter(dest.get());
|
||||||
|
|
||||||
copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
|
copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
|
||||||
|
converter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -103,7 +104,8 @@ AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest,
|
|||||||
const mozilla::fallible_t&)
|
const mozilla::fallible_t&)
|
||||||
{
|
{
|
||||||
uint32_t old_dest_length = aDest.Length();
|
uint32_t old_dest_length = aDest.Length();
|
||||||
if (!aDest.SetLength(old_dest_length + aSource.Length(), mozilla::fallible_t())) {
|
if (!aDest.SetLength(old_dest_length + aSource.Length(),
|
||||||
|
mozilla::fallible_t())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +119,8 @@ AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest,
|
|||||||
// right now, this won't work on multi-fragment destinations
|
// right now, this won't work on multi-fragment destinations
|
||||||
LossyConvertEncoding8to16 converter(dest.get());
|
LossyConvertEncoding8to16 converter(dest.get());
|
||||||
|
|
||||||
copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
|
copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
|
||||||
|
converter);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +257,8 @@ inline
|
|||||||
ToCharT*
|
ToCharT*
|
||||||
AllocateStringCopy(const FromStringT& aSource, ToCharT*)
|
AllocateStringCopy(const FromStringT& aSource, ToCharT*)
|
||||||
{
|
{
|
||||||
return static_cast<ToCharT*>(nsMemory::Alloc((aSource.Length() + 1) * sizeof(ToCharT)));
|
return static_cast<ToCharT*>(nsMemory::Alloc(
|
||||||
|
(aSource.Length() + 1) * sizeof(ToCharT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -311,7 +315,8 @@ ToNewCString(const nsACString& aSource)
|
|||||||
|
|
||||||
nsACString::const_iterator fromBegin, fromEnd;
|
nsACString::const_iterator fromBegin, fromEnd;
|
||||||
char* toBegin = result;
|
char* toBegin = result;
|
||||||
*copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char(0);
|
*copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
|
||||||
|
toBegin) = char(0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +332,8 @@ ToNewUnicode(const nsAString& aSource)
|
|||||||
|
|
||||||
nsAString::const_iterator fromBegin, fromEnd;
|
nsAString::const_iterator fromBegin, fromEnd;
|
||||||
char16_t* toBegin = result;
|
char16_t* toBegin = result;
|
||||||
*copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char16_t(0);
|
*copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
|
||||||
|
toBegin) = char16_t(0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,7 +649,8 @@ ToUpperCase(const nsACString& aSource, nsACString& aDest)
|
|||||||
aDest.SetLength(aSource.Length());
|
aDest.SetLength(aSource.Length());
|
||||||
|
|
||||||
CopyToUpperCase converter(aDest.BeginWriting(toBegin));
|
CopyToUpperCase converter(aDest.BeginWriting(toBegin));
|
||||||
copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
|
copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
|
||||||
|
converter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -723,7 +730,8 @@ ToLowerCase(const nsACString& aSource, nsACString& aDest)
|
|||||||
aDest.SetLength(aSource.Length());
|
aDest.SetLength(aSource.Length());
|
||||||
|
|
||||||
CopyToLowerCase converter(aDest.BeginWriting(toBegin));
|
CopyToLowerCase converter(aDest.BeginWriting(toBegin));
|
||||||
copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
|
copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
|
||||||
|
converter);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -23,7 +23,7 @@ nsTAdoptingString_CharT::operator=(const self_type& str)
|
|||||||
SetDataFlags(F_TERMINATED | F_OWNED);
|
SetDataFlags(F_TERMINATED | F_OWNED);
|
||||||
|
|
||||||
// Make str forget the buffer we just took ownership of.
|
// Make str forget the buffer we just took ownership of.
|
||||||
new(mutable_str) self_type();
|
new (mutable_str) self_type();
|
||||||
} else {
|
} else {
|
||||||
Assign(str);
|
Assign(str);
|
||||||
|
|
||||||
|
@ -76,17 +76,18 @@ nsTSubstringTuple_CharT::WriteTo(char_type* aBuf, uint32_t aBufLen) const
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsTSubstringTuple_CharT::IsDependentOn(const char_type* start, const char_type* end) const
|
nsTSubstringTuple_CharT::IsDependentOn(const char_type* aStart,
|
||||||
|
const char_type* aEnd) const
|
||||||
{
|
{
|
||||||
// we start with the right-most fragment since it is faster to check.
|
// we aStart with the right-most fragment since it is faster to check.
|
||||||
|
|
||||||
if (TO_SUBSTRING(mFragB).IsDependentOn(start, end)) {
|
if (TO_SUBSTRING(mFragB).IsDependentOn(aStart, aEnd)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mHead) {
|
if (mHead) {
|
||||||
return mHead->IsDependentOn(start, end);
|
return mHead->IsDependentOn(aStart, aEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TO_SUBSTRING(mFragA).IsDependentOn(start, end);
|
return TO_SUBSTRING(mFragA).IsDependentOn(aStart, aEnd);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@ LossyConvertEncoding16to8::write_sse2(const char16_t* aSource,
|
|||||||
// Align source to a 16-byte boundary.
|
// Align source to a 16-byte boundary.
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
uint32_t alignLen =
|
uint32_t alignLen =
|
||||||
XPCOM_MIN<uint32_t>(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(char16_t));
|
XPCOM_MIN<uint32_t>(aSourceLength,
|
||||||
|
uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(char16_t));
|
||||||
for (; i < alignLen; ++i) {
|
for (; i < alignLen; ++i) {
|
||||||
dest[i] = static_cast<unsigned char>(aSource[i]);
|
dest[i] = static_cast<unsigned char>(aSource[i]);
|
||||||
}
|
}
|
||||||
@ -71,7 +72,8 @@ LossyConvertEncoding8to16::write_sse2(const char* aSource,
|
|||||||
// to wait for a load to complete, but you can keep on moving after issuing a
|
// to wait for a load to complete, but you can keep on moving after issuing a
|
||||||
// store.
|
// store.
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
uint32_t alignLen = XPCOM_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf));
|
uint32_t alignLen = XPCOM_MIN(aSourceLength,
|
||||||
|
uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf));
|
||||||
for (; i < alignLen; ++i) {
|
for (; i < alignLen; ++i) {
|
||||||
dest[i] = static_cast<unsigned char>(aSource[i]);
|
dest[i] = static_cast<unsigned char>(aSource[i]);
|
||||||
}
|
}
|
||||||
|
@ -187,8 +187,7 @@ void ThreadStackHelper::GetThreadStackBase()
|
|||||||
|
|
||||||
#elif defined(XP_WIN)
|
#elif defined(XP_WIN)
|
||||||
::MEMORY_BASIC_INFORMATION meminfo = {};
|
::MEMORY_BASIC_INFORMATION meminfo = {};
|
||||||
NS_ENSURE_TRUE_VOID(::VirtualQuery(
|
NS_ENSURE_TRUE_VOID(::VirtualQuery(&meminfo, &meminfo, sizeof(meminfo)));
|
||||||
&meminfo, &meminfo, sizeof(meminfo)));
|
|
||||||
#ifdef MOZ_THREADSTACKHELPER_STACK_GROWS_DOWN
|
#ifdef MOZ_THREADSTACKHELPER_STACK_GROWS_DOWN
|
||||||
mThreadStackBase = intptr_t(meminfo.BaseAddress) + meminfo.RegionSize;
|
mThreadStackBase = intptr_t(meminfo.BaseAddress) + meminfo.RegionSize;
|
||||||
#else
|
#else
|
||||||
@ -206,7 +205,7 @@ void ThreadStackHelper::GetThreadStackBase()
|
|||||||
#endif // MOZ_THREADSTACKHELPER_NATIVE
|
#endif // MOZ_THREADSTACKHELPER_NATIVE
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
template <typename T>
|
template<typename T>
|
||||||
class ScopedSetPtr
|
class ScopedSetPtr
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -278,7 +277,8 @@ ThreadStackHelper::GetStack(Stack& aStack)
|
|||||||
|
|
||||||
#ifdef MOZ_THREADSTACKHELPER_NATIVE
|
#ifdef MOZ_THREADSTACKHELPER_NATIVE
|
||||||
class ThreadStackHelper::CodeModulesProvider
|
class ThreadStackHelper::CodeModulesProvider
|
||||||
: public google_breakpad::CodeModules {
|
: public google_breakpad::CodeModules
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
typedef google_breakpad::CodeModule CodeModule;
|
typedef google_breakpad::CodeModule CodeModule;
|
||||||
typedef google_breakpad::BasicCodeModule BasicCodeModule;
|
typedef google_breakpad::BasicCodeModule BasicCodeModule;
|
||||||
@ -290,24 +290,29 @@ public:
|
|||||||
CodeModulesProvider() : mLibs(SharedLibraryInfo::GetInfoForSelf()) {}
|
CodeModulesProvider() : mLibs(SharedLibraryInfo::GetInfoForSelf()) {}
|
||||||
virtual ~CodeModulesProvider() {}
|
virtual ~CodeModulesProvider() {}
|
||||||
|
|
||||||
virtual unsigned int module_count() const {
|
virtual unsigned int module_count() const
|
||||||
|
{
|
||||||
return mLibs.GetSize();
|
return mLibs.GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const CodeModule* GetModuleForAddress(uint64_t address) const {
|
virtual const CodeModule* GetModuleForAddress(uint64_t aAddress) const
|
||||||
|
{
|
||||||
MOZ_CRASH("Not implemented");
|
MOZ_CRASH("Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const CodeModule* GetMainModule() const {
|
virtual const CodeModule* GetMainModule() const
|
||||||
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const CodeModule* GetModuleAtSequence(unsigned int sequence) const {
|
virtual const CodeModule* GetModuleAtSequence(unsigned int aSequence) const
|
||||||
|
{
|
||||||
MOZ_CRASH("Not implemented");
|
MOZ_CRASH("Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const CodeModule* GetModuleAtIndex(unsigned int index) const {
|
virtual const CodeModule* GetModuleAtIndex(unsigned int aIndex) const
|
||||||
const SharedLibrary& lib = mLibs.GetEntry(index);
|
{
|
||||||
|
const SharedLibrary& lib = mLibs.GetEntry(aIndex);
|
||||||
mModule = new BasicCodeModule(lib.GetStart(), lib.GetEnd() - lib.GetStart(),
|
mModule = new BasicCodeModule(lib.GetStart(), lib.GetEnd() - lib.GetStart(),
|
||||||
lib.GetName(), lib.GetBreakpadId(),
|
lib.GetName(), lib.GetBreakpadId(),
|
||||||
lib.GetName(), lib.GetBreakpadId(), "");
|
lib.GetName(), lib.GetBreakpadId(), "");
|
||||||
@ -315,13 +320,15 @@ public:
|
|||||||
return mModule;
|
return mModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const CodeModules* Copy() const {
|
virtual const CodeModules* Copy() const
|
||||||
|
{
|
||||||
MOZ_CRASH("Not implemented");
|
MOZ_CRASH("Not implemented");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThreadStackHelper::ThreadContext
|
class ThreadStackHelper::ThreadContext
|
||||||
: public google_breakpad::MemoryRegion {
|
: public google_breakpad::MemoryRegion
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
#if defined(MOZ_THREADSTACKHELPER_X86)
|
#if defined(MOZ_THREADSTACKHELPER_X86)
|
||||||
typedef MDRawContextX86 Context;
|
typedef MDRawContextX86 Context;
|
||||||
@ -347,39 +354,41 @@ public:
|
|||||||
// End of stack area
|
// End of stack area
|
||||||
const void* mStackEnd;
|
const void* mStackEnd;
|
||||||
|
|
||||||
ThreadContext() : mValid(false)
|
ThreadContext()
|
||||||
, mStackBase(0)
|
: mValid(false)
|
||||||
, mStackSize(0)
|
, mStackBase(0)
|
||||||
, mStackEnd(nullptr) {}
|
, mStackSize(0)
|
||||||
|
, mStackEnd(nullptr) {}
|
||||||
virtual ~ThreadContext() {}
|
virtual ~ThreadContext() {}
|
||||||
|
|
||||||
virtual uint64_t GetBase() const {
|
virtual uint64_t GetBase() const { return uint64_t(mStackBase); }
|
||||||
return uint64_t(mStackBase);
|
virtual uint32_t GetSize() const { return mStackSize; }
|
||||||
|
virtual bool GetMemoryAtAddress(uint64_t aAddress, uint8_t* aValue) const
|
||||||
|
{
|
||||||
|
return GetMemoryAtAddressInternal(aAddress, aValue);
|
||||||
}
|
}
|
||||||
virtual uint32_t GetSize() const {
|
virtual bool GetMemoryAtAddress(uint64_t aAddress, uint16_t* aValue) const
|
||||||
return mStackSize;
|
{
|
||||||
|
return GetMemoryAtAddressInternal(aAddress, aValue);
|
||||||
}
|
}
|
||||||
virtual bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const {
|
virtual bool GetMemoryAtAddress(uint64_t aAddress, uint32_t* aValue) const
|
||||||
return GetMemoryAtAddressInternal(address, value);
|
{
|
||||||
|
return GetMemoryAtAddressInternal(aAddress, aValue);
|
||||||
}
|
}
|
||||||
virtual bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const {
|
virtual bool GetMemoryAtAddress(uint64_t aAddress, uint64_t* aValue) const
|
||||||
return GetMemoryAtAddressInternal(address, value);
|
{
|
||||||
}
|
return GetMemoryAtAddressInternal(aAddress, aValue);
|
||||||
virtual bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const {
|
|
||||||
return GetMemoryAtAddressInternal(address, value);
|
|
||||||
}
|
|
||||||
virtual bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const {
|
|
||||||
return GetMemoryAtAddressInternal(address, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
template<typename T>
|
||||||
bool GetMemoryAtAddressInternal(uint64_t address, T* value) const {
|
bool GetMemoryAtAddressInternal(uint64_t aAddress, T* aValue) const
|
||||||
const intptr_t offset = intptr_t(address) - intptr_t(GetBase());
|
{
|
||||||
|
const intptr_t offset = intptr_t(aAddress) - intptr_t(GetBase());
|
||||||
if (offset < 0 || uintptr_t(offset) > (GetSize() - sizeof(T))) {
|
if (offset < 0 || uintptr_t(offset) > (GetSize() - sizeof(T))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*value = *reinterpret_cast<const T*>(&mStack[offset]);
|
*aValue = *reinterpret_cast<const T*>(&mStack[offset]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -85,10 +85,10 @@ nsEventQueue::GetEvent(bool aMayWait, nsIRunnable** aResult)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsEventQueue::PutEvent(nsIRunnable *runnable)
|
nsEventQueue::PutEvent(nsIRunnable* aRunnable)
|
||||||
{
|
{
|
||||||
// Avoid calling AddRef+Release while holding our monitor.
|
// Avoid calling AddRef+Release while holding our monitor.
|
||||||
nsRefPtr<nsIRunnable> event(runnable);
|
nsRefPtr<nsIRunnable> event(aRunnable);
|
||||||
|
|
||||||
if (ChaosMode::isActive()) {
|
if (ChaosMode::isActive()) {
|
||||||
// With probability 0.5, yield so other threads have a chance to
|
// With probability 0.5, yield so other threads have a chance to
|
||||||
@ -108,7 +108,7 @@ nsEventQueue::PutEvent(nsIRunnable *runnable)
|
|||||||
mOffsetHead = 0;
|
mOffsetHead = 0;
|
||||||
mOffsetTail = 0;
|
mOffsetTail = 0;
|
||||||
} else if (mOffsetTail == EVENTS_PER_PAGE) {
|
} else if (mOffsetTail == EVENTS_PER_PAGE) {
|
||||||
Page *page = NewPage();
|
Page* page = NewPage();
|
||||||
MOZ_ASSERT(page);
|
MOZ_ASSERT(page);
|
||||||
|
|
||||||
mTail->mNext = page;
|
mTail->mNext = page;
|
||||||
@ -118,6 +118,6 @@ nsEventQueue::PutEvent(nsIRunnable *runnable)
|
|||||||
|
|
||||||
event.swap(mTail->mEvents[mOffsetTail]);
|
event.swap(mTail->mEvents[mOffsetTail]);
|
||||||
++mOffsetTail;
|
++mOffsetTail;
|
||||||
LOG(("EVENTQ(%p): notify\n", this));
|
LOG(("EVENTQ(%p): notify\n", this));
|
||||||
mon.NotifyAll();
|
mon.NotifyAll();
|
||||||
}
|
}
|
||||||
|
@ -214,9 +214,7 @@ public:
|
|||||||
|
|
||||||
// This method needs to be public to support older compilers (xlC_r on AIX).
|
// This method needs to be public to support older compilers (xlC_r on AIX).
|
||||||
// It should be called directly as this class type is reference counted.
|
// It should be called directly as this class type is reference counted.
|
||||||
virtual ~nsThreadStartupEvent()
|
virtual ~nsThreadStartupEvent() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NS_IMETHOD Run()
|
NS_IMETHOD Run()
|
||||||
@ -688,7 +686,8 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
|||||||
LOG(("THRD(%p) ProcessNextEvent [%u %u]\n", this, aMayWait, mRunningEvent));
|
LOG(("THRD(%p) ProcessNextEvent [%u %u]\n", this, aMayWait, mRunningEvent));
|
||||||
|
|
||||||
// If we're on the main thread, we shouldn't be dispatching CPOWs.
|
// If we're on the main thread, we shouldn't be dispatching CPOWs.
|
||||||
MOZ_RELEASE_ASSERT(mIsMainThread != MAIN_THREAD || !ipc::ProcessingUrgentMessages());
|
MOZ_RELEASE_ASSERT(mIsMainThread != MAIN_THREAD ||
|
||||||
|
!ipc::ProcessingUrgentMessages());
|
||||||
|
|
||||||
if (NS_WARN_IF(PR_GetCurrentThread() != mThread)) {
|
if (NS_WARN_IF(PR_GetCurrentThread() != mThread)) {
|
||||||
return NS_ERROR_NOT_SAME_THREAD;
|
return NS_ERROR_NOT_SAME_THREAD;
|
||||||
|
@ -557,7 +557,7 @@ nsTimerImpl::Fire()
|
|||||||
}
|
}
|
||||||
|
|
||||||
PROFILER_LABEL("Timer", "Fire",
|
PROFILER_LABEL("Timer", "Fire",
|
||||||
js::ProfileEntry::Category::OTHER);
|
js::ProfileEntry::Category::OTHER);
|
||||||
|
|
||||||
#ifdef MOZ_TASK_TRACER
|
#ifdef MOZ_TASK_TRACER
|
||||||
mozilla::tasktracer::AutoRunFakeTracedTask runTracedTask(mTracedTask);
|
mozilla::tasktracer::AutoRunFakeTracedTask runTracedTask(mTracedTask);
|
||||||
|
Loading…
Reference in New Issue
Block a user