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

Unified Diff: chrome/app/mash/mash_crash_reporter_client.cc

Issue 2643853005: chromeos: Initial support for crash reporting for chrome --mash (Closed)
Patch Set: sadrul comments Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/mash/mash_crash_reporter_client.h ('k') | chrome/app/mash/mash_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/mash/mash_crash_reporter_client.cc
diff --git a/chrome/app/mash/mash_crash_reporter_client.cc b/chrome/app/mash/mash_crash_reporter_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ab6302422b5693eafa4447430bfa5496e19d074b
--- /dev/null
+++ b/chrome/app/mash/mash_crash_reporter_client.cc
@@ -0,0 +1,84 @@
+// Copyright 2017 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 "chrome/app/mash/mash_crash_reporter_client.h"
+
+#include <vector>
+
+#include "base/base_switches.h"
+#include "base/command_line.h"
+#include "base/debug/crash_logging.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/sys_info.h"
+#include "components/crash/core/common/crash_keys.h"
+#include "components/upload_list/crash_upload_list.h"
+#include "components/version_info/version_info_values.h"
+
+#if !defined(OS_CHROMEOS)
+#error Unsupported platform
+#endif
+
+MashCrashReporterClient::MashCrashReporterClient() {}
+
+MashCrashReporterClient::~MashCrashReporterClient() {}
+
+void MashCrashReporterClient::GetProductNameAndVersion(
+ const char** product_name,
+ const char** version) {
+ *product_name = "Chrome_ChromeOS";
+ *version = PRODUCT_VERSION;
+}
+
+base::FilePath MashCrashReporterClient::GetReporterLogFilename() {
+ return base::FilePath(CrashUploadList::kReporterLogFilename);
+}
+
+bool MashCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) {
+ // For development on Linux desktop just use /tmp.
+ if (!base::SysInfo::IsRunningOnChromeOS()) {
+ *crash_dir = base::FilePath("/tmp");
+ return true;
+ }
+
+ // TODO(jamescook): Refactor chrome::DIR_CRASH_DUMPS into //components/crash
+ // and use it here.
+ *crash_dir = base::FilePath("/var/log/chrome/Crash Reports");
+ DCHECK(base::PathExists(*crash_dir));
+ return true;
+}
+
+size_t MashCrashReporterClient::RegisterCrashKeys() {
+ // Register keys used by non-browser processes launched by the service manager
+ // (e.g. the GPU service). See chrome/common/crash_keys.cc.
+ std::vector<base::debug::CrashKey> keys = {
+ {"url-chunk", crash_keys::kLargeSize},
+ {"total-discardable-memory-allocated", crash_keys::kSmallSize},
+ {"discardable-memory-free", crash_keys::kSmallSize},
+ };
+ crash_keys::GetCrashKeysForCommandLineSwitches(&keys);
+ return base::debug::InitCrashKeys(&keys.at(0), keys.size(),
+ crash_keys::kChunkMaxLength);
+}
+
+bool MashCrashReporterClient::IsRunningUnattended() {
+ return false;
+}
+
+bool MashCrashReporterClient::GetCollectStatsConsent() {
+#if defined(GOOGLE_CHROME_BUILD)
+ // For development on Linux desktop allow crash reporting to be forced on.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableCrashReporterForTesting)) {
+ return true;
+ }
+ // TODO(jamescook): Refactor this to share code with
+ // chrome/browser/google/google_update_settings_posix.cc.
+ base::FilePath consent_file("/home/chronos/Consent To Send Stats");
+ return base::PathExists(consent_file);
+#else
+ // Crash reporting is only supported in branded builds.
+ return false;
+#endif // defined(GOOGLE_CHROME_BUILD)
+}
« no previous file with comments | « chrome/app/mash/mash_crash_reporter_client.h ('k') | chrome/app/mash/mash_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698