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

Side by Side Diff: chrome/app/chrome_crash_reporter_client_win.cc

Issue 2799013002: Monitor crashpad_handler for crashes [sometimes] (Closed)
Patch Set: Address review feedback (scottmg) 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 unified diff | Download patch
« no previous file with comments | « chrome/app/chrome_crash_reporter_client_win.h ('k') | chrome/app/chrome_exe_main_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(ananta/scottmg) 5 // TODO(ananta/scottmg)
6 // Add test coverage for Crashpad. 6 // Add test coverage for Crashpad.
7 #include "chrome/app/chrome_crash_reporter_client_win.h" 7 #include "chrome/app/chrome_crash_reporter_client_win.h"
8 8
9 #include <windows.h> 9 #include <windows.h>
10 10
11 #include <assert.h> 11 #include <assert.h>
12 #include <shellapi.h> 12 #include <shellapi.h>
13 13
14 #include <iterator> 14 #include <iterator>
15 #include <memory> 15 #include <memory>
16 #include <string> 16 #include <string>
17 17
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/debug/crash_logging.h" 19 #include "base/debug/crash_logging.h"
20 #include "base/debug/leak_annotations.h" 20 #include "base/debug/leak_annotations.h"
21 #include "base/format_macros.h" 21 #include "base/format_macros.h"
22 #include "base/rand_util.h"
22 #include "chrome/common/chrome_result_codes.h" 23 #include "chrome/common/chrome_result_codes.h"
23 #include "chrome/install_static/install_details.h"
24 #include "chrome/install_static/install_util.h" 24 #include "chrome/install_static/install_util.h"
25 #include "chrome/install_static/user_data_dir.h" 25 #include "chrome/install_static/user_data_dir.h"
26 #include "components/crash/content/app/crashpad.h" 26 #include "components/crash/content/app/crashpad.h"
27 #include "components/crash/core/common/crash_keys.h" 27 #include "components/crash/core/common/crash_keys.h"
28 #include "components/version_info/channel.h"
28 29
29 namespace { 30 namespace {
30 31
31 // TODO(ananta) 32 // TODO(ananta)
32 // When the new crash key map implementation lands, we should remove the 33 // When the new crash key map implementation lands, we should remove the
33 // constants defined below, the RegisterCrashKeysHelper function, the 34 // constants defined below, the RegisterCrashKeysHelper function, the
34 // RegisterCrashKeys function in the crash_keys::CrashReporterClient interface 35 // RegisterCrashKeys function in the crash_keys::CrashReporterClient interface
35 // and the snprintf function defined here. 36 // and the snprintf function defined here.
36 constexpr char kActiveURL[] = "url-chunk"; 37 constexpr char kActiveURL[] = "url-chunk";
37 constexpr char kFontKeyName[] = "font_key_name"; 38 constexpr char kFontKeyName[] = "font_key_name";
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 install_static::SetEnvironmentString16(install_static::kShowRestart, L"1"); 334 install_static::SetEnvironmentString16(install_static::kShowRestart, L"1");
334 return true; 335 return true;
335 } 336 }
336 337
337 bool ChromeCrashReporterClient::GetDeferredUploadsSupported( 338 bool ChromeCrashReporterClient::GetDeferredUploadsSupported(
338 bool is_per_user_install) { 339 bool is_per_user_install) {
339 return false; 340 return false;
340 } 341 }
341 342
342 bool ChromeCrashReporterClient::GetIsPerUserInstall() { 343 bool ChromeCrashReporterClient::GetIsPerUserInstall() {
343 return !install_static::InstallDetails::Get().system_level(); 344 return !install_static::IsSystemInstall();
344 } 345 }
345 346
346 bool ChromeCrashReporterClient::GetShouldDumpLargerDumps() { 347 bool ChromeCrashReporterClient::GetShouldDumpLargerDumps() {
347 // Capture larger dumps for Google Chrome "beta", "dev", and "canary" 348 // Capture larger dumps for Google Chrome beta, dev, and canary channels, and
348 // channels. Stable channel and Chromium builds are on channel "", and use 349 // Chromium builds. The Google Chrome stable channel uses smaller dumps.
349 // smaller dumps. 350 return install_static::GetChromeChannel() != version_info::Channel::STABLE;
350 return !install_static::InstallDetails::Get().channel().empty();
351 } 351 }
352 352
353 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() { 353 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() {
354 return chrome::RESULT_CODE_RESPAWN_FAILED; 354 return chrome::RESULT_CODE_RESPAWN_FAILED;
355 } 355 }
356 356
357 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( 357 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy(
358 bool* crashpad_enabled) { 358 bool* crashpad_enabled) {
359 // Determine whether configuration management allows loading the crash 359 // Determine whether configuration management allows loading the crash
360 // reporter. 360 // reporter.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 398 }
399 399
400 bool ChromeCrashReporterClient::GetCollectStatsConsent() { 400 bool ChromeCrashReporterClient::GetCollectStatsConsent() {
401 return install_static::GetCollectStatsConsent(); 401 return install_static::GetCollectStatsConsent();
402 } 402 }
403 403
404 bool ChromeCrashReporterClient::GetCollectStatsInSample() { 404 bool ChromeCrashReporterClient::GetCollectStatsInSample() {
405 return install_static::GetCollectStatsInSample(); 405 return install_static::GetCollectStatsInSample();
406 } 406 }
407 407
408 bool ChromeCrashReporterClient::ShouldMonitorCrashHandlerExpensively() {
409 // The expensive mechanism dedicates a process to be crashpad_handler's own
410 // crashpad_handler. In Google Chrome, scale back on this in the more stable
411 // channels. There's a fallback crash handler that can catch crashes when this
412 // expensive mechanism isn't used, although the fallback crash handler has
413 // different characteristics so it's desirable to use the expensive mechanism
414 // at least some of the time.
415 double probability;
416 switch (install_static::GetChromeChannel()) {
417 case version_info::Channel::STABLE:
418 return false;
419
420 case version_info::Channel::BETA:
421 probability = 0.1;
422 break;
423
424 case version_info::Channel::DEV:
425 probability = 0.25;
426 break;
427
428 default:
429 probability = 0.5;
430 break;
431 }
432
433 return base::RandDouble() < probability;
434 }
435
408 bool ChromeCrashReporterClient::EnableBreakpadForProcess( 436 bool ChromeCrashReporterClient::EnableBreakpadForProcess(
409 const std::string& process_type) { 437 const std::string& process_type) {
410 // This is not used by Crashpad (at least on Windows). 438 // This is not used by Crashpad (at least on Windows).
411 NOTREACHED(); 439 NOTREACHED();
412 return true; 440 return true;
413 } 441 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_crash_reporter_client_win.h ('k') | chrome/app/chrome_exe_main_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698