Index: src/platform/crash/crash_dumper.h |
diff --git a/src/platform/crash/crash_dumper.h b/src/platform/crash/crash_dumper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4dafbeb00f462ac000e1f31f87d95061b6d80018 |
--- /dev/null |
+++ b/src/platform/crash/crash_dumper.h |
@@ -0,0 +1,46 @@ |
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CRASH_CRASH_DUMPER_H_ |
+#define CRASH_CRASH_DUMPER_H_ |
+ |
+#include <string> |
+ |
+#include "base/scoped_ptr.h" |
+ |
+namespace google_breakpad { |
+class ExceptionHandler; |
+} |
+ |
+class FilePath; |
+ |
+// Class to manage crash handling and dumping. When Enable is called, all |
+// crashes will be caught and stored to the appropriate crash directory. |
+// The directory will be: |
+// /home/chronos/user/crash - for all processes running as chronos |
+// /var/spool/crash - for all other processes |
+// The class takes care of creating the directories (even recreating them |
+// at crash time in case the cryptohome mounting changes from Enable time. |
+ |
+class CrashDumper { |
+ public: |
+ ~CrashDumper() { |
+ if (IsEnabled()) { |
+ Disable(); |
+ } |
+ } |
+ |
+ // Enable crash detection and dumping. Aborts if already enabled |
+ // or crash reporting cannot be enabled. If the cryptohome is mounted |
+ // while crash handling is enabled, later crashes may be lost. |
+ static void Enable(); |
+ |
+ // Return if enabled. |
+ static bool IsEnabled(); |
+ |
+ // Disable crash detection and dumping. Aborts if not enabled. |
+ static void Disable(); |
+}; |
+ |
+#endif // CRASH_CRASH_DUMPER_H_ |