Stub out OOP crashreporter on OS X. b=555714 r=josh
authorChris Jones <jones.chris.g@gmail.com>
Tue, 30 Mar 2010 13:32:53 -0400
changeset 40006 cc5a27cb8ca3a2cd62e51ea43efaf91222405917
parent 40005 cc980f275250eeba0d19b5500d767c2b044b87cb
child 40007 3bbb3c3d3fa836fbf7464d7d601eaace49993107
push idunknown
push userunknown
push dateunknown
reviewersjosh
bugs555714
milestone1.9.3a4pre
Stub out OOP crashreporter on OS X. b=555714 r=josh
ipc/app/MozillaRuntimeMain.cpp
ipc/glue/GeckoChildProcessHost.cpp
toolkit/crashreporter/nsExceptionHandler.cpp
toolkit/xre/nsEmbedFunctions.cpp
--- a/ipc/app/MozillaRuntimeMain.cpp
+++ b/ipc/app/MozillaRuntimeMain.cpp
@@ -49,17 +49,17 @@
 #include <windows.h>
 // we want a wmain entry point
 #include "nsWindowsWMain.cpp"
 #endif
 
 int
 main(int argc, char* argv[])
 {
-#if defined(MOZ_CRASHREPORTER)
+#if defined(MOZ_CRASHREPORTER) && !defined(XP_MACOSX)
     if (argc < 2)
         return 1;
     const char* const crashReporterArg = argv[--argc];
 
 #  if defined(XP_WIN)
     // on windows, |crashReporterArg| is the named pipe on which the
     // server is listening for requests, or "-" if crash reporting is
     // disabled.
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -210,17 +210,17 @@ GeckoChildProcessHost::PerformAsyncLaunc
 
   childArgv.push_back(exePath.value());
 
   childArgv.insert(childArgv.end(), aExtraOpts.begin(), aExtraOpts.end());
 
   childArgv.push_back(pidstring);
   childArgv.push_back(childProcessType);
 
-#if defined(MOZ_CRASHREPORTER)
+#if defined(MOZ_CRASHREPORTER) && !defined(XP_MACOSX)
   int childCrashFd, childCrashRemapFd;
   if (!CrashReporter::CreateNotificationPipeForChild(
         &childCrashFd, &childCrashRemapFd))
     return false;
   if (0 <= childCrashFd) {
     mFileMap.push_back(std::pair<int,int>(childCrashFd, childCrashRemapFd));
     // "true" == crash reporting enabled
     childArgv.push_back("true");
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -92,18 +92,20 @@
 #include "nsIFileStreams.h"
 #include "nsInterfaceHashtable.h"
 #include "prprf.h"
 #include "nsIXULAppInfo.h"
 
 #if defined(MOZ_IPC)
 #include "nsIUUIDGenerator.h"
 
+#if !defined(XP_MACOSX)
 using google_breakpad::CrashGenerationServer;
 using google_breakpad::ClientInfo;
+#endif
 
 using mozilla::Mutex;
 using mozilla::MutexAutoLock;
 #endif
 
 namespace CrashReporter {
 
 #ifdef XP_WIN32
@@ -166,18 +168,20 @@ static const int kTimeSinceLastCrashPara
                                      sizeof(kTimeSinceLastCrashParameter)-1;
 
 // this holds additional data sent via the API
 static AnnotationTable* crashReporterAPIData_Hash;
 static nsCString* crashReporterAPIData = nsnull;
 static nsCString* notesField = nsnull;
 
 #if defined(MOZ_IPC)
+#if !defined(XP_MACOSX)
 // OOP crash reporting
 static CrashGenerationServer* crashServer; // chrome process has this
+#endif
 
 #  if defined(XP_WIN)
 // If crash reporting is disabled, we hand out this "null" pipe to the
 // child process and don't attempt to connect to a parent server.
 static const char kNullNotifyPipe[] = "-";
 static char* childCrashNotifyPipe;
 
 #  elif defined(XP_LINUX)
@@ -1392,16 +1396,17 @@ MoveToPending(nsIFile* dumpFile, nsIFile
   nsCOMPtr<nsILocalFile> pendingDir;
   if (!GetPendingDir(getter_AddRefs(pendingDir)))
     return false;
 
   return NS_SUCCEEDED(dumpFile->MoveTo(pendingDir, EmptyString())) &&
     NS_SUCCEEDED(extraFile->MoveTo(pendingDir, EmptyString()));
 }
 
+#if !defined(XP_MACOSX)
 static void
 OnChildProcessDumpRequested(void* aContext,
                             const ClientInfo* aClientInfo,
                             const xpstring* aFilePath)
 {
   nsCOMPtr<nsILocalFile> minidump;
   nsCOMPtr<nsILocalFile> extraFile;
 
@@ -1418,21 +1423,26 @@ OnChildProcessDumpRequested(void* aConte
 
   {
     PRUint32 pid = aClientInfo->pid();
 
     MutexAutoLock lock(*dumpMapLock);
     pidToMinidump->Put(pid, minidump);
   }
 }
+#endif  // XP_MACOSX
 
 static bool
 OOPInitialized()
 {
+#if defined(XP_MACOSX)
+  return true;
+#else
   return crashServer != NULL;
+#endif
 }
 
 static void
 OOPInit()
 {
   NS_ABORT_IF_FALSE(!OOPInitialized(),
                     "OOP crash reporter initialized more than once!");
   NS_ABORT_IF_FALSE(gExceptionHandler != NULL,
@@ -1462,35 +1472,39 @@ OOPInit()
   crashServer = new CrashGenerationServer(
     serverSocketFd,
     OnChildProcessDumpRequested, NULL,
     NULL, NULL,                 // we don't care about process exit here
     true,                       // automatically generate dumps
     &dumpPath);
 #endif
 
+#if !defined(XP_MACOSX)
   if (!crashServer->Start())
     NS_RUNTIMEABORT("can't start crash reporter server()");
+#endif
 
   pidToMinidump = new ChildMinidumpMap();
   pidToMinidump->Init();
 
   dumpMapLock = new Mutex("CrashReporter::dumpMapLock");
 }
 
 static void
 OOPDeinit()
 {
   if (!OOPInitialized()) {
     NS_WARNING("OOPDeinit() without successful OOPInit()");
     return;
   }
 
+#if !defined(XP_MACOSX)
   delete crashServer;
   crashServer = NULL;
+#endif
 
   delete dumpMapLock;
   dumpMapLock = NULL;
 
   delete pidToMinidump;
   pidToMinidump = NULL;
 
 #if defined(XP_WIN)
@@ -1533,17 +1547,17 @@ SetRemoteExceptionHandler(const nsACStri
                      NS_ConvertASCIItoUTF16(crashPipe).BeginReading(),
                      NULL);
 
   // we either do remote or nothing, no fallback to regular crash reporting
   return gExceptionHandler->IsOutOfProcess();
 }
 
 //--------------------------------------------------
-#elif defined(XP_UNIX)
+#elif defined(XP_LINUX)
 
 // Parent-side API for children
 bool
 CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd)
 {
   if (!GetEnabled()) {
     *childCrashFd = -1;
     *childCrashRemapFd = -1;
@@ -1636,16 +1650,20 @@ bool
 CreatePairedMinidumps(ProcessHandle childPid,
                       nsAString* pairGUID,
                       nsILocalFile** childDump,
                       nsILocalFile** parentDump)
 {
   if (!GetEnabled())
     return false;
 
+#if defined(XP_MACOSX)
+  return false;
+#else
+
   // create the UUID for the hang dump as a pair
   nsresult rv;
   nsCOMPtr<nsIUUIDGenerator> uuidgen =
     do_GetService("@mozilla.org/uuid-generator;1", &rv);
   NS_ENSURE_SUCCESS(rv, false);  
 
   nsID id;
   rv = uuidgen->GenerateUUIDInPlace(&id);
@@ -1693,21 +1711,24 @@ CreatePairedMinidumps(ProcessHandle chil
   }
 
   *childDump = NULL;
   *parentDump = NULL;
   childMinidump.swap(*childDump);
   parentMinidump.swap(*parentDump);
 
   return true;
+#endif  // XP_MACOSX
 }
 
+#if !defined(XP_MACOSX)
 bool
 UnsetRemoteExceptionHandler()
 {
   delete gExceptionHandler;
   gExceptionHandler = NULL;
   return true;
 }
+#endif  // XP_MACOSX
 
 #endif  // MOZ_IPC
 
 } // namespace CrashReporter
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -255,27 +255,29 @@ static MessageLoop* sIOMessageLoop;
 // IPDL wants access to this crashreporter interface, and
 // crashreporter is built in such a way to make that awkward
 PRBool
 XRE_TakeMinidumpForChild(PRUint32 aChildPid, nsILocalFile** aDump)
 {
   return CrashReporter::TakeMinidumpForChild(aChildPid, aDump);
 }
 
+#if !defined(XP_MACOSX)
 PRBool
 XRE_SetRemoteExceptionHandler(const char* aPipe/*= 0*/)
 {
 #if defined(XP_WIN)
   return CrashReporter::SetRemoteExceptionHandler(nsDependentCString(aPipe));
 #elif defined(OS_LINUX)
   return CrashReporter::SetRemoteExceptionHandler();
 #else
 #  error "OOP crash reporter unsupported on this platform"
 #endif
 }
+#endif // !XP_MACOSX
 #endif // if defined(MOZ_CRASHREPORTER)
 
 nsresult
 XRE_InitChildProcess(int aArgc,
                      char* aArgv[],
                      GeckoProcessType aProcess)
 {
   NS_ENSURE_ARG_MIN(aArgc, 2);