Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
Back out bug 581341 due to too many intermittent failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm committed Jun 30, 2011
1 parent 08d70d1 commit a963070
Show file tree
Hide file tree
Showing 32 changed files with 196 additions and 634 deletions.
10 changes: 2 additions & 8 deletions dom/ipc/ContentChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,8 @@ ContentChild::Init(MessageLoop* aIOLoop,
Open(aChannel, aParentHandle, aIOLoop);
sSingleton = this;

CrashReporterChild::CreateCrashReporter(this);
#if defined(ANDROID) && defined(MOZ_CRASHREPORTER)
PCrashReporterChild* crashreporter = ManagedPCrashReporterChild()[0];
PCrashReporterChild* crashreporter = SendPCrashReporterConstructor();
InfallibleTArray<Mapping> mappings;
const struct mapping_info *info = getLibraryMapping();
while (info && info->name) {
Expand Down Expand Up @@ -364,14 +363,9 @@ ContentChild::DeallocPBrowser(PBrowserChild* iframe)
}

PCrashReporterChild*
ContentChild::AllocPCrashReporter(const NativeThreadId& tid,
const PRUint32& processType)
ContentChild::AllocPCrashReporter()
{
#ifdef MOZ_CRASHREPORTER
return new CrashReporterChild();
#else
return nsnull;
#endif
}

bool
Expand Down
7 changes: 2 additions & 5 deletions dom/ipc/ContentChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,8 @@ class ContentChild : public PContentChild
virtual PBrowserChild* AllocPBrowser(const PRUint32& aChromeFlags);
virtual bool DeallocPBrowser(PBrowserChild*);

virtual PCrashReporterChild*
AllocPCrashReporter(const NativeThreadId& id,
const PRUint32& processType);
virtual bool
DeallocPCrashReporter(PCrashReporterChild*);
virtual PCrashReporterChild* AllocPCrashReporter();
virtual bool DeallocPCrashReporter(PCrashReporterChild*);

virtual PMemoryReportRequestChild*
AllocPMemoryReportRequest();
Expand Down
40 changes: 21 additions & 19 deletions dom/ipc/ContentParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,27 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
props->SetPropertyAsBool(NS_LITERAL_STRING("abnormal"), PR_TRUE);

#ifdef MOZ_CRASHREPORTER
CrashReporterParent* crashReporter =
static_cast<CrashReporterParent*>(ManagedPCrashReporterParent()[0]);
nsAutoString dumpID;

crashReporter->GenerateCrashReport(this, NULL);
nsCOMPtr<nsILocalFile> crashDump;
TakeMinidump(getter_AddRefs(crashDump)) &&
CrashReporter::GetIDFromMinidump(crashDump, dumpID);

nsAutoString dumpID(crashReporter->ChildDumpID());
props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);

if (!dumpID.IsEmpty()) {
CrashReporter::AnnotationTable notes;
notes.Init();
notes.Put(NS_LITERAL_CSTRING("ProcessType"), NS_LITERAL_CSTRING("content"));

char startTime[32];
sprintf(startTime, "%lld", static_cast<PRInt64>(mProcessStartTime));
notes.Put(NS_LITERAL_CSTRING("StartupTime"),
nsDependentCString(startTime));

// TODO: Additional per-process annotations.
CrashReporter::AppendExtraData(dumpID, notes);
}
#endif

obs->NotifyObservers((nsIPropertyBag2*) props, "ipc:content-shutdown", nsnull);
Expand Down Expand Up @@ -327,19 +341,12 @@ ContentParent::DestroyTestShell(TestShellParent* aTestShell)
return PTestShellParent::Send__delete__(aTestShell);
}

TestShellParent*
ContentParent::GetTestShellSingleton()
{
if (!ManagedPTestShellParent().Length())
return nsnull;
return static_cast<TestShellParent*>(ManagedPTestShellParent()[0]);
}

ContentParent::ContentParent()
: mGeolocationWatchID(-1)
, mRunToCompletionDepth(0)
, mShouldCallUnblockChild(false)
, mIsAlive(true)
, mProcessStartTime(time(NULL))
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content);
Expand Down Expand Up @@ -672,14 +679,9 @@ ContentParent::DeallocPBrowser(PBrowserParent* frame)
}

PCrashReporterParent*
ContentParent::AllocPCrashReporter(const NativeThreadId& tid,
const PRUint32& processType)
ContentParent::AllocPCrashReporter()
{
#ifdef MOZ_CRASHREPORTER
return new CrashReporterParent(tid, processType);
#else
return nsnull;
#endif
return new CrashReporterParent();
}

bool
Expand Down
11 changes: 2 additions & 9 deletions dom/ipc/ContentParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ class ContentParent : public PContentParent

TestShellParent* CreateTestShell();
bool DestroyTestShell(TestShellParent* aTestShell);
TestShellParent* GetTestShellSingleton();

void ReportChildAlreadyBlocked();
bool RequestRunToCompletion();
Expand All @@ -103,10 +102,6 @@ class ContentParent : public PContentParent

void SetChildMemoryReporters(const InfallibleTArray<MemoryReport>& report);

GeckoChildProcessHost* Process() {
return mSubprocess;
}

protected:
void OnChannelConnected(int32 pid);
virtual void ActorDestroy(ActorDestroyReason why);
Expand All @@ -127,8 +122,7 @@ class ContentParent : public PContentParent
virtual PBrowserParent* AllocPBrowser(const PRUint32& aChromeFlags);
virtual bool DeallocPBrowser(PBrowserParent* frame);

virtual PCrashReporterParent* AllocPCrashReporter(const NativeThreadId& tid,
const PRUint32& processType);
virtual PCrashReporterParent* AllocPCrashReporter();
virtual bool DeallocPCrashReporter(PCrashReporterParent* crashreporter);

virtual PMemoryReportRequestParent* AllocPMemoryReportRequest();
Expand Down Expand Up @@ -234,8 +228,7 @@ class ContentParent : public PContentParent

bool mIsAlive;
nsCOMPtr<nsIPrefServiceInternal> mPrefService;

friend class CrashReporterParent;
time_t mProcessStartTime;
};

} // namespace dom
Expand Down
68 changes: 0 additions & 68 deletions dom/ipc/CrashReporterChild.cpp

This file was deleted.

23 changes: 3 additions & 20 deletions dom/ipc/CrashReporterChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/dom/PCrashReporterChild.h"
#include "mozilla/Util.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsXULAppAPI.h"
#endif

namespace mozilla {
namespace dom {
Expand All @@ -50,22 +45,10 @@ class CrashReporterChild :
{
public:
CrashReporterChild() {
MOZ_COUNT_CTOR(CrashReporterChild);
MOZ_COUNT_CTOR(CrashReporterChild);
}
~CrashReporterChild() {
MOZ_COUNT_DTOR(CrashReporterChild);
}

static PCrashReporterChild* GetCrashReporter();

template<class Toplevel>
static void CreateCrashReporter(Toplevel* actor) {
#ifdef MOZ_CRASHREPORTER
MOZ_ASSERT(actor->ManagedPCrashReporterChild().Length() == 0);
actor->SendPCrashReporterConstructor(
CrashReporter::CurrentThreadId(),
XRE_GetProcessType());
#endif
virtual ~CrashReporterChild() {
MOZ_COUNT_DTOR(CrashReporterChild);
}
};
} // namespace dom
Expand Down
83 changes: 4 additions & 79 deletions dom/ipc/CrashReporterParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
*
* ***** END LICENSE BLOCK ***** */
#include "CrashReporterParent.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif

#include "base/process_util.h"

#include <time.h>

using namespace base;

namespace mozilla {
Expand Down Expand Up @@ -72,91 +73,15 @@ CrashReporterParent::RecvAddLibraryMappings(const InfallibleTArray<Mapping>& map
return true;
}

bool
CrashReporterParent::RecvAnnotateCrashReport(const nsCString& key,
const nsCString& data)
{
#ifdef MOZ_CRASHREPORTER
mNotes.Put(key, data);
#endif
return true;
}

bool
CrashReporterParent::RecvAppendAppNotes(const nsCString& data)
{
mAppNotes.Append(data);
return true;
}

CrashReporterParent::CrashReporterParent(const NativeThreadId& tid,
const PRUint32& processType)
: mMainThread(tid)
, mStartTime(time(NULL))
, mProcessType(processType)
CrashReporterParent::CrashReporterParent()
{
MOZ_COUNT_CTOR(CrashReporterParent);

#ifdef MOZ_CRASHREPORTER
mNotes.Init(4);
#endif
}

CrashReporterParent::~CrashReporterParent()
{
MOZ_COUNT_DTOR(CrashReporterParent);
}

#ifdef MOZ_CRASHREPORTER
bool
CrashReporterParent::GenerateHangCrashReport(const AnnotationTable* processNotes)
{
if (mChildDumpID.IsEmpty())
return false;

GenerateChildData(processNotes);

CrashReporter::AnnotationTable notes;
if (!notes.Init(4))
return false;
notes.Put(nsDependentCString("HangID"), NS_ConvertUTF16toUTF8(mHangID));
if (!CrashReporter::AppendExtraData(mParentDumpID, notes))
NS_WARNING("problem appending parent data to .extra");
return true;
}

bool
CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
{
nsCAutoString type;
switch (mProcessType) {
case GeckoProcessType_Content:
type = NS_LITERAL_CSTRING("content");
break;
case GeckoProcessType_Plugin:
type = NS_LITERAL_CSTRING("plugin");
break;
default:
NS_ERROR("unknown process type");
break;
}
mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type);

char startTime[32];
sprintf(startTime, "%lld", static_cast<PRInt64>(mStartTime));
mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime));

if (!mAppNotes.IsEmpty())
mNotes.Put(NS_LITERAL_CSTRING("Notes"), mAppNotes);

bool ret = CrashReporter::AppendExtraData(mChildDumpID, mNotes);
if (ret && processNotes)
ret = CrashReporter::AppendExtraData(mChildDumpID, *processNotes);
if (!ret)
NS_WARNING("problem appending child data to .extra");
return ret;
}
#endif

} // namespace dom
} // namespace mozilla
Loading

0 comments on commit a963070

Please sign in to comment.