OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef _CRASH_REPORTER_KERNEL_COLLECTOR_H_ |
| 6 #define _CRASH_REPORTER_KERNEL_COLLECTOR_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/file_path.h" |
| 11 #include "crash-reporter/crash_collector.h" |
| 12 #include "gtest/gtest_prod.h" // for FRIEND_TEST |
| 13 |
| 14 class FilePath; |
| 15 |
| 16 // Kernel crash collector. |
| 17 class KernelCollector : public CrashCollector { |
| 18 public: |
| 19 KernelCollector(); |
| 20 |
| 21 virtual ~KernelCollector(); |
| 22 |
| 23 void OverridePreservedDumpPath(const FilePath &file_path); |
| 24 |
| 25 // Enable collection. |
| 26 bool Enable(); |
| 27 |
| 28 // Returns true if the kernel collection currently enabled. |
| 29 bool IsEnabled() { |
| 30 return is_enabled_; |
| 31 } |
| 32 |
| 33 // Collect any preserved kernel crash dump. Returns true if there was |
| 34 // a dump (even if there were problems storing the dump), false otherwise. |
| 35 bool Collect(); |
| 36 |
| 37 private: |
| 38 friend class KernelCollectorTest; |
| 39 FRIEND_TEST(KernelCollectorTest, ClearPreservedDump); |
| 40 FRIEND_TEST(KernelCollectorTest, GetKernelCrashPath); |
| 41 FRIEND_TEST(KernelCollectorTest, LoadPreservedDump); |
| 42 FRIEND_TEST(KernelCollectorTest, CollectOK); |
| 43 |
| 44 bool LoadPreservedDump(std::string *contents); |
| 45 bool ClearPreservedDump(); |
| 46 FilePath GetKernelCrashPath(const FilePath &root_crash_path, |
| 47 time_t timestamp); |
| 48 |
| 49 bool is_enabled_; |
| 50 FilePath preserved_dump_path_; |
| 51 static const char kClearingSequence[]; |
| 52 }; |
| 53 |
| 54 #endif // _CRASH_REPORTER_KERNEL_COLLECTOR_H_ |
OLD | NEW |