Commit 05564265 authored by Edwin Joe's avatar Edwin Joe Committed by Commit Bot

Added exit early in Button::SetTooltipText when the tooltip text doesn't change.

Currently, Button::SetTooltipText will always call OnTooltipTextChanged even
if the new tooltip text is the same as the old one.
With this change, it exits early if the new tooltip text doesn't change.

This reduces the time spent inside LocationBarView::RefreshContentSettingViews
from ~1 - 2.5 ms to ~0.02 - 0.06 ms since it will eventually call Button::SetTooltipText
multiple times for eachContentSettingImageView.

Bug: 933546
Change-Id: I2051a9eef19faa04898956fc172ac7bc6bc7ca9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1515641Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Edwin Joe <ejoe@google.com>
Cr-Commit-Position: refs/heads/master@{#645312}
parent 8e3c4837
...@@ -111,6 +111,8 @@ void Button::SetFocusForPlatform() { ...@@ -111,6 +111,8 @@ void Button::SetFocusForPlatform() {
} }
void Button::SetTooltipText(const base::string16& tooltip_text) { void Button::SetTooltipText(const base::string16& tooltip_text) {
if (tooltip_text == tooltip_text_)
return;
tooltip_text_ = tooltip_text; tooltip_text_ = tooltip_text;
OnSetTooltipText(tooltip_text); OnSetTooltipText(tooltip_text);
TooltipTextChanged(); TooltipTextChanged();
......
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