Browse Source

fix: do not use crashpad APIs in the MAS build (#26491)

Samuel Attard 4 years ago
parent
commit
358ab79778
2 changed files with 15 additions and 8 deletions
  1. 9 7
      chromium_src/BUILD.gn
  2. 6 1
      shell/browser/api/electron_api_web_contents.cc

+ 9 - 7
chromium_src/BUILD.gn

@@ -286,13 +286,15 @@ static_library("chrome") {
     }
   }
 
-  sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.h" ]
-  if (is_mac) {
-    sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_mac.cc" ]
-  } else if (is_win) {
-    sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_win.cc" ]
-  } else {
-    sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.cc" ]
+  if (!is_mas_build) {
+    sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.h" ]
+    if (is_mac) {
+      sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_mac.cc" ]
+    } else if (is_win) {
+      sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_win.cc" ]
+    } else {
+      sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.cc" ]
+    }
   }
 }
 

+ 6 - 1
shell/browser/api/electron_api_web_contents.cc

@@ -27,7 +27,6 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/values.h"
 #include "chrome/browser/browser_process.h"
-#include "chrome/browser/hang_monitor/hang_crash_dump.h"
 #include "chrome/browser/ssl/security_state_tab_helper.h"
 #include "chrome/common/pref_names.h"
 #include "components/prefs/pref_service.h"
@@ -178,6 +177,10 @@
 #include "shell/browser/electron_pdf_web_contents_helper_client.h"
 #endif
 
+#ifndef MAS_BUILD
+#include "chrome/browser/hang_monitor/hang_crash_dump.h"  // nogncheck
+#endif
+
 namespace gin {
 
 #if BUILDFLAG(ENABLE_PRINTING)
@@ -2106,7 +2109,9 @@ void WebContents::ForcefullyCrashRenderer() {
     rph->ForceCrash();
 #else
     // Try to generate a crash report for the hung process.
+#ifndef MAS_BUILD
     CrashDumpHungChildProcess(rph->GetProcess().Handle());
+#endif
     rph->Shutdown(content::RESULT_CODE_HUNG);
 #endif
   }