Commit 6c0e2a6c authored by Sunil Kumar's avatar Sunil Kumar Committed by Commit Bot

[Chromecast] Command line switch to disable crash dumping.

Test : Cast CQ / Manual
Bug: internal b/117938330

Change-Id: I96e4ec912548e08f2030213b12d6064b66f98d68
Reviewed-on: https://chromium-review.googlesource.com/c/1288857Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Commit-Queue: Sunil Kumar <skx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600957}
parent 5070f7a1
......@@ -19,6 +19,7 @@
#include "base/posix/global_descriptors.h"
#include "build/build_config.h"
#include "chromecast/base/cast_paths.h"
#include "chromecast/base/chromecast_switches.h"
#include "chromecast/browser/cast_content_browser_client.h"
#include "chromecast/chromecast_buildflags.h"
#include "chromecast/common/cast_resource_delegate.h"
......@@ -143,20 +144,24 @@ void CastMainDelegate::PreSandboxStartup() {
std::string process_type =
command_line->GetSwitchValueASCII(switches::kProcessType);
// TODO(crbug.com/753619): Enable crash reporting on Fuchsia.
bool enable_crash_reporter = !command_line->HasSwitch(
switches::kDisableCrashReporter);
if (enable_crash_reporter) {
// TODO(crbug.com/753619): Enable crash reporting on Fuchsia.
#if defined(OS_ANDROID)
base::FilePath log_file;
base::PathService::Get(FILE_CAST_ANDROID_LOG, &log_file);
chromecast::CrashHandler::Initialize(process_type, log_file);
base::FilePath log_file;
base::PathService::Get(FILE_CAST_ANDROID_LOG, &log_file);
chromecast::CrashHandler::Initialize(process_type, log_file);
#elif defined(OS_LINUX)
crash_reporter::SetCrashReporterClient(GetCastCrashReporter());
crash_reporter::SetCrashReporterClient(GetCastCrashReporter());
if (process_type != service_manager::switches::kZygoteProcess) {
CastCrashReporterClient::InitCrashReporter(process_type);
}
if (process_type != service_manager::switches::kZygoteProcess) {
CastCrashReporterClient::InitCrashReporter(process_type);
}
#endif // defined(OS_LINUX)
crash_reporter::InitializeCrashKeys();
crash_reporter::InitializeCrashKeys();
}
InitializeResourceBundle();
}
......@@ -180,9 +185,13 @@ int CastMainDelegate::RunProcess(
#if defined(OS_LINUX)
void CastMainDelegate::ZygoteForked() {
const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess());
std::string process_type =
command_line->GetSwitchValueASCII(switches::kProcessType);
CastCrashReporterClient::InitCrashReporter(process_type);
bool enable_crash_reporter = !command_line->HasSwitch(
switches::kDisableCrashReporter);
if (enable_crash_reporter) {
std::string process_type =
command_line->GetSwitchValueASCII(switches::kProcessType);
CastCrashReporterClient::InitCrashReporter(process_type);
}
}
#endif // defined(OS_LINUX)
......
......@@ -20,6 +20,9 @@ const char kSwitchValueFalse[] = "false";
// Default is "https://clients2.google.com/cr/staging_report" for non prod.
const char kCrashServerUrl[] = "crash-server-url";
// Switch to disable Crash reporting
const char kDisableCrashReporter[] = "disable-crash-reporter";
// Enable file accesses. It should not be enabled for most Cast devices.
const char kEnableLocalFileAccesses[] = "enable-local-file-accesses";
......
......@@ -19,6 +19,9 @@ extern const char kSwitchValueFalse[];
// Url to upload crash data to.
extern const char kCrashServerUrl[];
// Disable Crash Reporting
extern const char kDisableCrashReporter[];
// Content-implementation switches
extern const char kEnableLocalFileAccesses[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment