Bug 1541269 - Make OnChildProcessDumpRequested() the same on all platforms. r=gsvelto
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 03 Apr 2019 18:54:04 +0000
changeset 467917 e835fbf63aeac40e8682fb797c06abc5616f58bb
parent 467916 5e7dea1ca822eaca4e56534d90c29e12df3fd471
child 467918 25f585dc1f7f4e6f78a16f816fb812fefa6380f5
push id112667
push useraiakab@mozilla.com
push dateThu, 04 Apr 2019 16:12:45 +0000
treeherdermozilla-inbound@230bb363f2f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgsvelto
bugs1541269
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1541269 - Make OnChildProcessDumpRequested() the same on all platforms. r=gsvelto Differential Revision: https://phabricator.services.mozilla.com/D25884
toolkit/crashreporter/breakpad-client/linux/crash_generation/crash_generation_server.cc
toolkit/crashreporter/breakpad-client/linux/crash_generation/crash_generation_server.h
toolkit/crashreporter/breakpad-client/windows/crash_generation/crash_generation_server.cc
toolkit/crashreporter/breakpad-client/windows/crash_generation/crash_generation_server.h
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/toolkit/crashreporter/breakpad-client/linux/crash_generation/crash_generation_server.cc
+++ b/toolkit/crashreporter/breakpad-client/linux/crash_generation/crash_generation_server.cc
@@ -269,17 +269,17 @@ CrashGenerationServer::ClientEvent(short
                                       kCrashContextSize)) {
     close(signal_fd);
     return true;
   }
 
   if (dump_callback_) {
     ClientInfo info(crashing_pid, this);
 
-    dump_callback_(dump_context_, &info, &minidump_filename);
+    dump_callback_(dump_context_, info, minidump_filename);
   }
 
   // Send the done signal to the process: it can exit now.
   // (Closing this will make the child's sys_read unblock and return 0.)
   close(signal_fd);
 
   return true;
 }
--- a/toolkit/crashreporter/breakpad-client/linux/crash_generation/crash_generation_server.h
+++ b/toolkit/crashreporter/breakpad-client/linux/crash_generation/crash_generation_server.h
@@ -41,21 +41,21 @@ namespace google_breakpad {
 class ClientInfo;
 
 class CrashGenerationServer {
 public:
   // WARNING: callbacks may be invoked on a different thread
   // than that which creates the CrashGenerationServer.  They must
   // be thread safe.
   typedef void (*OnClientDumpRequestCallback)(void* context,
-                                              const ClientInfo* client_info,
-                                              const string* file_path);
+                                              const ClientInfo& client_info,
+                                              const string& file_path);
 
   typedef void (*OnClientExitingCallback)(void* context,
-                                          const ClientInfo* client_info);
+                                          const ClientInfo& client_info);
 
   // Create an instance with the given parameters.
   //
   // Parameter listen_fd: The server fd created by CreateReportChannel().
   // Parameter dump_callback: Callback for a client crash dump request.
   // Parameter dump_context: Context for client crash dump request callback.
   // Parameter exit_callback: Callback for client process exit.
   // Parameter exit_context: Context for client exit callback.
--- a/toolkit/crashreporter/breakpad-client/windows/crash_generation/crash_generation_server.cc
+++ b/toolkit/crashreporter/breakpad-client/windows/crash_generation/crash_generation_server.cc
@@ -848,17 +848,17 @@ void CrashGenerationServer::HandleClient
   assert(client_info);
 
   // Must unregister the dump request wait operation and wait for any
   // dump requests that might be pending to finish before proceeding
   // with the client_info cleanup.
   client_info->UnregisterDumpRequestWaitAndBlockUntilNoPending();
 
   if (exit_callback_) {
-    exit_callback_(exit_context_, client_info);
+    exit_callback_(exit_context_, *client_info);
   }
 
   // Start a new scope to release lock automatically.
   {
     AutoCriticalSection lock(&sync_);
     if (shutting_down_) {
       // The crash generation server is shutting down and as part of the
       // shutdown process it will delete all clients from the clients_ list.
@@ -885,18 +885,17 @@ void CrashGenerationServer::HandleDumpRe
   if (generate_dumps_) {
     if (!GenerateDump(client_info, &dump_path)) {
       // client proccess terminated or some other error
       execute_callback = false;
     }
   }
 
   if (dump_callback_ && execute_callback) {
-    std::wstring* ptr_dump_path = (dump_path == L"") ? NULL : &dump_path;
-    dump_callback_(dump_context_, &client_info, ptr_dump_path);
+    dump_callback_(dump_context_, client_info, dump_path);
   }
 
   SetEvent(client_info.dump_generated_handle());
 }
 
 void CrashGenerationServer::set_include_context_heap(bool enabled) {
   include_context_heap_ = enabled;
 }
--- a/toolkit/crashreporter/breakpad-client/windows/crash_generation/crash_generation_server.h
+++ b/toolkit/crashreporter/breakpad-client/windows/crash_generation/crash_generation_server.h
@@ -49,21 +49,21 @@ class ClientInfo;
 // signal to request dump generation. When the clients request dump
 // generation in this way, the server generates Windows minidump files.
 class CrashGenerationServer {
  public:
   typedef void (*OnClientConnectedCallback)(void* context,
                                             const ClientInfo* client_info);
 
   typedef void (*OnClientDumpRequestCallback)(void* context,
-                                              const ClientInfo* client_info,
-                                              const std::wstring* file_path);
+                                              const ClientInfo& client_info,
+                                              const std::wstring& file_path);
 
   typedef void (*OnClientExitedCallback)(void* context,
-                                         const ClientInfo* client_info);
+                                         const ClientInfo& client_info);
 
   typedef void (*OnClientUploadRequestCallback)(void* context,
                                                 const DWORD crash_id);
 
   // Creates an instance with the given parameters.
   //
   // Parameter pipe_name: Name of the Windows named pipe
   // Parameter pipe_sec_attrs Security attributes to set on the pipe. Pass
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -2940,47 +2940,31 @@ static bool MoveToPending(nsIFile* dumpF
       return false;
     }
   }
 
   return true;
 }
 
 static void OnChildProcessDumpRequested(void* aContext,
-#ifdef XP_MACOSX
                                         const ClientInfo& aClientInfo,
                                         const xpstring& aFilePath
-#else
-                                        const ClientInfo* aClientInfo,
-                                        const xpstring* aFilePath
-#endif
 ) {
   nsCOMPtr<nsIFile> minidump;
   nsCOMPtr<nsIFile> extraFile;
 
   // Hold the mutex until the current dump request is complete, to
   // prevent UnsetExceptionHandler() from pulling the rug out from
   // under us.
   MutexAutoLock lock(*dumpSafetyLock);
   if (!isSafeToDump) return;
 
-  CreateFileFromPath(
-#ifdef XP_MACOSX
-      aFilePath,
-#else
-      *aFilePath,
-#endif
-      getter_AddRefs(minidump));
-
-  uint32_t pid =
-#ifdef XP_MACOSX
-      aClientInfo.pid();
-#else
-      aClientInfo->pid();
-#endif
+  CreateFileFromPath(aFilePath, getter_AddRefs(minidump));
+
+  uint32_t pid = aClientInfo.pid();
 
   if (!WriteExtraForMinidump(minidump, pid, /* content */ true,
                              getter_AddRefs(extraFile))) {
     return;
   }
 
   if (ShouldReport()) {
     nsCOMPtr<nsIFile> memoryReport;