perf: prefer absl::flat_hash_set over std::set when sorted order is not needed (#46410)

* perf: use an absl::flat_hash_set for UsbChooserContext::ephemeral_devices_

* perf: use an absl::flat_hash_set for GlobalMenuBarRegistrarX11::live_windows_

* perf: use an absl::flat_hash_set for NativeWindowViews::forwarding_windows_

* perf: use an absl::flat_hash_set for OffScreenRenderWidgetHostView::guest_host_views_

perf: use an absl::flat_hash_set for OffScreenRenderWidgetHostView::proxy_views_

* perf: use an absl::flat_hash_set for NativeWindow::injected_frames_

* perf: use an absl::flat_hash_set for NativeWindow::background_throttling_sources_
This commit is contained in:
Charles Kerr 2025-04-02 11:03:36 -05:00 committed by GitHub
parent 36e233797c
commit 6f24dbaab4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 14 additions and 15 deletions

View file

@ -9,11 +9,11 @@
#include <memory>
#include <optional>
#include <set>
#include <string>
#include "base/memory/raw_ptr.h"
#include "shell/browser/ui/views/root_view.h"
#include "third_party/abseil-cpp/absl/container/flat_hash_set.h"
#include "ui/base/ozone_buildflags.h"
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
#include "ui/views/widget/widget_observer.h"
@ -283,7 +283,7 @@ class NativeWindowViews : public NativeWindow,
base::win::ScopedGDIObject<HICON> app_icon_;
// The set of windows currently forwarding mouse messages.
static std::set<NativeWindowViews*> forwarding_windows_;
static inline absl::flat_hash_set<NativeWindowViews*> forwarding_windows_;
static HHOOK mouse_hook_;
bool forwarding_mouse_messages_ = false;
HWND legacy_window_ = nullptr;