mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1039579 - CrashReporterParent::NotifyCrashService must always be on the main thread, r=ted
This commit is contained in:
parent
fb8b8fe840
commit
b0015d28b5
@ -11,6 +11,8 @@
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#include "nsICrashService.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#endif
|
||||
|
||||
using namespace base;
|
||||
@ -114,6 +116,7 @@ CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
|
||||
type = NS_LITERAL_CSTRING("content");
|
||||
break;
|
||||
case GeckoProcessType_Plugin:
|
||||
case GeckoProcessType_GMPlugin:
|
||||
type = NS_LITERAL_CSTRING("plugin");
|
||||
break;
|
||||
default:
|
||||
@ -135,14 +138,30 @@ CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
|
||||
if (!ret)
|
||||
NS_WARNING("problem appending child data to .extra");
|
||||
|
||||
NotifyCrashService();
|
||||
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
|
||||
class NotifyOnMainThread : public nsRunnable
|
||||
{
|
||||
public:
|
||||
NotifyOnMainThread(CrashReporterParent* aCR)
|
||||
: mCR(aCR)
|
||||
{ }
|
||||
|
||||
NS_IMETHOD Run() {
|
||||
mCR->NotifyCrashService();
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
CrashReporterParent* mCR;
|
||||
};
|
||||
SyncRunnable::DispatchToThread(mainThread, new NotifyOnMainThread(this));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
CrashReporterParent::NotifyCrashService()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsCOMPtr<nsICrashService> crashService =
|
||||
do_GetService("@mozilla.org/crashservice;1");
|
||||
if (!crashService) {
|
||||
|
Loading…
Reference in New Issue
Block a user