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

Unified Diff: user_collector.cc

Issue 2868032: Remove source from crash-reporter and crash-dumper as they are no longer necessary. (Closed) Base URL: ssh://git@chromiumos-git//crash.git
Patch Set: Created 10 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 | « user_collector.h ('k') | user_collector_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: user_collector.cc
diff --git a/user_collector.cc b/user_collector.cc
deleted file mode 100644
index 7033ada1133c586c9b5f30988bc542a8bd4cca05..0000000000000000000000000000000000000000
--- a/user_collector.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// 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.
-
-#include <string>
-
-#include "base/file_util.h"
-#include "base/logging.h"
-#include "base/string_util.h"
-#include "crash/user_collector.h"
-#include "metrics/metrics_library.h"
-
-// This procfs file is used to cause kernel core file writing to
-// instead pipe the core file into a user space process. See
-// core(5) man page.
-static const char kCorePatternFile[] = "/proc/sys/kernel/core_pattern";
-
-UserCollector::UserCollector()
- : core_pattern_file_(kCorePatternFile),
- count_crash_function_(NULL),
- initialized_(false),
- is_feedback_allowed_function_(NULL),
- logger_(NULL) {
-}
-
-void UserCollector::Initialize(
- UserCollector::CountCrashFunction count_crash_function,
- const std::string &our_path,
- UserCollector::IsFeedbackAllowedFunction is_feedback_allowed_function,
- SystemLogging *logger) {
- CHECK(count_crash_function != NULL);
- CHECK(is_feedback_allowed_function != NULL);
- CHECK(logger != NULL);
-
- count_crash_function_ = count_crash_function;
- our_path_ = our_path;
- is_feedback_allowed_function_ = is_feedback_allowed_function;
- logger_ = logger;
- initialized_ = true;
-}
-
-UserCollector::~UserCollector() {
-}
-
-std::string UserCollector::GetPattern(bool enabled) const {
- if (enabled) {
- return StringPrintf("|%s --signal=%%s --pid=%%p --exec=%%e",
- our_path_.c_str());
- } else {
- return "core";
- }
-}
-
-bool UserCollector::SetUpInternal(bool enabled) {
- CHECK(initialized_);
- logger_->LogInfo("%s crash handling", enabled ? "Enabling" : "Disabling");
- std::string pattern = GetPattern(enabled);
- if (file_util::WriteFile(FilePath(core_pattern_file_),
- pattern.c_str(),
- pattern.length()) !=
- static_cast<int>(pattern.length())) {
- logger_->LogError("Unable to write %s", core_pattern_file_.c_str());
- return false;
- }
- return true;
-}
-
-void UserCollector::HandleCrash(int signal, int pid, const std::string &exec) {
- CHECK(initialized_);
- logger_->LogWarning("Received crash notification for %s[%d] sig %d",
- exec.c_str(), pid, signal);
-
- if (is_feedback_allowed_function_()) {
- count_crash_function_();
- }
-}
« no previous file with comments | « user_collector.h ('k') | user_collector_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698