Commit 647f5843 authored by Bailey Berro's avatar Bailey Berro Committed by Commit Bot

Add brief comments and reorganize metrics helpers

This change adds comments to make it clear which functions are used for
reporting metrics and moves them to the bottom of the class.

Bug: chromium:757625
Change-Id: I07f82bb50df9ac77afc4d235d802c576aa326bbc
Reviewed-on: https://chromium-review.googlesource.com/1102088Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Commit-Queue: Zentaro Kavanagh <zentaro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570131}
parent 224e825b
......@@ -67,6 +67,7 @@ bool RequestedThumbnail(ProvidedFileSystemInterface::MetadataFieldMask fields) {
ProvidedFileSystemInterface::MetadataField::METADATA_FIELD_THUMBNAIL;
}
// Metrics recording.
void RecordReadDirectoryCount(int count) {
UMA_HISTOGRAM_COUNTS_100000("NativeSmbFileShare.ReadDirectoryCount", count);
}
......
......@@ -32,6 +32,7 @@ bool ContainsAt(const std::string& username) {
return username.find('@') != std::string::npos;
}
// Metric recording functions.
void RecordMountResult(SmbMountResult result) {
DCHECK_LE(result, SmbMountResult::kMaxValue);
UMA_HISTOGRAM_ENUMERATION("NativeSmbFileShare.MountResult", result);
......@@ -268,13 +269,6 @@ void SmbService::FireMountCallback(MountResponse callback,
std::move(callback).Run(result);
}
void SmbService::RecordMountCount() const {
const std::vector<ProvidedFileSystemInfo> file_systems =
GetProviderService()->GetProvidedFileSystemInfoList(provider_id_);
UMA_HISTOGRAM_COUNTS_100("NativeSmbFileShare.MountCount",
file_systems.size());
}
void SmbService::RegisterHostLocators() {
SetUpMdnsHostLocator();
}
......@@ -283,5 +277,12 @@ void SmbService::SetUpMdnsHostLocator() {
share_finder_->RegisterHostLocator(std::make_unique<MDnsHostLocator>());
}
void SmbService::RecordMountCount() const {
const std::vector<ProvidedFileSystemInfo> file_systems =
GetProviderService()->GetProvidedFileSystemInfoList(provider_id_);
UMA_HISTOGRAM_COUNTS_100("NativeSmbFileShare.MountCount",
file_systems.size());
}
} // namespace smb_client
} // namespace chromeos
......@@ -124,14 +124,15 @@ class SmbService : public KeyedService,
// Fires |callback| with |result|.
void FireMountCallback(MountResponse callback, SmbMountResult result);
void RecordMountCount() const;
// Registers host locators for |share_finder_|.
void RegisterHostLocators();
// Set up Multicast DNS host locator.
void SetUpMdnsHostLocator();
// Records metrics on the number of SMB mounts a user has.
void RecordMountCount() const;
const ProviderId provider_id_;
Profile* profile_;
std::unique_ptr<TempFileManager> temp_file_manager_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment