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 #include "components/metrics/file_metrics_provider.h" | 5 #include "components/metrics/file_metrics_provider.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 const base::StringPiece prefs_key) { | 134 const base::StringPiece prefs_key) { |
135 DCHECK(thread_checker_.CalledOnValidThread()); | 135 DCHECK(thread_checker_.CalledOnValidThread()); |
136 | 136 |
137 // Ensure that kSourceOptions has been filled for this type. | 137 // Ensure that kSourceOptions has been filled for this type. |
138 DCHECK_GT(arraysize(kSourceOptions), static_cast<size_t>(type)); | 138 DCHECK_GT(arraysize(kSourceOptions), static_cast<size_t>(type)); |
139 | 139 |
140 std::unique_ptr<SourceInfo> source(new SourceInfo(type)); | 140 std::unique_ptr<SourceInfo> source(new SourceInfo(type)); |
141 source->prefs_key = prefs_key.as_string(); | 141 source->prefs_key = prefs_key.as_string(); |
142 | 142 |
143 switch (source->type) { | 143 switch (source->type) { |
| 144 case SOURCE_HISTOGRAMS_ACTIVE_FILE: |
| 145 DCHECK(prefs_key.empty()); |
| 146 // fall through |
144 case SOURCE_HISTOGRAMS_ATOMIC_FILE: | 147 case SOURCE_HISTOGRAMS_ATOMIC_FILE: |
145 case SOURCE_HISTOGRAMS_ACTIVE_FILE: | |
146 source->path = path; | 148 source->path = path; |
147 break; | 149 break; |
148 case SOURCE_HISTOGRAMS_ATOMIC_DIR: | 150 case SOURCE_HISTOGRAMS_ATOMIC_DIR: |
149 source->directory = path; | 151 source->directory = path; |
150 break; | 152 break; |
151 } | 153 } |
152 | 154 |
153 // |prefs_key| may be empty if the caller does not wish to persist the | 155 // |prefs_key| may be empty if the caller does not wish to persist the |
154 // state across instances of the program. | 156 // state across instances of the program. |
155 if (pref_service_ && !prefs_key.empty()) { | 157 if (pref_service_ && !prefs_key.empty()) { |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 // important to know how much total "jank" may be introduced. | 562 // important to know how much total "jank" may be introduced. |
561 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.Total"); | 563 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.Total"); |
562 | 564 |
563 for (std::unique_ptr<SourceInfo>& source : sources_mapped_) { | 565 for (std::unique_ptr<SourceInfo>& source : sources_mapped_) { |
564 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.File"); | 566 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.File"); |
565 MergeHistogramDeltasFromSource(source.get()); | 567 MergeHistogramDeltasFromSource(source.get()); |
566 } | 568 } |
567 } | 569 } |
568 | 570 |
569 } // namespace metrics | 571 } // namespace metrics |
OLD | NEW |