Backed out changeset bda8efa53512

This commit is contained in:
Chris Jones 2010-03-18 21:01:10 -05:00
Родитель 6b2339095c
Коммит 297b367c19
6 изменённых файлов: 51 добавлений и 19 удалений

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

@ -48,9 +48,6 @@
#include "nsContentUtils.h"
#include "nsCRT.h"
#ifdef MOZ_CRASHREPORTER
# include "nsExceptionHandler.h"
#endif
#include "nsNPAPIPlugin.h"
using base::KillProcess;
@ -261,10 +258,8 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why)
{
switch (why) {
case AbnormalShutdown: {
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsIFile> dump;
if (CrashReporter::TakeMinidumpForChild(ChildProcessHandle(),
getter_AddRefs(dump))) {
if (TakeMinidump(getter_AddRefs(dump))) {
WriteExtraDataForMinidump(dump);
if (NS_SUCCEEDED(dump->GetLeafName(mDumpID))) {
mDumpID.Replace(mDumpID.Length() - 4, 4,
@ -274,7 +269,6 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why)
else {
NS_WARNING("[PluginModuleParent::ActorDestroy] abnormal shutdown without minidump!");
}
#endif
mShutdown = true;
// Defer the PluginCrashed method so that we don't re-enter

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

@ -2944,6 +2944,39 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
if p.usesShmem():
self.cls.addstmts(self.makeShmemIface())
if ptype.isToplevel() and self.side is 'parent':
## bool GetMinidump(nsIFile** dump)
self.cls.addstmt(Label.PROTECTED)
otherpidvar = ExprVar('OtherSidePID')
otherpid = MethodDefn(MethodDecl(
otherpidvar.name, params=[ ],
ret=Type('base::ProcessId'),
const=1))
otherpid.addstmts([
StmtReturn(ExprCall(
ExprVar('base::GetProcId'),
args=[ p.otherProcessVar() ])),
])
dumpvar = ExprVar('aDump')
getdump = MethodDefn(MethodDecl(
'TakeMinidump',
params=[ Decl(Type('nsIFile', ptrptr=1), dumpvar.name) ],
ret=Type.BOOL,
const=1))
getdump.addstmts([
CppDirective('ifdef', 'MOZ_CRASHREPORTER'),
StmtReturn(ExprCall(
ExprVar('XRE_TakeMinidumpForChild'),
args=[ ExprCall(otherpidvar), dumpvar ])),
CppDirective('else'),
StmtReturn(ExprLiteral.FALSE),
CppDirective('endif')
])
self.cls.addstmts([ otherpid, Whitespace.NL,
getdump, Whitespace.NL ])
if (ptype.isToplevel() and self.side is 'parent'
and ptype.talksRpc()):
# offer BlockChild() and UnblockChild().

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

@ -1418,19 +1418,17 @@ SetRemoteExceptionHandler()
bool
TakeMinidumpForChild(ProcessHandle childPid, nsIFile** dump)
TakeMinidumpForChild(PRUint32 childPid, nsIFile** dump)
{
if (!GetEnabled())
return false;
PRUint32 key = PRUint32(childPid);
MutexAutoLock lock(*dumpMapLock);
nsCOMPtr<nsIFile> d;
bool found = pidToMinidump->Get(key, getter_AddRefs(d));
bool found = pidToMinidump->Get(childPid, getter_AddRefs(d));
if (found)
pidToMinidump->Remove(key);
pidToMinidump->Remove(childPid);
*dump = NULL;
d.swap(*dump);

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

@ -76,16 +76,10 @@ nsresult SetSubmitReports(PRBool aSubmitReport);
#ifdef MOZ_IPC
// Out-of-process crash reporter API.
#if defined(XP_WIN32)
typedef HANDLE ProcessHandle;
#else
typedef int ProcessHandle;
#endif
// Return true iff a dump was found for |childPid|, and return the
// path in |dump|. The caller owns the last reference to |dump| if it
// is non-NULL.
bool TakeMinidumpForChild(ProcessHandle childPid, nsIFile** dump NS_OUTPARAM);
bool TakeMinidumpForChild(PRUint32 childPid, nsIFile** dump NS_OUTPARAM);
# if defined(XP_WIN32)
// Parent-side API for children

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

@ -251,6 +251,15 @@ GeckoProcessType sChildProcessType = GeckoProcessType_Default;
static MessageLoop* sIOMessageLoop;
#if defined(MOZ_CRASHREPORTER)
// FIXME/bug 539522: this out-of-place function is stuck here because
// IPDL wants access to this crashreporter interface, and
// crashreporter is built in such a way to make that awkward
PRBool
XRE_TakeMinidumpForChild(PRUint32 aChildPid, nsIFile** aDump)
{
return CrashReporter::TakeMinidumpForChild(aChildPid, aDump);
}
PRBool
XRE_SetRemoteExceptionHandler(const char* aPipe/*= 0*/)
{

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

@ -450,6 +450,10 @@ XRE_API(GeckoProcessType,
XRE_StringToChildProcessType, (const char* aProcessTypeString))
#if defined(MOZ_CRASHREPORTER)
// Used in the "master" parent process hosting the crash server
XRE_API(PRBool,
XRE_TakeMinidumpForChild, (PRUint32 aChildPid, nsIFile** aDump))
// Used in child processes.
XRE_API(PRBool,
XRE_SetRemoteExceptionHandler, (const char* aPipe))