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

@ -5,9 +5,9 @@
#define ELECTRON_SHELL_RENDERER_ELECTRON_SANDBOXED_RENDERER_CLIENT_H_
#include <memory>
#include <set>
#include "shell/renderer/renderer_client_base.h"
#include "third_party/abseil-cpp/absl/container/flat_hash_set.h"
namespace base {
class ProcessMetrics;
@ -64,7 +64,7 @@ class ElectronSandboxedRendererClient : public RendererClientBase {
// Getting main script context from web frame would lazily initializes
// its script context. Doing so in a web page without scripts would trigger
// assertion, so we have to keep a book of injected web frames.
std::set<content::RenderFrame*> injected_frames_;
absl::flat_hash_set<content::RenderFrame*> injected_frames_;
};
} // namespace electron