OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 COMPONENTS_BROWSER_WATCHER_STABILITY_PATHS_H_ | 5 #ifndef COMPONENTS_BROWSER_WATCHER_STABILITY_PATHS_H_ |
6 #define COMPONENTS_BROWSER_WATCHER_STABILITY_PATHS_H_ | 6 #define COMPONENTS_BROWSER_WATCHER_STABILITY_PATHS_H_ |
7 | 7 |
| 8 #include <set> |
| 9 #include <vector> |
| 10 |
8 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
9 #include "base/process/process.h" | 12 #include "base/process/process.h" |
10 #include "build/build_config.h" | 13 #include "build/build_config.h" |
11 | 14 |
12 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
13 #include <winsock2.h> | 16 #include <winsock2.h> |
14 #endif // defined(OS_WIN) | 17 #endif // defined(OS_WIN) |
15 | 18 |
16 namespace browser_watcher { | 19 namespace browser_watcher { |
17 | 20 |
(...skipping 10 matching lines...) Expand all Loading... |
28 | 31 |
29 // On success, returns true and |path| contains the path to the stability file. | 32 // On success, returns true and |path| contains the path to the stability file. |
30 // On failure, returns false. | 33 // On failure, returns false. |
31 bool GetStabilityFileForProcess(const base::Process& process, | 34 bool GetStabilityFileForProcess(const base::Process& process, |
32 const base::FilePath& user_data_dir, | 35 const base::FilePath& user_data_dir, |
33 base::FilePath* path); | 36 base::FilePath* path); |
34 | 37 |
35 // Returns a pattern that matches file names returned by GetFileForProcess. | 38 // Returns a pattern that matches file names returned by GetFileForProcess. |
36 base::FilePath::StringType GetStabilityFilePattern(); | 39 base::FilePath::StringType GetStabilityFilePattern(); |
37 | 40 |
| 41 // Returns files in |stability_dir| that match |stability_file_pattern|, |
| 42 // excluding those in |excluded_stability_files|. |
| 43 std::vector<base::FilePath> GetStabilityFiles( |
| 44 const base::FilePath& stability_dir, |
| 45 const base::FilePath::StringType& stability_file_pattern, |
| 46 const std::set<base::FilePath>& excluded_stability_files); |
| 47 |
38 // Sets the current process's stability file's state to deleted (via the | 48 // Sets the current process's stability file's state to deleted (via the |
39 // GlobalActivityTracker) and opens the file for deletion. Metrics pertaining to | 49 // GlobalActivityTracker) and opens the file for deletion. Metrics pertaining to |
40 // stability recording are logged. | 50 // stability recording are logged. |
41 void MarkOwnStabilityFileDeleted(const base::FilePath& user_data_dir); | 51 void MarkOwnStabilityFileDeleted(const base::FilePath& user_data_dir); |
42 | 52 |
43 // Sets another process's stability file's state to deleted, then opens it for | 53 // Sets another process's stability file's state to deleted, then opens it for |
44 // deletion. This function is meant for use by the crashpad handler; it logs | 54 // deletion. This function is meant for use by the crashpad handler; it logs |
45 // metrics labelled as in the context of crash collection. | 55 // metrics labelled as in the context of crash collection. |
46 void MarkStabilityFileDeletedOnCrash(const base::FilePath& file_path); | 56 void MarkStabilityFileDeletedOnCrash(const base::FilePath& file_path); |
47 | 57 |
48 #endif // defined(OS_WIN) | 58 #endif // defined(OS_WIN) |
49 | 59 |
50 } // namespace browser_watcher | 60 } // namespace browser_watcher |
51 | 61 |
52 #endif // COMPONENTS_BROWSER_WATCHER_STABILITY_PATHS_H_ | 62 #endif // COMPONENTS_BROWSER_WATCHER_STABILITY_PATHS_H_ |
OLD | NEW |