From ec34d8ee49d32fb7eefeaf51fc9ac471213b6f9c Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 10:40:10 -0500 Subject: [PATCH] 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 --- 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 e802bd6152ec..5b6fda2a6d41 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);