From e76f986aa945ab497161912f5e44b6343df1263a Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Sun, 6 Apr 2025 23:44:37 -0500 Subject: [PATCH] perf: avoid redundant virtual method call in `NativeWindowViews::SetEnabledInternal()` (#46526) 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 --- shell/browser/native_window_views.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index e1756a6a8cee..ea557ffb44ec 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -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);