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

Unified Diff: crash_collector.h

Issue 3436029: crash-reporter: Send OS version at time of crash and related improvements (Closed) Base URL: http://git.chromium.org/git/crash-reporter.git
Patch Set: respond to petkov review Created 10 years, 3 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 | « no previous file | crash_collector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crash_collector.h
diff --git a/crash_collector.h b/crash_collector.h
index a75d791489fdcff4eb4db7f9769c7f5b93e49866..730a8e76183c0ca32dd575f6b68515c99036ab4d 100644
--- a/crash_collector.h
+++ b/crash_collector.h
@@ -5,9 +5,11 @@
#ifndef _CRASH_REPORTER_CRASH_COLLECTOR_H_
#define _CRASH_REPORTER_CRASH_COLLECTOR_H_
-#include <string>
#include <sys/stat.h>
+#include <map>
+#include <string>
+
#include "gtest/gtest_prod.h" // for FRIEND_TEST
class FilePath;
@@ -32,15 +34,22 @@ class CrashCollector {
protected:
friend class CrashCollectorTest;
- FRIEND_TEST(CrashCollectorTest, CheckHasCapacityOverCore);
- FRIEND_TEST(CrashCollectorTest, CheckHasCapacityOverNonCore);
+ FRIEND_TEST(CrashCollectorTest, CheckHasCapacityCorrectBasename);
+ FRIEND_TEST(CrashCollectorTest, CheckHasCapacityStrangeNames);
+ FRIEND_TEST(CrashCollectorTest, CheckHasCapacityUsual);
FRIEND_TEST(CrashCollectorTest, GetCrashDirectoryInfo);
FRIEND_TEST(CrashCollectorTest, FormatDumpBasename);
FRIEND_TEST(CrashCollectorTest, Initialize);
+ FRIEND_TEST(CrashCollectorTest, ReadKeyValueFile);
+ FRIEND_TEST(CrashCollectorTest, Sanitize);
// Set maximum enqueued crashes in a crash directory.
static const int kMaxCrashDirectorySize;
+ // Return a filename that has only [a-z0-1_] characters by mapping
+ // all others into '_'.
+ std::string Sanitize(const std::string &name);
+
// For testing, set the directory always returned by
// GetCreatedCrashDirectoryByEuid.
void ForceCrashDirectory(const char *forced_directory) {
@@ -72,6 +81,16 @@ class CrashCollector {
// crash.
bool CheckHasCapacity(const FilePath &crash_directory);
+ // Read the given file of form [<key><separator><value>\n...] and return
+ // a map of its contents.
+ bool ReadKeyValueFile(const FilePath &file,
+ char separator,
+ std::map<std::string, std::string> *dictionary);
+
+ // Write a file of metadata about crash.
+ void WriteCrashMetaData(const FilePath &meta_path,
+ const std::string &exec_name);
+
CountCrashFunction count_crash_function_;
IsFeedbackAllowedFunction is_feedback_allowed_function_;
SystemLogging *logger_;
« no previous file with comments | « no previous file | crash_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698