Index: chromecast/crash/linux/cast_crash_reporter_client.cc |
diff --git a/chromecast/crash/cast_crash_reporter_client.cc b/chromecast/crash/linux/cast_crash_reporter_client.cc |
similarity index 50% |
rename from chromecast/crash/cast_crash_reporter_client.cc |
rename to chromecast/crash/linux/cast_crash_reporter_client.cc |
index 8edbfa6b7b26eb91df051b3801d596a90944609b..347b36769be6ede993800e4ba64ffb9a1d04051e 100644 |
--- a/chromecast/crash/cast_crash_reporter_client.cc |
+++ b/chromecast/crash/linux/cast_crash_reporter_client.cc |
@@ -2,9 +2,11 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chromecast/crash/cast_crash_reporter_client.h" |
+#include "chromecast/crash/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/app/breakpad_linux.h" |
#include "content/public/common/content_switches.h" |
@@ -20,13 +22,13 @@ uint64_t g_process_start_time = 0; |
// static |
void CastCrashReporterClient::InitCrashReporter( |
const std::string& process_type) { |
- g_process_start_time = (base::TimeTicks::Now() - |
- base::TimeTicks()).InMilliseconds(); |
+ g_process_start_time = |
+ (base::TimeTicks::Now() - base::TimeTicks()).InMilliseconds(); |
// Save the process type (leaked). |
// Note: "browser" process is identified by empty process type string. |
- const std::string& named_process_type( |
- process_type.empty() ? "browser" : process_type); |
+ const std::string& named_process_type(process_type.empty() ? "browser" |
+ : process_type); |
const size_t process_type_len = named_process_type.size() + 1; |
g_process_type = new char[process_type_len]; |
strncpy(g_process_type, named_process_type.c_str(), process_type_len); |
@@ -45,8 +47,10 @@ uint64_t CastCrashReporterClient::GetProcessStartTime() { |
return g_process_start_time; |
} |
-CastCrashReporterClient::CastCrashReporterClient() {} |
-CastCrashReporterClient::~CastCrashReporterClient() {} |
+CastCrashReporterClient::CastCrashReporterClient() { |
+} |
+CastCrashReporterClient::~CastCrashReporterClient() { |
+} |
bool CastCrashReporterClient::EnableBreakpadForProcess( |
const std::string& process_type) { |
@@ -55,4 +59,22 @@ bool CastCrashReporterClient::EnableBreakpadForProcess( |
process_type == switches::kGpuProcess; |
} |
+bool CastCrashReporterClient::HandleCrashDump(const char* crashdump_filename) { |
+ // Set the initial error code to ERROR_WEB_CONTENT_RENDER_VIEW_GONE to show |
+ // an error message on next cast_shell run. Though the error code is for |
+ // renderer process crash, the actual messages can be used for browser process |
+ // as well. |
+ if (!GetProcessType() || !strcmp(GetProcessType(), "browser")) |
+ SetInitialErrorCode(ERROR_WEB_CONTENT_RENDER_VIEW_GONE); |
+ |
+ // Upload crash dump. If user didn't opt-in crash report, minidump writer |
+ // instantiated within CrashUtil::RequestUploadCrashDump() does nothing. |
+ CrashUtil::RequestUploadCrashDump( |
+ crashdump_filename, GetProcessType(), GetProcessStartTime()); |
+ |
+ // Always return true to indicate that this crash dump has been processed, |
+ // so that it won't fallback to use chrome's default uploader. |
+ return true; |
+} |
+ |
} // namespace chromecast |