Store the child process thread id in CrashReporterHost. (bug 1338281 part 2, r=billm)

This commit is contained in:
David Anderson 2017-02-15 14:44:29 -08:00
Родитель a1f1be7f91
Коммит da43dac799
10 изменённых файлов: 28 добавлений и 11 удалений

Просмотреть файл

@ -536,12 +536,13 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
}
mozilla::ipc::IPCResult
GMPParent::RecvInitCrashReporter(Shmem&& aShmem)
GMPParent::RecvInitCrashReporter(Shmem&& aShmem, const NativeThreadId& aThreadId)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(
GeckoProcessType_GMPlugin,
aShmem);
aShmem,
aThreadId);
#endif
return IPC_OK();
}

Просмотреть файл

@ -166,7 +166,7 @@ private:
#endif
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvInitCrashReporter(Shmem&& shmem) override;
mozilla::ipc::IPCResult RecvInitCrashReporter(Shmem&& shmem, const NativeThreadId& aThreadId) override;
mozilla::ipc::IPCResult RecvPGMPStorageConstructor(PGMPStorageParent* actor) override;
PGMPStorageParent* AllocPGMPStorageParent() override;

Просмотреть файл

@ -18,7 +18,7 @@ intr protocol PGMP
manages PGMPStorage;
parent:
async InitCrashReporter(Shmem shmem);
async InitCrashReporter(Shmem shmem, NativeThreadId threadId);
async PGMPTimer();
async PGMPStorage();

Просмотреть файл

@ -121,10 +121,13 @@ GPUChild::RecvGraphicsError(const nsCString& aError)
}
mozilla::ipc::IPCResult
GPUChild::RecvInitCrashReporter(Shmem&& aShmem)
GPUChild::RecvInitCrashReporter(Shmem&& aShmem, const NativeThreadId& aThreadId)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(GeckoProcessType_GPU, aShmem);
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(
GeckoProcessType_GPU,
aShmem,
aThreadId);
#endif
return IPC_OK();
}

Просмотреть файл

@ -42,7 +42,7 @@ public:
// PGPUChild overrides.
mozilla::ipc::IPCResult RecvInitComplete(const GPUDeviceData& aData) override;
mozilla::ipc::IPCResult RecvReportCheckerboard(const uint32_t& aSeverity, const nsCString& aLog) override;
mozilla::ipc::IPCResult RecvInitCrashReporter(Shmem&& shmem) override;
mozilla::ipc::IPCResult RecvInitCrashReporter(Shmem&& shmem, const NativeThreadId& aThreadId) override;
mozilla::ipc::IPCResult RecvAccumulateChildHistogram(InfallibleTArray<Accumulation>&& aAccumulations) override;
mozilla::ipc::IPCResult RecvAccumulateChildKeyedHistogram(InfallibleTArray<KeyedAccumulation>&& aAccumulations) override;
mozilla::ipc::IPCResult RecvUpdateChildScalars(InfallibleTArray<ScalarAction>&& aScalarActions) override;

Просмотреть файл

@ -15,6 +15,7 @@ include protocol PVideoDecoderManager;
using base::ProcessId from "base/process.h";
using mozilla::TimeDuration from "mozilla/TimeStamp.h";
using mozilla::CSSToLayoutDeviceScale from "Units.h";
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
using mozilla::gfx::IntSize from "mozilla/gfx/2D.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
using mozilla::Telemetry::Accumulation from "mozilla/TelemetryComms.h";
@ -102,7 +103,7 @@ child:
// Graphics errors, analogous to PContent::GraphicsError
async GraphicsError(nsCString aError);
async InitCrashReporter(Shmem shmem);
async InitCrashReporter(Shmem shmem, NativeThreadId threadId);
// Have a message be broadcasted to the UI process by the UI process
// observer service.

Просмотреть файл

@ -8,6 +8,7 @@
#include "CrashReporterMetadataShmem.h"
#include "nsISupportsImpl.h"
#ifdef MOZ_CRASHREPORTER
namespace mozilla {
namespace ipc {
@ -64,3 +65,4 @@ CrashReporterClient::GetSingleton()
} // namespace ipc
} // namespace mozilla
#endif // MOZ_CRASHREPORTER

Просмотреть файл

@ -12,6 +12,7 @@
#include "mozilla/Unused.h"
#include "mozilla/ipc/Shmem.h"
#ifdef MOZ_CRASHREPORTER
namespace mozilla {
namespace ipc {
@ -45,7 +46,9 @@ public:
}
InitSingletonWithShmem(shmem);
Unused << aToplevelProtocol->SendInitCrashReporter(shmem);
Unused << aToplevelProtocol->SendInitCrashReporter(
shmem,
CrashReporter::CurrentThreadId());
return true;
}
@ -71,6 +74,7 @@ private:
} // namespace ipc
} // namespace mozilla
#endif // MOZ_CRASHREPORTER
#endif // mozilla_ipc_CrashReporterClient_h

Просмотреть файл

@ -18,9 +18,12 @@
namespace mozilla {
namespace ipc {
CrashReporterHost::CrashReporterHost(GeckoProcessType aProcessType, const Shmem& aShmem)
CrashReporterHost::CrashReporterHost(GeckoProcessType aProcessType,
const Shmem& aShmem,
CrashReporter::ThreadId aThreadId)
: mProcessType(aProcessType),
mShmem(aShmem),
mThreadId(aThreadId),
mStartTime(::time(nullptr))
{
}

Просмотреть файл

@ -26,7 +26,9 @@ class CrashReporterHost
typedef CrashReporter::AnnotationTable AnnotationTable;
public:
CrashReporterHost(GeckoProcessType aProcessType, const Shmem& aShmem);
CrashReporterHost(GeckoProcessType aProcessType,
const Shmem& aShmem,
CrashReporter::ThreadId aThreadId);
#ifdef MOZ_CRASHREPORTER
bool GenerateCrashReport(base::ProcessId aPid,
@ -60,6 +62,7 @@ private:
private:
GeckoProcessType mProcessType;
Shmem mShmem;
CrashReporter::ThreadId mThreadId;
time_t mStartTime;
AnnotationTable mExtraNotes;
};