| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_METRICS_FILE_METRICS_PROVIDER_H_ | 5 #ifndef COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ |
| 6 #define COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ | 6 #define COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // A directory of atomic PMA files. This handles a directory in which | 51 // A directory of atomic PMA files. This handles a directory in which |
| 52 // files of metrics are atomically added. Only files ending with ".pma" | 52 // files of metrics are atomically added. Only files ending with ".pma" |
| 53 // will be read. They are read according to their last-modified time and | 53 // will be read. They are read according to their last-modified time and |
| 54 // never read more that once (unless they change). Only one file will | 54 // never read more that once (unless they change). Only one file will |
| 55 // be read per reporting cycle. Filenames that start with a dot (.) or | 55 // be read per reporting cycle. Filenames that start with a dot (.) or |
| 56 // an underscore (_) are ignored so temporary files (perhaps created by | 56 // an underscore (_) are ignored so temporary files (perhaps created by |
| 57 // the ImportantFileWriter) will not get read. Files that have been | 57 // the ImportantFileWriter) will not get read. Files that have been |
| 58 // read will be attempted to be deleted; should those files not be | 58 // read will be attempted to be deleted; should those files not be |
| 59 // deletable by this process, it is the reponsibility of the producer | 59 // deletable by this process, it is the reponsibility of the producer |
| 60 // to keep the directory pruned in some manner. | 60 // to keep the directory pruned in some manner. Added files must have a |
| 61 // timestamp later (not the same or earlier) than the newest file that |
| 62 // already exists or it may be assumed to have been already uploaded. |
| 61 SOURCE_HISTOGRAMS_ATOMIC_DIR, | 63 SOURCE_HISTOGRAMS_ATOMIC_DIR, |
| 62 | 64 |
| 63 // "Active" files may be open by one or more other processes and updated | 65 // "Active" files may be open by one or more other processes and updated |
| 64 // at any time with new samples or new histograms. Such files may also be | 66 // at any time with new samples or new histograms. Such files may also be |
| 65 // inactive for any period of time only to be opened again and have new | 67 // inactive for any period of time only to be opened again and have new |
| 66 // data written to them. The file should probably never be deleted because | 68 // data written to them. The file should probably never be deleted because |
| 67 // there would be no guarantee that the data has been reported. | 69 // there would be no guarantee that the data has been reported. |
| 68 // TODO(bcwhite): Enable when read/write mem-mapped files are supported. | 70 // TODO(bcwhite): Enable when read/write mem-mapped files are supported. |
| 69 SOURCE_HISTOGRAMS_ACTIVE_FILE, | 71 SOURCE_HISTOGRAMS_ACTIVE_FILE, |
| 70 }; | 72 }; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 227 |
| 226 base::ThreadChecker thread_checker_; | 228 base::ThreadChecker thread_checker_; |
| 227 base::WeakPtrFactory<FileMetricsProvider> weak_factory_; | 229 base::WeakPtrFactory<FileMetricsProvider> weak_factory_; |
| 228 | 230 |
| 229 DISALLOW_COPY_AND_ASSIGN(FileMetricsProvider); | 231 DISALLOW_COPY_AND_ASSIGN(FileMetricsProvider); |
| 230 }; | 232 }; |
| 231 | 233 |
| 232 } // namespace metrics | 234 } // namespace metrics |
| 233 | 235 |
| 234 #endif // COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ | 236 #endif // COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ |
| OLD | NEW |