perf: avoid redundant virtual method call in NativeWindowViews::SetEnabledInternal() (#46527)

perf: avoid redundant virtual method call in NativeWindowViews::SetEnabledInternal()

Why waste time make lot call when few call do trick?

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-04-07 10:40:10 -05:00 committed by GitHub
parent 64c9afcf77
commit ec34d8ee49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -623,11 +623,8 @@ bool NativeWindowViews::ShouldBeEnabled() const {
}
void NativeWindowViews::SetEnabledInternal(bool enable) {
if (enable && IsEnabled()) {
if (enable == IsEnabled())
return;
} else if (!enable && !IsEnabled()) {
return;
}
#if BUILDFLAG(IS_WIN)
::EnableWindow(GetAcceleratedWidget(), enable);