Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: chrome/app/chrome_crash_reporter_client_win.cc

Issue 2799013002: Monitor crashpad_handler for crashes [sometimes] (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/app/chrome_crash_reporter_client_win.cc
diff --git a/chrome/app/chrome_crash_reporter_client_win.cc b/chrome/app/chrome_crash_reporter_client_win.cc
index b0ddb00c47e05443c0b180044cd5570084bf04a5..fdd21ce907bb7bee3a34ead0a8eaef112f540bc3 100644
--- a/chrome/app/chrome_crash_reporter_client_win.cc
+++ b/chrome/app/chrome_crash_reporter_client_win.cc
@@ -19,12 +19,14 @@
#include "base/debug/crash_logging.h"
#include "base/debug/leak_annotations.h"
#include "base/format_macros.h"
+#include "base/rand_util.h"
#include "chrome/common/chrome_result_codes.h"
#include "chrome/install_static/install_details.h"
#include "chrome/install_static/install_util.h"
#include "chrome/install_static/user_data_dir.h"
#include "components/crash/content/app/crashpad.h"
#include "components/crash/core/common/crash_keys.h"
+#include "components/version_info/channel.h"
namespace {
@@ -405,6 +407,36 @@ bool ChromeCrashReporterClient::GetCollectStatsInSample() {
return install_static::GetCollectStatsInSample();
}
+bool ChromeCrashReporterClient::ShouldMonitorCrashHandlerExpensively() {
+ // The expensive mechanism dedicates a process to be crashpad_handler's own
+ // crashpad_handler. In Chrome builds for official release, scale back on
+ // this in the more stable channels. There's a fallback crash handler that
+ // can catch crashes when this expensive mechanism isn't used, although the
+ // fallback crash handler has different characteristics so it's desirable to
+ // use the expensive mechanism at least some of the time.
+ double probability = 0.5;
+#if defined(GOOGLE_CHROME_BUILD) && defined(OFFICIAL_BUILD)
+ switch (install_static::InstallDetails::Get().GetChannel()) {
+ case version_info::Channel::STABLE:
+ return false;
+
+ case version_info::Channel::BETA:
+ probability = 0.1;
+ break;
+
+ case version_info::Channel::DEV:
+ probability = 0.25;
+ break;
+
+ case version_info::Channel::CANARY:
+ case version_info::Channel::UNKNOWN:
+ break;
+ }
+#endif
+
+ return base::RandDouble() < probability;
+}
+
bool ChromeCrashReporterClient::EnableBreakpadForProcess(
const std::string& process_type) {
// This is not used by Crashpad (at least on Windows).

Powered by Google App Engine
This is Rietveld 408576698