OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_TOOLS_CRASH_SERVICE_CRASH_SERVICE_H_ | 5 #ifndef COMPONENTS_BREAKPAD_TOOLS_CRASH_SERVICE_H_ |
6 #define CHROME_TOOLS_CRASH_SERVICE_CRASH_SERVICE_H_ | 6 #define COMPONENTS_BREAKPAD_TOOLS_CRASH_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 | 13 |
14 namespace google_breakpad { | 14 namespace google_breakpad { |
15 | 15 |
16 class CrashReportSender; | 16 class CrashReportSender; |
17 class CrashGenerationServer; | 17 class CrashGenerationServer; |
18 class ClientInfo; | 18 class ClientInfo; |
19 | 19 |
20 } | 20 } |
21 | 21 |
| 22 namespace breakpad { |
| 23 |
22 // This class implements an out-of-process crash server. It uses breakpad's | 24 // This class implements an out-of-process crash server. It uses breakpad's |
23 // CrashGenerationServer and CrashReportSender to generate and then send the | 25 // CrashGenerationServer and CrashReportSender to generate and then send the |
24 // crash dumps. Internally, it uses OS specific pipe to allow applications to | 26 // crash dumps. Internally, it uses OS specific pipe to allow applications to |
25 // register for crash dumps and later on when a registered application crashes | 27 // register for crash dumps and later on when a registered application crashes |
26 // it will signal an event that causes this code to wake up and perform a | 28 // it will signal an event that causes this code to wake up and perform a |
27 // crash dump on the signaling process. The dump is then stored on disk and | 29 // crash dump on the signaling process. The dump is then stored on disk and |
28 // possibly sent to the crash2 servers. | 30 // possibly sent to the crash2 servers. |
29 class CrashService { | 31 class CrashService { |
30 public: | 32 public: |
31 // The ctor takes a directory that needs to be writable and will create | 33 CrashService(); |
32 // a subdirectory inside to keep logs, crashes and checkpoint files. | |
33 explicit CrashService(const std::wstring& report_dir); | |
34 ~CrashService(); | 34 ~CrashService(); |
35 | 35 |
36 // Starts servicing crash dumps. The command_line specifies various behaviors, | 36 // Starts servicing crash dumps. Returns false if it failed. Do not use |
37 // see below for more information. Returns false if it failed. Do not use | 37 // other members in that case. |operating_dir| is where the CrashService |
38 // other members in that case. | 38 // should store breakpad's checkpoint file. |dumps_path| is the directory |
39 bool Initialize(const std::wstring& command_line); | 39 // where the crash dumps should be stored. |
| 40 bool Initialize(const base::FilePath& operating_dir, |
| 41 const base::FilePath& dumps_path); |
40 | 42 |
41 // Command line switches: | 43 // Command line switches: |
42 // | 44 // |
43 // --max-reports=<number> | 45 // --max-reports=<number> |
44 // Allows to override the maximum number for reports per day. Normally | 46 // Allows to override the maximum number for reports per day. Normally |
45 // the crash dumps are never sent so if you want to send any you must | 47 // the crash dumps are never sent so if you want to send any you must |
46 // specify a positive number here. | 48 // specify a positive number here. |
47 static const char kMaxReports[]; | 49 static const char kMaxReports[]; |
48 // --no-window | 50 // --no-window |
49 // Does not create a visible window on the desktop. The window does not have | 51 // Does not create a visible window on the desktop. The window does not have |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // clients serviced statistics: | 115 // clients serviced statistics: |
114 int requests_handled_; | 116 int requests_handled_; |
115 int requests_sent_; | 117 int requests_sent_; |
116 volatile long clients_connected_; | 118 volatile long clients_connected_; |
117 volatile long clients_terminated_; | 119 volatile long clients_terminated_; |
118 base::Lock sending_; | 120 base::Lock sending_; |
119 | 121 |
120 DISALLOW_COPY_AND_ASSIGN(CrashService); | 122 DISALLOW_COPY_AND_ASSIGN(CrashService); |
121 }; | 123 }; |
122 | 124 |
123 #endif // CHROME_TOOLS_CRASH_SERVICE_CRASH_SERVICE_H_ | 125 } // namespace breakpad |
| 126 |
| 127 #endif // COMPONENTS_BREAKPAD_TOOLS_CRASH_SERVICE_H_ |
OLD | NEW |