perf: prefer absl::flat_hash_set
over std::set
when sorted order is not needed (#46440)
* perf: use an absl::flat_hash_set for UsbChooserContext::ephemeral_devices_ Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use an absl::flat_hash_set for GlobalMenuBarRegistrarX11::live_windows_ Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use an absl::flat_hash_set for NativeWindowViews::forwarding_windows_ Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use an absl::flat_hash_set for OffScreenRenderWidgetHostView::guest_host_views_ perf: use an absl::flat_hash_set for OffScreenRenderWidgetHostView::proxy_views_ Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use an absl::flat_hash_set for NativeWindow::injected_frames_ Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use an absl::flat_hash_set for NativeWindow::background_throttling_sources_ Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- 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:
parent
99c3728a93
commit
5a6ed32592
7 changed files with 14 additions and 15 deletions
|
@ -6,7 +6,6 @@
|
|||
#define ELECTRON_SHELL_BROWSER_USB_USB_CHOOSER_CONTEXT_H_
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -20,6 +19,7 @@
|
|||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/device/public/mojom/usb_manager.mojom.h"
|
||||
#include "services/device/public/mojom/usb_manager_client.mojom.h"
|
||||
#include "third_party/abseil-cpp/absl/container/flat_hash_set.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
namespace mojo {
|
||||
|
@ -108,7 +108,7 @@ class UsbChooserContext : public KeyedService,
|
|||
base::queue<device::mojom::UsbDeviceManager::GetDevicesCallback>
|
||||
pending_get_devices_requests_;
|
||||
|
||||
std::map<url::Origin, std::set<std::string>> ephemeral_devices_;
|
||||
std::map<url::Origin, absl::flat_hash_set<std::string>> ephemeral_devices_;
|
||||
std::map<std::string, device::mojom::UsbDeviceInfoPtr> devices_;
|
||||
|
||||
// Connection to |device_manager_instance_|.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue