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

Unified Diff: chromecast/crash/linux/dummy_minidump_generator.cc

Issue 1154383006: Adding crash utilities to chromecast/crash. (Closed) Base URL: https://eureka-internal.googlesource.com/chromium/src@master
Patch Set: cast_shell_unittests not built for android Created 5 years, 6 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 | « chromecast/crash/linux/dummy_minidump_generator.h ('k') | chromecast/crash/linux/dump_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/crash/linux/dummy_minidump_generator.cc
diff --git a/chromecast/crash/linux/dummy_minidump_generator.cc b/chromecast/crash/linux/dummy_minidump_generator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b4c7caa69fc7dd3b460c89dae6bcac613e7f37c1
--- /dev/null
+++ b/chromecast/crash/linux/dummy_minidump_generator.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 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/linux/dummy_minidump_generator.h"
+
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/logging.h"
+
+namespace chromecast {
+
+DummyMinidumpGenerator::DummyMinidumpGenerator(
+ const std::string& existing_minidump_path)
+ : existing_minidump_path_(existing_minidump_path) {
+}
+
+bool DummyMinidumpGenerator::Generate(const std::string& minidump_path) {
+ base::FilePath file(existing_minidump_path_);
+ if (!base::PathExists(file)) {
+ LOG(ERROR) << file.value() << " is not a valid file path";
+ return false;
+ }
+
+ LOG(INFO) << "Moving minidump from " << existing_minidump_path_ << " to "
+ << minidump_path << " for further uploading.";
+ // Use stdlib call here to avoid potential IO restrictions on this thread.
+ if (rename(file.value().c_str(), minidump_path.c_str()) < 0) {
+ LOG(ERROR) << "Could not move file: " << file.value() << " "
+ << strerror(errno);
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace chromecast
« no previous file with comments | « chromecast/crash/linux/dummy_minidump_generator.h ('k') | chromecast/crash/linux/dump_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698