#include "chromecast/app/linux/cast_crash_reporter_client.h"
#include "base/time/time.h"
#include "chromecast/base/error_codes.h"
#include "chromecast/crash/linux/crash_util.h"
#include "components/crash/core/app/breakpad_linux.h"
#include "content/public/common/content_switches.h"
#include "sandbox/policy/switches.h"
namespace chromecast {
namespace {
uint64_t g_process_start_time_ms = 0u;
}
void CastCrashReporterClient::InitCrashReporter(
const std::string& process_type) {
DCHECK(!g_process_start_time_ms);
g_process_start_time_ms =
(base::TimeTicks::Now() - base::TimeTicks()).InMilliseconds();
breakpad::InitCrashReporter(process_type);
}
uint64_t CastCrashReporterClient::GetProcessStartTime() {
return g_process_start_time_ms;
}
CastCrashReporterClient::CastCrashReporterClient() {}
CastCrashReporterClient::~CastCrashReporterClient() {}
bool CastCrashReporterClient::EnableBreakpadForProcess(
const std::string& process_type) {
return process_type == switches::kRendererProcess ||
process_type == switches::kZygoteProcess ||
process_type == switches::kGpuProcess ||
process_type == switches::kUtilityProcess;
}
bool CastCrashReporterClient::HandleCrashDump(const char* crashdump_filename,
uint64_t crash_pid) {
SetInitialErrorCode(ERROR_WEB_CONTENT_RENDER_VIEW_GONE);
CrashUtil::RequestUploadCrashDump(crashdump_filename, crash_pid,
GetProcessStartTime());
return true;
}
}