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

Unified Diff: src/platform/crash/user_collector.h

Issue 1702008: Add crash_reporter functionality (Closed)
Patch Set: add set -e Created 10 years, 8 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 | « src/platform/crash/system_logging_mock.cc ('k') | src/platform/crash/user_collector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/crash/user_collector.h
diff --git a/src/platform/crash/user_collector.h b/src/platform/crash/user_collector.h
new file mode 100644
index 0000000000000000000000000000000000000000..7f632246ab6d33452a397735a0a0c3289f02c268
--- /dev/null
+++ b/src/platform/crash/user_collector.h
@@ -0,0 +1,62 @@
+// 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_USER_COLLECTOR_H_
+#define _CRASH_USER_COLLECTOR_H_
+
+#include <string>
+
+#include "crash/system_logging.h"
+
+class FilePath;
+
+// User crash collector.
+class UserCollector {
+ public:
+ typedef void (*CountCrashFunction)();
+ typedef bool (*IsFeedbackAllowedFunction)();
+
+ UserCollector();
+
+ // Initialize the user crash collector for detection of crashes,
+ // given a crash counting function, the path to this executable,
+ // metrics collection enabled oracle, and system logger facility.
+ // Crash detection/reporting is not enabled until Enable is
+ // called.
+ void Initialize(CountCrashFunction count_crash,
+ const std::string &our_path,
+ IsFeedbackAllowedFunction is_metrics_allowed,
+ SystemLogging *logger);
+
+ virtual ~UserCollector();
+
+ // Enable collection.
+ bool Enable() { return SetUpInternal(true); }
+
+ // Disable collection.
+ bool Disable() { return SetUpInternal(false); }
+
+ // Handle a specific user crash.
+ void HandleCrash(int signal, int pid, const std::string &exec);
+
+ // Set (override the default) core file pattern.
+ void set_core_pattern_file(const std::string &pattern) {
+ core_pattern_file_ = pattern;
+ }
+
+ private:
+ friend class UserCollectorTest;
+
+ std::string GetPattern(bool enabled) const;
+ bool SetUpInternal(bool enabled);
+
+ std::string core_pattern_file_;
+ CountCrashFunction count_crash_function_;
+ std::string our_path_;
+ bool initialized_;
+ IsFeedbackAllowedFunction is_feedback_allowed_function_;
+ SystemLogging *logger_;
+};
+
+#endif // _CRASH_USER_COLLECTOR_H_
« no previous file with comments | « src/platform/crash/system_logging_mock.cc ('k') | src/platform/crash/user_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698