OLD | NEW |
---|---|
1 // Copyright 2016 The Crashpad Authors. All rights reserved. | 1 // Copyright 2016 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "handler/prune_crash_reports_thread.h" | 15 #ifndef CRASHPAD_SNAPSHOT_SNAPSHOT_CLIENT_CRASHPAD_ANNOTATIONS_WIN_H_ |
scottmg
2016/01/13 19:12:42
There's an extra SNAPSHOT_ in the guard here.
Patrick Monette
2016/01/13 22:59:40
Removed.
| |
16 #define CRASHPAD_SNAPSHOT_SNAPSHOT_CLIENT_CRASHPAD_ANNOTATIONS_WIN_H_ | |
16 | 17 |
17 #include <utility> | 18 #include <windows.h> |
18 | 19 |
19 #include "client/prune_crash_reports.h" | 20 #include <map> |
20 | 21 |
21 namespace crashpad { | 22 namespace crashpad { |
22 | 23 |
23 PruneCrashReportThread::PruneCrashReportThread( | 24 // Reads the crashpad annotations associated to |module| inside |process| and |
scottmg
2016/01/13 19:12:42
crashpad -> Crashpad. Or maybe instead, since we k
scottmg
2016/01/13 19:12:42
These need to be Doxygen-ized in Crashpad. Comment
Patrick Monette
2016/01/13 22:59:40
Done.
Patrick Monette
2016/01/13 22:59:40
Done.
| |
24 CrashReportDatabase* database, | 25 // inserts them into |annotations|. |process| requires PROCESS_QUERY_INFORMATION |
25 scoped_ptr<PruneCondition> condition) | 26 // and PROCESS_VM_READ access. On error, returns false and does not modify |
26 : thread_(60 * 60 * 24, this), | 27 // |annotations|. |
27 condition_(std::move(condition)), | 28 bool ReadCrashpadAnnotations(HANDLE process, |
28 database_(database) {} | 29 HMODULE module, |
scottmg
2016/01/13 19:12:42
Is it going to be tricky for a user to provide HMO
Patrick Monette
2016/01/13 22:59:40
Good question. Currently I was thinking about enum
| |
29 | 30 std::map<std::string, std::string>* annotations); |
scottmg
2016/01/13 19:12:42
#include <string>
Patrick Monette
2016/01/13 22:59:40
Done.
| |
30 PruneCrashReportThread::~PruneCrashReportThread() {} | |
31 | |
32 void PruneCrashReportThread::Start() { | |
33 thread_.Start(60 * 10); | |
34 } | |
35 | |
36 void PruneCrashReportThread::Stop() { | |
37 thread_.Stop(); | |
38 } | |
39 | |
40 void PruneCrashReportThread::DoWork(const WorkerThread* thread) { | |
41 PruneCrashReportDatabase(database_, condition_.get()); | |
42 } | |
43 | 31 |
44 } // namespace crashpad | 32 } // namespace crashpad |
33 | |
34 #endif // CRASHPAD_SNAPSHOT_SNAPSHOT_CLIENT_CRASHPAD_ANNOTATIONS_WIN_H_ | |
OLD | NEW |