chore: remove gin::Wrappable crash keys (#31075)
* chore: remove gin wrappable crash keys * chore: remove class headers from crash keys
This commit is contained in:
parent
919fd0f28d
commit
d88e71f688
4 changed files with 1 additions and 169 deletions
|
@ -100,7 +100,6 @@ build_do_not_depend_on_packed_resource_integrity.patch
|
|||
refactor_restore_base_adaptcallbackforrepeating.patch
|
||||
hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch
|
||||
don_t_run_pcscan_notifythreadcreated_if_pcscan_is_disabled.patch
|
||||
add_gin_wrappable_crash_key.patch
|
||||
logging_win32_only_create_a_console_if_logging_to_stderr.patch
|
||||
fix_media_key_usage_with_globalshortcuts.patch
|
||||
feat_expose_raw_response_headers_from_urlloader.patch
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: VerteDinde <khammond@slack-corp.com>
|
||||
Date: Thu, 15 Jul 2021 12:16:50 -0700
|
||||
Subject: chore: add gin::wrappable wrapperinfo crash key
|
||||
|
||||
This patch adds an additional crash key for gin::Wrappable, to help
|
||||
debug a crash that is occurring during garbage collection in SecondWeakCallback.
|
||||
|
||||
The crash seems to be due to a class that is holding a reference to
|
||||
gin::Wrappable even after being deleted. This added crash key compares
|
||||
the soon-to-be-deleted WrapperInfo with known WrapperInfo components to
|
||||
help determine where the crash originated from.
|
||||
|
||||
This patch should not be upstreamed, and can be removed in Electron 15 and
|
||||
beyond once we identify the cause of the crash.
|
||||
|
||||
diff --git a/gin/BUILD.gn b/gin/BUILD.gn
|
||||
index c6059fdb0e0f74ee3ef78c5517634ed5a36f1b10..e16b2ec43b98c3b8724fd85085a33fe52a1e1979 100644
|
||||
--- a/gin/BUILD.gn
|
||||
+++ b/gin/BUILD.gn
|
||||
@@ -88,6 +88,10 @@ component("gin") {
|
||||
frameworks = [ "CoreFoundation.framework" ]
|
||||
}
|
||||
|
||||
+ if (!is_mas_build) {
|
||||
+ public_deps += [ "//components/crash/core/common:crash_key" ]
|
||||
+ }
|
||||
+
|
||||
configs += [
|
||||
"//tools/v8_context_snapshot:use_v8_context_snapshot",
|
||||
"//v8:external_startup_data",
|
||||
diff --git a/gin/wrappable.cc b/gin/wrappable.cc
|
||||
index fe07eb94a8e679859bba6d76ff0d6ee86bd0c67e..ecb0aa2c4ec57e1814f4c94194e775440f4e35ee 100644
|
||||
--- a/gin/wrappable.cc
|
||||
+++ b/gin/wrappable.cc
|
||||
@@ -8,6 +8,11 @@
|
||||
#include "gin/object_template_builder.h"
|
||||
#include "gin/per_isolate_data.h"
|
||||
|
||||
+#if !defined(MAS_BUILD)
|
||||
+#include "components/crash/core/common/crash_key.h"
|
||||
+#include "electron/shell/common/crash_keys.h"
|
||||
+#endif
|
||||
+
|
||||
namespace gin {
|
||||
|
||||
WrappableBase::WrappableBase() = default;
|
||||
@@ -36,6 +41,15 @@ void WrappableBase::FirstWeakCallback(
|
||||
void WrappableBase::SecondWeakCallback(
|
||||
const v8::WeakCallbackInfo<WrappableBase>& data) {
|
||||
WrappableBase* wrappable = data.GetParameter();
|
||||
+
|
||||
+#if !defined(MAS_BUILD)
|
||||
+ WrapperInfo* wrapperInfo = static_cast<WrapperInfo*>(data.GetInternalField(0));
|
||||
+ std::string location = electron::crash_keys::GetCrashValueForGinWrappable(wrapperInfo);
|
||||
+
|
||||
+ static crash_reporter::CrashKeyString<32> crash_key("gin-wrappable-fatal.location");
|
||||
+ crash_reporter::ScopedCrashKeyString auto_clear(&crash_key, location);
|
||||
+#endif
|
||||
+
|
||||
delete wrappable;
|
||||
}
|
||||
|
|
@ -16,41 +16,13 @@
|
|||
#include "content/public/common/content_switches.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "electron/fuses.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/common/electron_constants.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
#include "shell/common/process_util.h"
|
||||
#include "third_party/crashpad/crashpad/client/annotation.h"
|
||||
|
||||
#include "gin/wrappable.h"
|
||||
#include "shell/browser/api/electron_api_app.h"
|
||||
#include "shell/browser/api/electron_api_auto_updater.h"
|
||||
#include "shell/browser/api/electron_api_browser_view.h"
|
||||
#include "shell/browser/api/electron_api_cookies.h"
|
||||
#include "shell/browser/api/electron_api_data_pipe_holder.h"
|
||||
#include "shell/browser/api/electron_api_debugger.h"
|
||||
#include "shell/browser/api/electron_api_desktop_capturer.h"
|
||||
#include "shell/browser/api/electron_api_download_item.h"
|
||||
#include "shell/browser/api/electron_api_global_shortcut.h"
|
||||
#include "shell/browser/api/electron_api_in_app_purchase.h"
|
||||
#include "shell/browser/api/electron_api_menu.h"
|
||||
#include "shell/browser/api/electron_api_native_theme.h"
|
||||
#include "shell/browser/api/electron_api_net_log.h"
|
||||
#include "shell/browser/api/electron_api_notification.h"
|
||||
#include "shell/browser/api/electron_api_power_monitor.h"
|
||||
#include "shell/browser/api/electron_api_power_save_blocker.h"
|
||||
#include "shell/browser/api/electron_api_protocol.h"
|
||||
#include "shell/browser/api/electron_api_service_worker_context.h"
|
||||
#include "shell/browser/api/electron_api_session.h"
|
||||
#include "shell/browser/api/electron_api_system_preferences.h"
|
||||
#include "shell/browser/api/electron_api_tray.h"
|
||||
#include "shell/browser/api/electron_api_url_loader.h"
|
||||
#include "shell/browser/api/electron_api_web_contents.h"
|
||||
#include "shell/browser/api/electron_api_web_frame_main.h"
|
||||
#include "shell/browser/api/electron_api_web_request.h"
|
||||
#include "shell/browser/api/event.h"
|
||||
#include "shell/common/api/electron_api_native_image.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
namespace crash_keys {
|
||||
|
@ -195,78 +167,6 @@ void SetPlatformCrashKey() {
|
|||
#endif
|
||||
}
|
||||
|
||||
std::string GetCrashValueForGinWrappable(gin::WrapperInfo* info) {
|
||||
std::string crash_location;
|
||||
|
||||
// Adds a breadcrumb for crashes within gin::WrappableBase::SecondWeakCallback
|
||||
// (see patch: add_gin_wrappable_crash_key.patch)
|
||||
// Compares the pointers for the kWrapperInfo within SecondWeakCallback
|
||||
// with the wrapper info from classes that use gin::Wrappable and
|
||||
// could potentially retain a reference after deletion.
|
||||
if (info == &electron::api::WebContents::kWrapperInfo)
|
||||
crash_location = "WebContents";
|
||||
else if (info == &electron::api::BrowserView::kWrapperInfo)
|
||||
crash_location = "BrowserView";
|
||||
else if (info == &electron::api::Notification::kWrapperInfo)
|
||||
crash_location = "Notification";
|
||||
else if (info == &electron::api::Cookies::kWrapperInfo)
|
||||
crash_location = "Cookies";
|
||||
#if BUILDFLAG(ENABLE_DESKTOP_CAPTURER)
|
||||
else if (info == &electron::api::DesktopCapturer::kWrapperInfo)
|
||||
crash_location = "DesktopCapturer";
|
||||
#endif
|
||||
else if (info == &electron::api::Tray::kWrapperInfo)
|
||||
crash_location = "Tray";
|
||||
else if (info == &electron::api::NetLog::kWrapperInfo)
|
||||
crash_location = "NetLog";
|
||||
else if (info == &electron::api::NativeImage::kWrapperInfo)
|
||||
crash_location = "NativeImage";
|
||||
else if (info == &electron::api::Menu::kWrapperInfo)
|
||||
crash_location = "Menu";
|
||||
else if (info == &electron::api::PowerMonitor::kWrapperInfo)
|
||||
crash_location = "PowerMonitor";
|
||||
else if (info == &electron::api::Protocol::kWrapperInfo)
|
||||
crash_location = "Protocol";
|
||||
else if (info == &electron::api::ServiceWorkerContext::kWrapperInfo)
|
||||
crash_location = "ServiceWorkerContext";
|
||||
else if (info == &electron::api::WebFrameMain::kWrapperInfo)
|
||||
crash_location = "WebFrameMain";
|
||||
else if (info == &electron::api::WebRequest::kWrapperInfo)
|
||||
crash_location = "WebRequest";
|
||||
else if (info == &electron::api::SystemPreferences::kWrapperInfo)
|
||||
crash_location = "SystemPreferences";
|
||||
else if (info == &electron::api::Session::kWrapperInfo)
|
||||
crash_location = "Session";
|
||||
else if (info == &electron::api::DownloadItem::kWrapperInfo)
|
||||
crash_location = "DownloadItem";
|
||||
else if (info == &electron::api::NativeTheme::kWrapperInfo)
|
||||
crash_location = "NativeTheme";
|
||||
else if (info == &electron::api::Debugger::kWrapperInfo)
|
||||
crash_location = "Debugger";
|
||||
else if (info == &electron::api::GlobalShortcut::kWrapperInfo)
|
||||
crash_location = "GlobalShortcut";
|
||||
else if (info == &electron::api::InAppPurchase::kWrapperInfo)
|
||||
crash_location = "InAppPurchase";
|
||||
else if (info == &electron::api::DataPipeHolder::kWrapperInfo)
|
||||
crash_location = "DataPipeHolder";
|
||||
else if (info == &electron::api::AutoUpdater::kWrapperInfo)
|
||||
crash_location = "AutoUpdater";
|
||||
else if (info == &electron::api::SimpleURLLoaderWrapper::kWrapperInfo)
|
||||
crash_location = "SimpleURLLoaderWrapper";
|
||||
else if (info == &gin_helper::Event::kWrapperInfo)
|
||||
crash_location = "Event";
|
||||
else if (info == &electron::api::PowerSaveBlocker::kWrapperInfo)
|
||||
crash_location = "PowerSaveBlocker";
|
||||
else if (info == &electron::api::App::kWrapperInfo)
|
||||
crash_location = "App";
|
||||
else
|
||||
crash_location =
|
||||
"Deleted kWrapperInfo does not match listed component. Please review "
|
||||
"listed crash keys.";
|
||||
|
||||
return crash_location;
|
||||
}
|
||||
|
||||
} // namespace crash_keys
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "gin/wrappable.h"
|
||||
|
||||
namespace base {
|
||||
class CommandLine;
|
||||
}
|
||||
|
@ -25,8 +23,6 @@ void GetCrashKeys(std::map<std::string, std::string>* keys);
|
|||
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line);
|
||||
void SetPlatformCrashKey();
|
||||
|
||||
std::string GetCrashValueForGinWrappable(gin::WrapperInfo* info);
|
||||
|
||||
} // namespace crash_keys
|
||||
|
||||
} // namespace electron
|
||||
|
|
Loading…
Reference in a new issue