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

Unified Diff: chromecast/crash/cast_crash_reporter_client.cc

Issue 731933005: Chromecast: adds crash handling for Linux build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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: chromecast/crash/cast_crash_reporter_client.cc
diff --git a/chromecast/crash/cast_crash_reporter_client.cc b/chromecast/crash/cast_crash_reporter_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8edbfa6b7b26eb91df051b3801d596a90944609b
--- /dev/null
+++ b/chromecast/crash/cast_crash_reporter_client.cc
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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 "base/time/time.h"
+#include "components/crash/app/breakpad_linux.h"
+#include "content/public/common/content_switches.h"
+
+namespace chromecast {
+
+namespace {
+
+char* g_process_type = NULL;
+uint64_t g_process_start_time = 0;
+
+} // namespace
+
+// static
+void CastCrashReporterClient::InitCrashReporter(
+ const std::string& process_type) {
+ 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 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);
+
+ // Start up breakpad for this process, if applicable.
+ breakpad::InitCrashReporter(process_type);
+}
+
+// static
+char* CastCrashReporterClient::GetProcessType() {
+ return g_process_type;
+}
+
+// static
+uint64_t CastCrashReporterClient::GetProcessStartTime() {
+ return g_process_start_time;
+}
+
+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;
+}
+
+} // namespace chromecast
« no previous file with comments | « chromecast/crash/cast_crash_reporter_client.h ('k') | chromecast/crash/cast_crash_reporter_client_simple.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698