Avoid string_view -> string conversion for base::UmaHistogram* functions
Now that string_view is supported for these functions, we can remove a few explicit conversions. This should be a no-op. Bug: 358538894 Change-Id: I83136da3f89169ba6df49fdcbdc9568afc44f886 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5783695 Reviewed-by: Alexei Svitkine <asvitkine@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Owners-Override: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Alex Turner <alexmt@chromium.org> Cr-Commit-Position: refs/heads/main@{#1340698}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
704de59c3f
commit
0b7e4dd555
ash
system
extended_updates
input_device_settings
webui
diagnostics_ui
chrome/browser/ui/views/download/bubble
components/safe_search_api
content/browser/private_aggregation
media/mojo/services
@ -11,14 +11,12 @@
|
||||
namespace ash {
|
||||
|
||||
void RecordExtendedUpdatesDialogEvent(ExtendedUpdatesDialogEvent event) {
|
||||
base::UmaHistogramEnumeration(std::string(kExtendedUpdatesDialogEventMetric),
|
||||
event);
|
||||
base::UmaHistogramEnumeration(kExtendedUpdatesDialogEventMetric, event);
|
||||
}
|
||||
|
||||
void RecordExtendedUpdatesEntryPointEvent(
|
||||
ExtendedUpdatesEntryPointEvent event) {
|
||||
base::UmaHistogramEnumeration(
|
||||
std::string(kExtendedUpdatesEntryPointEventMetric), event);
|
||||
base::UmaHistogramEnumeration(kExtendedUpdatesEntryPointEventMetric, event);
|
||||
}
|
||||
|
||||
} // namespace ash
|
||||
|
@ -222,8 +222,7 @@ void KeyboardModifierMetricsRecorder::RecordModifierRemappingHash() {
|
||||
// If the computed hash matches the hash when settings are in a default state,
|
||||
// the metric should not be published.
|
||||
if (hash != kDefaultModifierHash) {
|
||||
base::UmaHistogramSparse(std::string(kModifierMetricHash),
|
||||
static_cast<int>(hash));
|
||||
base::UmaHistogramSparse(kModifierMetricHash, static_cast<int>(hash));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ void EmitScreenOpenDuration(const NavigationView screen,
|
||||
return;
|
||||
}
|
||||
|
||||
base::UmaHistogramLongTimes100(std::string(iter->second), time_elapsed);
|
||||
base::UmaHistogramLongTimes100(iter->second, time_elapsed);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -57,7 +57,7 @@ DownloadBubblePrimaryView::~DownloadBubblePrimaryView() = default;
|
||||
void DownloadBubblePrimaryView::LogVisibleTimeMetrics() const {
|
||||
std::string_view histogram_name = GetVisibleTimeHistogramName();
|
||||
if (!histogram_name.empty()) {
|
||||
base::UmaHistogramMediumTimes(std::string(histogram_name),
|
||||
base::UmaHistogramMediumTimes(histogram_name,
|
||||
base::Time::Now() - creation_time_);
|
||||
}
|
||||
}
|
||||
|
@ -86,19 +86,19 @@ bool URLChecker::CheckURL(const GURL& url, CheckCallback callback) {
|
||||
<< " safe; certain: " << !result.uncertain;
|
||||
std::move(callback).Run(url, result.classification, result.uncertain);
|
||||
|
||||
base::UmaHistogramEnumeration(std::string(kCacheHitMetricKey),
|
||||
base::UmaHistogramEnumeration(kCacheHitMetricKey,
|
||||
CacheAccessStatus::kHit);
|
||||
return true;
|
||||
}
|
||||
DVLOG(1) << "Outdated cache entry for " << url.spec() << ", purging";
|
||||
cache_.Erase(cache_it);
|
||||
base::UmaHistogramEnumeration(std::string(kCacheHitMetricKey),
|
||||
base::UmaHistogramEnumeration(kCacheHitMetricKey,
|
||||
CacheAccessStatus::kOutdated);
|
||||
MaybeScheduleAsyncCheck(url, std::move(callback));
|
||||
return false;
|
||||
}
|
||||
|
||||
base::UmaHistogramEnumeration(std::string(kCacheHitMetricKey),
|
||||
base::UmaHistogramEnumeration(kCacheHitMetricKey,
|
||||
CacheAccessStatus::kNotFound);
|
||||
MaybeScheduleAsyncCheck(url, std::move(callback));
|
||||
return false;
|
||||
|
@ -107,7 +107,7 @@ void RecordNumberOfContributionMergeKeysHistogram(
|
||||
constexpr std::string_view kMergeKeysHistogramBase =
|
||||
"PrivacySandbox.PrivateAggregation.Host.NumContributionMergeKeysInPipe";
|
||||
|
||||
base::UmaHistogramCounts10000(std::string(kMergeKeysHistogramBase),
|
||||
base::UmaHistogramCounts10000(kMergeKeysHistogramBase,
|
||||
num_merge_keys_sent_or_truncated);
|
||||
switch (api) {
|
||||
case PrivateAggregationBudgetKey::Api::kProtectedAudience:
|
||||
|
@ -30,8 +30,7 @@ static void RecordWatchTimeInternal(
|
||||
base::TimeDelta value,
|
||||
base::TimeDelta minimum = kMinimumElapsedWatchTime) {
|
||||
DCHECK(!key.empty());
|
||||
base::UmaHistogramCustomTimes(std::string(key), value, minimum,
|
||||
base::Hours(10), 50);
|
||||
base::UmaHistogramCustomTimes(key, value, minimum, base::Hours(10), 50);
|
||||
}
|
||||
|
||||
static void RecordMeanTimeBetweenRebuffers(std::string_view key,
|
||||
@ -46,13 +45,13 @@ static void RecordMeanTimeBetweenRebuffers(std::string_view key,
|
||||
static void RecordDiscardedWatchTime(std::string_view key,
|
||||
base::TimeDelta value) {
|
||||
DCHECK(!key.empty());
|
||||
base::UmaHistogramCustomTimes(std::string(key), value, base::TimeDelta(),
|
||||
base::UmaHistogramCustomTimes(key, value, base::TimeDelta(),
|
||||
kMinimumElapsedWatchTime, 50);
|
||||
}
|
||||
|
||||
static void RecordRebuffersCount(std::string_view key, int underflow_count) {
|
||||
DCHECK(!key.empty());
|
||||
base::UmaHistogramCounts100(std::string(key), underflow_count);
|
||||
base::UmaHistogramCounts100(key, underflow_count);
|
||||
}
|
||||
|
||||
WatchTimeRecorder::WatchTimeUkmRecord::WatchTimeUkmRecord(
|
||||
|
Reference in New Issue
Block a user