mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Backed out changeset 7fdcabdbb675 (bug 1024669) for failing mda, GTest and talos jobs. r=backout on a CLOSED TREE
This commit is contained in:
parent
7c5a88b206
commit
1828ea89ca
@ -29,7 +29,6 @@
|
||||
#include "HRTFDatabaseLoader.h"
|
||||
#include "HRTFDatabase.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -154,7 +153,7 @@ void HRTFDatabaseLoader::MainThreadRelease()
|
||||
static void databaseLoaderEntry(void* threadData)
|
||||
{
|
||||
AutoProfilerRegister registerThread("HRTFDatabaseLdr");
|
||||
NS_SetCurrentThreadName("HRTFDatabaseLdr");
|
||||
PR_SetCurrentThreadName("HRTFDatabaseLdr");
|
||||
|
||||
HRTFDatabaseLoader* loader = reinterpret_cast<HRTFDatabaseLoader*>(threadData);
|
||||
MOZ_ASSERT(loader);
|
||||
|
@ -341,7 +341,7 @@ void
|
||||
StorageDBThread::ThreadFunc(void* aArg)
|
||||
{
|
||||
AutoProfilerRegister registerThread("localStorage DB");
|
||||
NS_SetCurrentThreadName("localStorage DB");
|
||||
PR_SetCurrentThreadName("localStorage DB");
|
||||
mozilla::IOInterposer::RegisterCurrentThread();
|
||||
|
||||
StorageDBThread* thread = static_cast<StorageDBThread*>(aArg);
|
||||
|
@ -2792,7 +2792,7 @@ WorkerThreadPrimaryRunnable::Run()
|
||||
|
||||
char stackBaseGuess;
|
||||
|
||||
NS_SetCurrentThreadName("DOM Worker");
|
||||
PR_SetCurrentThreadName("DOM Worker");
|
||||
|
||||
nsAutoCString threadName;
|
||||
threadName.AssignLiteral("DOM Worker '");
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "mozJSComponentLoader.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#include "nsIMemoryInfoDumper.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
@ -1231,7 +1230,7 @@ static void
|
||||
WatchdogMain(void* arg)
|
||||
{
|
||||
mozilla::AutoProfilerRegister registerThread("JS Watchdog");
|
||||
NS_SetCurrentThreadName("JS Watchdog");
|
||||
PR_SetCurrentThreadName("JS Watchdog");
|
||||
|
||||
Watchdog* self = static_cast<Watchdog*>(arg);
|
||||
WatchdogManager* manager = self->Manager();
|
||||
|
@ -442,8 +442,7 @@ void CacheIOThread::ThreadFunc(void* aClosure)
|
||||
{
|
||||
// XXXmstange We'd like to register this thread with the profiler, but doing
|
||||
// so causes leaks, see bug 1323100.
|
||||
NS_SetCurrentThreadName("Cache2 I/O");
|
||||
|
||||
PR_SetCurrentThreadName("Cache2 I/O");
|
||||
mozilla::IOInterposer::RegisterCurrentThread();
|
||||
CacheIOThread* thread = static_cast<CacheIOThread*>(aClosure);
|
||||
thread->ThreadFunc();
|
||||
|
@ -1461,7 +1461,7 @@ nsHostResolver::ThreadFunc(void *arg)
|
||||
static nsThreadPoolNaming naming;
|
||||
nsCString name = naming.GetNextThreadName("DNS Resolver");
|
||||
|
||||
NS_SetCurrentThreadName(name.BeginReading());
|
||||
PR_SetCurrentThreadName(name.BeginReading());
|
||||
profiler_register_thread(name.BeginReading(), &stackTop);
|
||||
|
||||
#if defined(RES_RETRY_ON_FAILURE)
|
||||
|
@ -119,7 +119,7 @@ nsresult nsKeygenThread::ConsumeResult(
|
||||
static void nsKeygenThreadRunner(void *arg)
|
||||
{
|
||||
AutoProfilerRegister registerThread("Keygen");
|
||||
NS_SetCurrentThreadName("Keygen");
|
||||
PR_SetCurrentThreadName("Keygen");
|
||||
nsKeygenThread *self = static_cast<nsKeygenThread *>(arg);
|
||||
self->Run();
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "nsProtectedAuthThread.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "pk11func.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -23,7 +22,7 @@ NS_IMPL_ISUPPORTS(nsProtectedAuthThread, nsIProtectedAuthThread)
|
||||
static void nsProtectedAuthThreadRunner(void *arg)
|
||||
{
|
||||
AutoProfilerRegister registerThread("Protected Auth");
|
||||
NS_SetCurrentThreadName("Protected Auth");
|
||||
PR_SetCurrentThreadName("Protected Auth");
|
||||
|
||||
nsProtectedAuthThread *self = static_cast<nsProtectedAuthThread *>(arg);
|
||||
self->Run();
|
||||
|
@ -392,7 +392,7 @@ const SECMODModule* SmartCardMonitoringThread::GetModule()
|
||||
void SmartCardMonitoringThread::LaunchExecute(void* arg)
|
||||
{
|
||||
AutoProfilerRegister registerThread("SmartCard");
|
||||
NS_SetCurrentThreadName("SmartCard");
|
||||
PR_SetCurrentThreadName("SmartCard");
|
||||
|
||||
((SmartCardMonitoringThread*)arg)->Execute();
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ void
|
||||
StartupCache::ThreadedWrite(void *aClosure)
|
||||
{
|
||||
AutoProfilerRegister registerThread("StartupCache");
|
||||
NS_SetCurrentThreadName("StartupCache");
|
||||
PR_SetCurrentThreadName("StartupCache");
|
||||
mozilla::IOInterposer::RegisterCurrentThread();
|
||||
/*
|
||||
* It is safe to use the pointer passed in aClosure to reference the
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif
|
||||
#include "GeckoProfiler.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#include <windows.h>
|
||||
@ -126,7 +125,7 @@ struct Options {
|
||||
void
|
||||
RunWatchdog(void* arg)
|
||||
{
|
||||
NS_SetCurrentThreadName("Shutdown Hang Terminator");
|
||||
PR_SetCurrentThreadName("Shutdown Hang Terminator");
|
||||
|
||||
// Let's copy and deallocate options, that's one less leak to worry
|
||||
// about.
|
||||
@ -217,7 +216,7 @@ PRMonitor* gWriteReady = nullptr;
|
||||
void RunWriter(void* arg)
|
||||
{
|
||||
AutoProfilerRegister registerThread("Shutdown Statistics Writer");
|
||||
NS_SetCurrentThreadName("Shutdown Statistics Writer");
|
||||
PR_SetCurrentThreadName("Shutdown Statistics Writer");
|
||||
|
||||
MOZ_LSAN_INTENTIONALLY_LEAK_OBJECT(arg);
|
||||
// Shutdown will generally complete before we have a chance to
|
||||
|
@ -1,279 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ThreadAnnotation.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "nsExceptionHandler.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
using mozilla::StaticMutex;
|
||||
using mozilla::StaticMutexAutoLock;
|
||||
using mozilla::UniquePtr;
|
||||
|
||||
namespace CrashReporter {
|
||||
|
||||
namespace {
|
||||
|
||||
// Protects access to sInitialized and sThreadAnnotations.
|
||||
static StaticMutex sMutex;
|
||||
|
||||
class ThreadAnnotationSpan {
|
||||
public:
|
||||
ThreadAnnotationSpan(uint32_t aBegin, uint32_t aEnd)
|
||||
: mBegin(aBegin)
|
||||
, mEnd(aEnd)
|
||||
{
|
||||
MOZ_ASSERT(mBegin < mEnd);
|
||||
}
|
||||
|
||||
~ThreadAnnotationSpan();
|
||||
|
||||
class Comparator {
|
||||
public:
|
||||
bool Equals(const ThreadAnnotationSpan* const& a,
|
||||
const ThreadAnnotationSpan* const& b) const
|
||||
{
|
||||
return a->mBegin == b->mBegin;
|
||||
}
|
||||
|
||||
bool LessThan(const ThreadAnnotationSpan* const& a,
|
||||
const ThreadAnnotationSpan* const& b) const
|
||||
{
|
||||
return a->mBegin < b->mBegin;
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
// ~ThreadAnnotationSpan() does nontrivial thing. Make sure we don't
|
||||
// instantiate accidentally.
|
||||
ThreadAnnotationSpan(const ThreadAnnotationSpan& aOther) = delete;
|
||||
ThreadAnnotationSpan& operator=(const ThreadAnnotationSpan& aOther) = delete;
|
||||
|
||||
friend class ThreadAnnotationData;
|
||||
friend class Comparator;
|
||||
|
||||
uint32_t mBegin;
|
||||
uint32_t mEnd;
|
||||
};
|
||||
|
||||
// This class keeps the flat version of thread annotations for each thread.
|
||||
// When a thread calls CrashReporter::SetCurrentThreadName(), it adds
|
||||
// information about the calling thread (thread id and name) to this class.
|
||||
// When crash happens, the crash reporter gets flat representation and add to
|
||||
// the crash annotation file.
|
||||
class ThreadAnnotationData {
|
||||
public:
|
||||
ThreadAnnotationData()
|
||||
{}
|
||||
|
||||
~ThreadAnnotationData()
|
||||
{}
|
||||
|
||||
// Adds <pre> tid:"thread name",</pre> annotation to the current annotations.
|
||||
// Returns an instance of ThreadAnnotationSpan for cleanup on thread
|
||||
// termination.
|
||||
ThreadAnnotationSpan*
|
||||
AddThreadAnnotation(ThreadId aTid, const char* aThreadName)
|
||||
{
|
||||
if (!aTid || !aThreadName) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t oldLength = mData.Length();
|
||||
mData.AppendPrintf("%u:\"%s\",", aTid, aThreadName);
|
||||
uint32_t newLength = mData.Length();
|
||||
|
||||
ThreadAnnotationSpan* rv = new ThreadAnnotationSpan(oldLength, newLength);
|
||||
mDataSpans.AppendElement(rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Called on thread termination. Removes the thread annotation, represented as
|
||||
// ThreadAnnotationSpan, from the flat representation.
|
||||
void EraseThreadAnnotation(const ThreadAnnotationSpan& aThreadInfo)
|
||||
{
|
||||
uint32_t begin = aThreadInfo.mBegin;
|
||||
uint32_t end = aThreadInfo.mEnd;
|
||||
|
||||
if (!(begin < end &&
|
||||
end <= mData.Length())) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t cutLength = end - begin;
|
||||
mData.Cut(begin, cutLength);
|
||||
|
||||
// Adjust the ThreadAnnotationSpan affected by data shifting.
|
||||
size_t index = mDataSpans.BinaryIndexOf(&aThreadInfo,
|
||||
ThreadAnnotationSpan::Comparator());
|
||||
for (size_t i = index + 1; i < mDataSpans.Length(); i++) {
|
||||
ThreadAnnotationSpan* elem = mDataSpans[i];
|
||||
|
||||
MOZ_ASSERT(elem->mBegin >= cutLength);
|
||||
MOZ_ASSERT(elem->mEnd > cutLength);
|
||||
|
||||
elem->mBegin -= cutLength;
|
||||
elem->mEnd -= cutLength;
|
||||
}
|
||||
|
||||
// No loner tracking aThreadInfo.
|
||||
mDataSpans.RemoveElementAt(index);
|
||||
}
|
||||
|
||||
// Gets the flat representation of thread annotations.
|
||||
void GetData(const std::function<void(const char*)>& aCallback)
|
||||
{
|
||||
aCallback(mData.BeginReading());
|
||||
}
|
||||
private:
|
||||
// The flat representation of thread annotations.
|
||||
nsCString mData;
|
||||
|
||||
// This array tracks the created ThreadAnnotationSpan instances so that we
|
||||
// can make adjustments accordingly when we cut substrings from mData on
|
||||
// thread exit.
|
||||
nsTArray<ThreadAnnotationSpan*> mDataSpans;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class DeleteWithLock
|
||||
{
|
||||
public:
|
||||
constexpr DeleteWithLock() {}
|
||||
|
||||
void operator()(T* aPtr) const
|
||||
{
|
||||
static_assert(sizeof(T) > 0, "T must be complete");
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
|
||||
delete aPtr;
|
||||
}
|
||||
};
|
||||
|
||||
static bool sInitialized = false;
|
||||
static UniquePtr<ThreadAnnotationData> sThreadAnnotations;
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// Bionic libc on Android 4.0 doesn't support thread_local keyword. We need to
|
||||
// use pthread_key_create() to hook thread destruction callback.
|
||||
static pthread_key_t sTLSThreadInfoKey;
|
||||
void ThreadExitCallback(void* aUserData)
|
||||
{
|
||||
if (!aUserData) {
|
||||
return;
|
||||
}
|
||||
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
|
||||
ThreadAnnotationSpan* aThreadInfo =
|
||||
static_cast<ThreadAnnotationSpan*>(aUserData);
|
||||
pthread_setspecific(sTLSThreadInfoKey, nullptr);
|
||||
delete aThreadInfo;
|
||||
}
|
||||
#else
|
||||
// The C++ thread_local keyword provides a cross-platform access to TLS.
|
||||
// We use UniquePtr so that we may hook ThreadAnnotationSpan's destructor
|
||||
// on thread termination and remove the thread annotation from
|
||||
// sThreadAnnotations.
|
||||
static thread_local
|
||||
UniquePtr<ThreadAnnotationSpan, DeleteWithLock<ThreadAnnotationSpan>>
|
||||
sTLSThreadInfo;
|
||||
#endif
|
||||
|
||||
// This is called on thread termination.
|
||||
ThreadAnnotationSpan::~ThreadAnnotationSpan()
|
||||
{
|
||||
// Note that we can't lock the mutex here because this function may be called
|
||||
// from SetCurrentThreadName().
|
||||
sMutex.AssertCurrentThreadOwns();
|
||||
|
||||
if (sThreadAnnotations) {
|
||||
sThreadAnnotations->EraseThreadAnnotation(*this);
|
||||
}
|
||||
}
|
||||
|
||||
} // Anonymous namespace.
|
||||
|
||||
void InitThreadAnnotation()
|
||||
{
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
|
||||
if (sInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
int rv = pthread_key_create(&sTLSThreadInfoKey, &ThreadExitCallback);
|
||||
if (rv) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
sInitialized = true;
|
||||
|
||||
sThreadAnnotations = mozilla::MakeUnique<ThreadAnnotationData>();
|
||||
}
|
||||
|
||||
void SetCurrentThreadName(const char* aName)
|
||||
{
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
|
||||
if (!sInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Note that the TLS variable may already has a non-null value if we set the
|
||||
// thread name again. In this case, we need to destroy the old instance.
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// This destroys the old instance.
|
||||
UniquePtr<ThreadAnnotationSpan> oldThreadInfo{
|
||||
static_cast<ThreadAnnotationSpan*>(pthread_getspecific(sTLSThreadInfoKey))};
|
||||
|
||||
ThreadAnnotationSpan* threadInfo =
|
||||
sThreadAnnotations->AddThreadAnnotation(CurrentThreadId(),
|
||||
aName);
|
||||
pthread_setspecific(sTLSThreadInfoKey, threadInfo);
|
||||
#else
|
||||
// This destroys the old instance. Note that we need to release sTLSThreadInfo
|
||||
// to avoid deadlock with sMutex.
|
||||
UniquePtr<ThreadAnnotationSpan> oldThreadInfo{sTLSThreadInfo.release()};
|
||||
|
||||
sTLSThreadInfo.reset(
|
||||
sThreadAnnotations->AddThreadAnnotation(CurrentThreadId(), aName));
|
||||
#endif
|
||||
}
|
||||
|
||||
void GetFlatThreadAnnotation(const std::function<void(const char*)>& aCallback)
|
||||
{
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
|
||||
if (sThreadAnnotations) {
|
||||
sThreadAnnotations->GetData(aCallback);
|
||||
} else {
|
||||
// Maybe already shutdown: call aCallback with empty annotation data.
|
||||
aCallback("");
|
||||
}
|
||||
}
|
||||
|
||||
void ShutdownThreadAnnotation()
|
||||
{
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
|
||||
sInitialized = false;
|
||||
sThreadAnnotations.reset();
|
||||
}
|
||||
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef ThreadAnnotation_h
|
||||
#define ThreadAnnotation_h
|
||||
|
||||
#include <functional>
|
||||
|
||||
// Thread annotation interfaces for the crash reporter.
|
||||
namespace CrashReporter {
|
||||
|
||||
void InitThreadAnnotation();
|
||||
|
||||
void ShutdownThreadAnnotation();
|
||||
|
||||
void GetFlatThreadAnnotation(const std::function<void(const char*)>& aCallback);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -62,7 +62,6 @@ EXPORTS += [
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'nsExceptionHandler.cpp',
|
||||
'ThreadAnnotation.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'Darwin':
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "ThreadAnnotation.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "mozilla/TlsAllocationTracker.h"
|
||||
@ -1185,19 +1184,6 @@ bool MinidumpCallback(
|
||||
WriteLiteral(apiData, "ContainsMemoryReport=1\n");
|
||||
WriteLiteral(eventFile, "ContainsMemoryReport=1\n");
|
||||
}
|
||||
|
||||
std::function<void(const char*)> getThreadAnnotationCB =
|
||||
[&] (const char * aAnnotation) -> void {
|
||||
if (aAnnotation) {
|
||||
WriteLiteral(apiData, "ThreadIdNameMapping=");
|
||||
WriteLiteral(eventFile, "ThreadIdNameMapping=");
|
||||
WriteString(apiData, aAnnotation);
|
||||
WriteString(eventFile, aAnnotation);
|
||||
WriteLiteral(apiData, "\n");
|
||||
WriteLiteral(eventFile, "\n");
|
||||
}
|
||||
};
|
||||
GetFlatThreadAnnotation(getThreadAnnotationCB);
|
||||
}
|
||||
|
||||
if (!doReport) {
|
||||
@ -1427,16 +1413,6 @@ PrepareChildExceptionTimeAnnotations()
|
||||
WriteAnnotation(apiData, "TlsAllocations", tlsAllocations);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::function<void(const char*)> getThreadAnnotationCB =
|
||||
[&] (const char * aAnnotation) -> void {
|
||||
if (aAnnotation) {
|
||||
WriteLiteral(apiData, "ThreadIdNameMapping=");
|
||||
WriteString(apiData, aAnnotation);
|
||||
WriteLiteral(apiData, "\n");
|
||||
}
|
||||
};
|
||||
GetFlatThreadAnnotation(getThreadAnnotationCB);
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
@ -1856,8 +1832,6 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
|
||||
|
||||
oldTerminateHandler = std::set_terminate(&TerminateHandler);
|
||||
|
||||
InitThreadAnnotation();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2228,8 +2202,6 @@ nsresult UnsetExceptionHandler()
|
||||
memoryReportPath = nullptr;
|
||||
}
|
||||
|
||||
ShutdownThreadAnnotation();
|
||||
|
||||
if (!gExceptionHandler)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
@ -3811,8 +3783,6 @@ SetRemoteExceptionHandler(const nsACString& crashPipe)
|
||||
|
||||
oldTerminateHandler = std::set_terminate(&TerminateHandler);
|
||||
|
||||
InitThreadAnnotation();
|
||||
|
||||
// we either do remote or nothing, no fallback to regular crash reporting
|
||||
return gExceptionHandler->IsOutOfProcess();
|
||||
}
|
||||
@ -3866,8 +3836,6 @@ SetRemoteExceptionHandler()
|
||||
|
||||
oldTerminateHandler = std::set_terminate(&TerminateHandler);
|
||||
|
||||
InitThreadAnnotation();
|
||||
|
||||
// we either do remote or nothing, no fallback to regular crash reporting
|
||||
return gExceptionHandler->IsOutOfProcess();
|
||||
}
|
||||
@ -3896,8 +3864,6 @@ SetRemoteExceptionHandler(const nsACString& crashPipe)
|
||||
|
||||
oldTerminateHandler = std::set_terminate(&TerminateHandler);
|
||||
|
||||
InitThreadAnnotation();
|
||||
|
||||
// we either do remote or nothing, no fallback to regular crash reporting
|
||||
return gExceptionHandler->IsOutOfProcess();
|
||||
}
|
||||
@ -4216,7 +4182,6 @@ UnsetRemoteExceptionHandler()
|
||||
std::set_terminate(oldTerminateHandler);
|
||||
delete gExceptionHandler;
|
||||
gExceptionHandler = nullptr;
|
||||
ShutdownThreadAnnotation();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -279,10 +279,6 @@ void AddLibraryMapping(const char* library_name,
|
||||
size_t file_offset);
|
||||
|
||||
#endif
|
||||
|
||||
// Annotates the crash report with the name of the calling thread.
|
||||
void SetCurrentThreadName(const char* aName);
|
||||
|
||||
} // namespace CrashReporter
|
||||
|
||||
#endif /* nsExceptionHandler_h__ */
|
||||
|
@ -65,8 +65,8 @@
|
||||
#include <prthread.h>
|
||||
#include <prtime.h>
|
||||
|
||||
#include "nsThreadUtils.h"
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/Services.h"
|
||||
#endif
|
||||
@ -123,7 +123,7 @@ class EventLoopLagDispatcher : public Runnable
|
||||
void TracerThread(void *arg)
|
||||
{
|
||||
AutoProfilerRegister registerThread("Event Tracer");
|
||||
NS_SetCurrentThreadName("Event Tracer");
|
||||
PR_SetCurrentThreadName("Event Tracer");
|
||||
|
||||
TracerStartClosure* threadArgs = static_cast<TracerStartClosure*>(arg);
|
||||
|
||||
|
@ -290,16 +290,6 @@ XRE_SetRemoteExceptionHandler(const char* aPipe/*= 0*/)
|
||||
# error "OOP crash reporter unsupported on this platform"
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
XRE_UnsetRemoteExceptionHandler()
|
||||
{
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(OS_LINUX)
|
||||
return CrashReporter::UnsetRemoteExceptionHandler();
|
||||
#else
|
||||
# error "OOP crash reporter unsupported on this platform"
|
||||
#endif
|
||||
}
|
||||
#endif // if defined(MOZ_CRASHREPORTER)
|
||||
|
||||
#if defined(XP_WIN)
|
||||
@ -729,9 +719,6 @@ XRE_InitChildProcess(int aArgc,
|
||||
#endif
|
||||
|
||||
Telemetry::DestroyStatisticsRecorder();
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
(void) XRE_UnsetRemoteExceptionHandler();
|
||||
#endif
|
||||
return XRE_DeinitCommandLine();
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsObjCExceptions.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
@ -6607,7 +6606,7 @@ HandleEvent(CGEventTapProxy aProxy, CGEventType aType,
|
||||
{
|
||||
char aLocal;
|
||||
profiler_register_thread("APZC Event Thread", &aLocal);
|
||||
NS_SetCurrentThreadName("APZC Event Thread");
|
||||
PR_SetCurrentThreadName("APZC Event Thread");
|
||||
|
||||
mThread = [NSThread currentThread];
|
||||
ProcessSerialNumber currentProcess;
|
||||
|
@ -51,7 +51,7 @@ LSPAnnotationGatherer::Annotate()
|
||||
NS_IMETHODIMP
|
||||
LSPAnnotationGatherer::Run()
|
||||
{
|
||||
NS_SetCurrentThreadName("LSP Annotator");
|
||||
PR_SetCurrentThreadName("LSP Annotator");
|
||||
|
||||
mThread = NS_GetCurrentThread();
|
||||
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
NS_IMETHODIMP
|
||||
nsSoundPlayer::Run()
|
||||
{
|
||||
NS_SetCurrentThreadName("Play Sound");
|
||||
PR_SetCurrentThreadName("Play Sound");
|
||||
|
||||
NS_PRECONDITION(!mSoundName.IsEmpty(), "Sound name should not be empty");
|
||||
::PlaySoundW(mSoundName.get(), nullptr,
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
/**
|
||||
* This code uses NSPR stuff and STL containers because it must be detached
|
||||
@ -116,7 +115,7 @@ MainThreadIOLoggerImpl::Init()
|
||||
MainThreadIOLoggerImpl::sIOThreadFunc(void* aArg)
|
||||
{
|
||||
AutoProfilerRegister registerThread("MainThreadIOLogger");
|
||||
NS_SetCurrentThreadName("MainThreadIOLogger");
|
||||
PR_SetCurrentThreadName("MainThreadIOLogger");
|
||||
MainThreadIOLoggerImpl* obj = static_cast<MainThreadIOLoggerImpl*>(aArg);
|
||||
obj->IOThreadFunc();
|
||||
}
|
||||
|
@ -426,10 +426,6 @@ XRE_API(bool,
|
||||
// Used in child processes.
|
||||
XRE_API(bool,
|
||||
XRE_SetRemoteExceptionHandler, (const char* aPipe))
|
||||
|
||||
// Used in child processes.
|
||||
XRE_API(bool,
|
||||
XRE_UnsetRemoteExceptionHandler, ())
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
@ -57,7 +56,7 @@ private:
|
||||
static void MonitorThread(void* aData)
|
||||
{
|
||||
AutoProfilerRegister registerThread("BgHangMonitor");
|
||||
NS_SetCurrentThreadName("BgHangManager");
|
||||
PR_SetCurrentThreadName("BgHangManager");
|
||||
|
||||
/* We do not hold a reference to BackgroundHangManager here
|
||||
because the monitor thread only exists as long as the
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/StackWalk.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
@ -198,7 +197,7 @@ void
|
||||
ThreadMain(void*)
|
||||
{
|
||||
AutoProfilerRegister registerThread("Hang Monitor");
|
||||
NS_SetCurrentThreadName("Hang Monitor");
|
||||
PR_SetCurrentThreadName("Hang Monitor");
|
||||
|
||||
MonitorAutoLock lock(*gMonitor);
|
||||
|
||||
|
@ -404,7 +404,7 @@ struct IntervalComparator
|
||||
NS_IMETHODIMP
|
||||
TimerThread::Run()
|
||||
{
|
||||
NS_SetCurrentThreadName("Timer");
|
||||
PR_SetCurrentThreadName("Timer");
|
||||
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
|
||||
|
@ -241,7 +241,7 @@ nsProcess::Monitor(void* aArg)
|
||||
RefPtr<nsProcess> process = dont_AddRef(static_cast<nsProcess*>(aArg));
|
||||
|
||||
if (!process->mBlocking) {
|
||||
NS_SetCurrentThreadName("RunProcess");
|
||||
PR_SetCurrentThreadName("RunProcess");
|
||||
profiler_register_thread("RunProcess", &stackBaseGuess);
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ nsThread::ThreadFunc(void* aArg)
|
||||
SetupCurrentThreadForChaosMode();
|
||||
|
||||
if (!initData->name.IsEmpty()) {
|
||||
NS_SetCurrentThreadName(initData->name.BeginReading());
|
||||
PR_SetCurrentThreadName(initData->name.BeginReading());
|
||||
}
|
||||
|
||||
// Inform the ThreadManager
|
||||
|
@ -24,10 +24,6 @@
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#ifndef XPCOM_GLUE_AVOID_NSPR
|
||||
@ -393,15 +389,6 @@ NS_ProcessNextEvent(nsIThread* aThread, bool aMayWait)
|
||||
return NS_SUCCEEDED(aThread->ProcessNextEvent(aMayWait, &val)) && val;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
NS_SetCurrentThreadName(const char* aName)
|
||||
{
|
||||
PR_SetCurrentThreadName(aName);
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::SetCurrentThreadName(aName);
|
||||
#endif
|
||||
}
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
nsIThread*
|
||||
NS_GetCurrentThread()
|
||||
|
@ -32,8 +32,6 @@
|
||||
// These methods are alternatives to the methods on nsIThreadManager, provided
|
||||
// for convenience.
|
||||
|
||||
extern void NS_SetCurrentThreadName(const char* aName);
|
||||
|
||||
/**
|
||||
* Create a new thread, and optionally provide an initial event for the thread.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user