Bug 551392: Remove hack made unnecessary by unified build tiers. r=ted
☠☠ backed out by 82538eeb9974 ☠ ☠
authorChris Jones <jones.chris.g@gmail.com>
Thu, 18 Mar 2010 17:52:38 -0500
changeset 39619 bda8efa53512cee4932599a044bc7c50f690c7a1
parent 39618 dd36815ae7bb1ab252d135de327752f0f0b4e037
child 39620 cc33a4008a7803bf31eaf361f5ae19f40524b337
child 39624 82538eeb997416c9901e775509039c5c9adb40f3
push id12296
push usercjones@mozilla.com
push dateThu, 18 Mar 2010 22:52:59 +0000
treeherdermozilla-central@bda8efa53512 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs551392
milestone1.9.3a4pre
Bug 551392: Remove hack made unnecessary by unified build tiers. r=ted
dom/plugins/PluginModuleParent.cpp
ipc/ipdl/ipdl/lower.py
toolkit/crashreporter/nsExceptionHandler.cpp
toolkit/crashreporter/nsExceptionHandler.h
toolkit/xre/nsEmbedFunctions.cpp
xpcom/build/nsXULAppAPI.h
--- a/dom/plugins/PluginModuleParent.cpp
+++ b/dom/plugins/PluginModuleParent.cpp
@@ -43,16 +43,19 @@
 #include "base/process_util.h"
 
 #include "mozilla/ipc/SyncChannel.h"
 #include "mozilla/plugins/PluginModuleParent.h"
 #include "mozilla/plugins/BrowserStreamParent.h"
 
 #include "nsContentUtils.h"
 #include "nsCRT.h"
+#ifdef MOZ_CRASHREPORTER
+#  include "nsExceptionHandler.h"
+#endif
 #include "nsNPAPIPlugin.h"
 
 using base::KillProcess;
 
 using mozilla::PluginLibrary;
 using mozilla::ipc::NPRemoteIdentifier;
 using mozilla::ipc::SyncChannel;
 
@@ -253,27 +256,30 @@ PluginModuleParent::ShouldContinueFromRe
     return waitMoar;
 }
 
 void
 PluginModuleParent::ActorDestroy(ActorDestroyReason why)
 {
     switch (why) {
     case AbnormalShutdown: {
+#ifdef MOZ_CRASHREPORTER
         nsCOMPtr<nsIFile> dump;
-        if (TakeMinidump(getter_AddRefs(dump))) {
+        if (CrashReporter::TakeMinidumpForChild(ChildProcessHandle(),
+                                                getter_AddRefs(dump))) {
             WriteExtraDataForMinidump(dump);
             if (NS_SUCCEEDED(dump->GetLeafName(mDumpID))) {
                 mDumpID.Replace(mDumpID.Length() - 4, 4,
                                 NS_LITERAL_STRING(""));
             }
         }
         else {
             NS_WARNING("[PluginModuleParent::ActorDestroy] abnormal shutdown without minidump!");
         }
+#endif
 
         mShutdown = true;
         // Defer the PluginCrashed method so that we don't re-enter
         // and potentially modify the actor child list while enumerating it.
         if (mPlugin) {
             mPluginCrashedTask = NewRunnableMethod(
                 this, &PluginModuleParent::NotifyPluginCrashed);
             MessageLoop::current()->PostTask(FROM_HERE, mPluginCrashedTask);
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -2939,49 +2939,16 @@ class _GenerateProtocolActorCode(ipdl.as
         # protocols with union types need Lookup().  we'll give it to
         # all for the time being (simpler)
         if 1 or ptype.isManager():
             self.cls.addstmts(self.implementManagerIface())
 
         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().
             # See ipc/glue/RPCChannel.h
             blockchild = MethodDefn(MethodDecl(
                 'BlockChild', ret=Type.BOOL))
             blockchild.addstmt(StmtReturn(ExprCall(
                 ExprSelect(p.channelVar(), '.', 'BlockChild'))))
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -1413,27 +1413,29 @@ SetRemoteExceptionHandler()
   // we either do remote or nothing, no fallback to regular crash reporting
   return gExceptionHandler->IsOutOfProcess();
 }
 
 #endif  // XP_WIN
 
 
 bool
-TakeMinidumpForChild(PRUint32 childPid, nsIFile** dump)
+TakeMinidumpForChild(ProcessHandle childPid, nsIFile** dump)
 {
   if (!GetEnabled())
     return false;
 
+  PRUint32 key = PRUint32(childPid);
+
   MutexAutoLock lock(*dumpMapLock);
 
   nsCOMPtr<nsIFile> d;
-  bool found = pidToMinidump->Get(childPid, getter_AddRefs(d));
+  bool found = pidToMinidump->Get(key, getter_AddRefs(d));
   if (found)
-    pidToMinidump->Remove(childPid);
+    pidToMinidump->Remove(key);
 
   *dump = NULL;
   d.swap(*dump);
 
   return found;
 }
 
 bool
--- a/toolkit/crashreporter/nsExceptionHandler.h
+++ b/toolkit/crashreporter/nsExceptionHandler.h
@@ -71,20 +71,26 @@ nsresult SetupExtraData(nsILocalFile* aA
   nsresult AppendObjCExceptionInfoToAppNotes(void *inException);
 #endif
 nsresult GetSubmitReports(PRBool* aSubmitReport);
 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(PRUint32 childPid, nsIFile** dump NS_OUTPARAM);
+bool TakeMinidumpForChild(ProcessHandle childPid, nsIFile** dump NS_OUTPARAM);
 
 #  if defined(XP_WIN32)
 // Parent-side API for children
 const char* GetChildNotificationPipe();
 
 // Child-side API
 bool SetRemoteExceptionHandler(const nsACString& crashPipe);
 
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -246,25 +246,16 @@ namespace mozilla {
 namespace startup {
 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*/)
 {
 #if defined(XP_WIN)
   return CrashReporter::SetRemoteExceptionHandler(nsDependentCString(aPipe));
 #elif defined(OS_LINUX)
   return CrashReporter::SetRemoteExceptionHandler();
 #else
--- a/xpcom/build/nsXULAppAPI.h
+++ b/xpcom/build/nsXULAppAPI.h
@@ -445,20 +445,16 @@ PR_STATIC_ASSERT(sizeof(kGeckoProcessTyp
 
 XRE_API(const char*,
         XRE_ChildProcessTypeToString, (GeckoProcessType aProcessType))
 
 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))
 #endif
 
 XRE_API(nsresult,
         XRE_InitChildProcess, (int aArgc,
                                char* aArgv[],