Commit 2148e79c authored by Chris Hall's avatar Chris Hall Committed by Commit Bot

Trivial: Language detection: prevent temporary string copies using const ref.

R=thestig,akihiroota

Change-Id: I7bf8774a761c41f602c887d1b4b4e92b9acd0f32
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2096406
Commit-Queue: Chris Hall <chrishall@chromium.org>
Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751283}
parent 780f5df7
...@@ -118,8 +118,8 @@ void AXLanguageInfoStats::GenerateTopResults() { ...@@ -118,8 +118,8 @@ void AXLanguageInfoStats::GenerateTopResults() {
} }
void AXLanguageInfoStats::RecordLabelStatistics( void AXLanguageInfoStats::RecordLabelStatistics(
std::string labelled_lang, const std::string& labelled_lang,
std::string author_lang, const std::string& author_lang,
bool labelled_with_first_result) { bool labelled_with_first_result) {
// Count the number of nodes we labelled, and the number we labelled with // Count the number of nodes we labelled, and the number we labelled with
// our highest confidence result. // our highest confidence result.
...@@ -366,7 +366,7 @@ void AXLanguageDetectionManager::LabelLanguagesForNode(AXNode* node) { ...@@ -366,7 +366,7 @@ void AXLanguageDetectionManager::LabelLanguagesForNode(AXNode* node) {
if (lang_info_stats_.CheckLanguageWithinTop(lang)) { if (lang_info_stats_.CheckLanguageWithinTop(lang)) {
lang_info->language = lang; lang_info->language = lang;
std::string author_lang = node->GetInheritedStringAttribute( const std::string& author_lang = node->GetInheritedStringAttribute(
ax::mojom::StringAttribute::kLanguage); ax::mojom::StringAttribute::kLanguage);
lang_info_stats_.RecordLabelStatistics(lang, author_lang, lang_info_stats_.RecordLabelStatistics(lang, author_lang,
labelled_with_first_result); labelled_with_first_result);
......
...@@ -133,8 +133,8 @@ class AX_EXPORT AXLanguageInfoStats { ...@@ -133,8 +133,8 @@ class AX_EXPORT AXLanguageInfoStats {
// We consider the language we labelled the node with, the language the author // We consider the language we labelled the node with, the language the author
// assigned, and whether or not we assigned our highest confidence detection // assigned, and whether or not we assigned our highest confidence detection
// result. // result.
void RecordLabelStatistics(std::string labelled_lang, void RecordLabelStatistics(const std::string& labelled_lang,
std::string author_lang, const std::string& author_lang,
bool labelled_with_first_result); bool labelled_with_first_result);
// Update metrics to reflect we attempted to detect language for a node. // Update metrics to reflect we attempted to detect language for a node.
......
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