summaryrefslogtreecommitdiffstats
path: root/dom/ipc/ContentParent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/ipc/ContentParent.cpp')
-rw-r--r--dom/ipc/ContentParent.cpp86
1 files changed, 11 insertions, 75 deletions
diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
index ff40db8d7..286f1d851 100644
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -249,10 +249,6 @@ using namespace mozilla::system;
#include "mozilla/widget/AudioSession.h"
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsThread.h"
-#endif
-
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
#endif
@@ -273,9 +269,6 @@ using base::KillProcess;
using mozilla::ProfileGatherer;
#endif
-#ifdef MOZ_CRASHREPORTER
-using namespace CrashReporter;
-#endif
using namespace mozilla::dom::power;
using namespace mozilla::media;
using namespace mozilla::embedding;
@@ -1847,36 +1840,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
NS_LITERAL_CSTRING("content"), 1);
props->SetPropertyAsBool(NS_LITERAL_STRING("abnormal"), true);
-
-#ifdef MOZ_CRASHREPORTER
- // There's a window in which child processes can crash
- // after IPC is established, but before a crash reporter
- // is created.
- if (PCrashReporterParent* p = LoneManagedOrNullAsserts(ManagedPCrashReporterParent())) {
- CrashReporterParent* crashReporter =
- static_cast<CrashReporterParent*>(p);
-
- // If we're an app process, always stomp the latest URI
- // loaded in the child process with our manifest URL. We
- // would rather associate the crashes with apps than
- // random child windows loaded in them.
- //
- // XXX would be nice if we could get both ...
- if (!mAppManifestURL.IsEmpty()) {
- crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("URL"),
- NS_ConvertUTF16toUTF8(mAppManifestURL));
- }
-
- // if mCreatedPairedMinidumps is true, we've already generated
- // parent/child dumps for dekstop crashes.
- if (!mCreatedPairedMinidumps) {
- crashReporter->GenerateCrashReport(this, nullptr);
- }
-
- nsAutoString dumpID(crashReporter->ChildDumpID());
- props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);
- }
-#endif
}
nsAutoString cpId;
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
@@ -3090,33 +3053,6 @@ ContentParent::KillHard(const char* aReason)
mCalledKillHard = true;
mForceKillTimer = nullptr;
-#if defined(MOZ_CRASHREPORTER) && !defined(MOZ_B2G)
- // We're about to kill the child process associated with this content.
- // Something has gone wrong to get us here, so we generate a minidump
- // of the parent and child for submission to the crash server.
- if (PCrashReporterParent* p = LoneManagedOrNullAsserts(ManagedPCrashReporterParent())) {
- CrashReporterParent* crashReporter =
- static_cast<CrashReporterParent*>(p);
- // GeneratePairedMinidump creates two minidumps for us - the main
- // one is for the content process we're about to kill, and the other
- // one is for the main browser process. That second one is the extra
- // minidump tagging along, so we have to tell the crash reporter that
- // it exists and is being appended.
- nsAutoCString additionalDumps("browser");
- crashReporter->AnnotateCrashReport(
- NS_LITERAL_CSTRING("additional_minidumps"),
- additionalDumps);
- nsDependentCString reason(aReason);
- crashReporter->AnnotateCrashReport(
- NS_LITERAL_CSTRING("ipc_channel_error"),
- reason);
-
- // Generate the report and insert into the queue for submittal.
- mCreatedPairedMinidumps = crashReporter->GenerateCompleteMinidump(this);
-
- Telemetry::Accumulate(Telemetry::SUBPROCESS_KILL_HARD, reason, 1);
- }
-#endif
ProcessHandle otherProcessHandle;
if (!base::OpenProcessHandle(OtherPid(), &otherProcessHandle)) {
NS_ERROR("Failed to open child process when attempting kill.");
@@ -3168,11 +3104,7 @@ PCrashReporterParent*
ContentParent::AllocPCrashReporterParent(const NativeThreadId& tid,
const uint32_t& processType)
{
-#ifdef MOZ_CRASHREPORTER
- return new CrashReporterParent();
-#else
return nullptr;
-#endif
}
bool
@@ -3292,11 +3224,15 @@ PPrintingParent*
ContentParent::AllocPPrintingParent()
{
#ifdef NS_PRINTING
- MOZ_ASSERT(!mPrintingParent,
- "Only one PrintingParent should be created per process.");
+ MOZ_RELEASE_ASSERT(!mPrintingParent,
+ "Only one PrintingParent should be created per process.");
// Create the printing singleton for this process.
mPrintingParent = new PrintingParent();
+
+ // Take another reference for IPDL code.
+ mPrintingParent.get()->AddRef();
+
return mPrintingParent.get();
#else
MOZ_ASSERT_UNREACHABLE("Should never be created if no printing.");
@@ -3308,8 +3244,11 @@ bool
ContentParent::DeallocPPrintingParent(PPrintingParent* printing)
{
#ifdef NS_PRINTING
- MOZ_ASSERT(mPrintingParent == printing,
- "Only one PrintingParent should have been created per process.");
+ MOZ_RELEASE_ASSERT(mPrintingParent == printing,
+ "Only one PrintingParent should have been created per process.");
+
+ // Release reference taken for IPDL code.
+ static_cast<PrintingParent*>(printing)->Release();
mPrintingParent = nullptr;
#else
@@ -5001,9 +4940,6 @@ ContentParent::RecvNotifyPushSubscriptionModifiedObservers(const nsCString& aSco
bool
ContentParent::RecvNotifyLowMemory()
{
-#ifdef MOZ_CRASHREPORTER
- nsThread::SaveMemoryReportNearOOM(nsThread::ShouldSaveMemoryReport::kForceReport);
-#endif
return true;
}