mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
perf: use absl::flat_hash_map instead of std::unordered_map (#46202)
* perf: make ElectronUsbDelegate::controller_map_ an absl::flat_hash_map * perf: make ElectronSerialDelegate::controller_map_ an absl::flat_hash_map * perf: make ElectronHidDelegate::controller_map_ an absl::flat_hash_map * perf: make FrameTreeNodeIdMap an absl::flat_hash_map * perf: make AutofillDriverFactory::driver_map_ an absl::flat_hash_map * perf: make asar::Archive::external_files_ an absl::flat_hash_map * perf: make VersionIdMap an absl::flat_hash_map * perf: make ObjectCache::proxy_map_ an absl::flat_hash_map * docs: add TODO to investigate absl map in KeyWeakMap
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include "shell/browser/api/electron_api_service_worker_main.h"
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
@@ -28,6 +27,7 @@
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/v8_util.h"
|
||||
#include "third_party/abseil-cpp/absl/container/flat_hash_map.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -58,10 +58,9 @@ std::optional<content::ServiceWorkerVersionBaseInfo> GetLiveVersionInfo(
|
||||
namespace electron::api {
|
||||
|
||||
// ServiceWorkerKey -> ServiceWorkerMain*
|
||||
typedef std::unordered_map<ServiceWorkerKey,
|
||||
ServiceWorkerMain*,
|
||||
ServiceWorkerKey::Hasher>
|
||||
VersionIdMap;
|
||||
using VersionIdMap = absl::flat_hash_map<ServiceWorkerKey,
|
||||
ServiceWorkerMain*,
|
||||
ServiceWorkerKey::Hasher>;
|
||||
|
||||
VersionIdMap& GetVersionIdMap() {
|
||||
static base::NoDestructor<VersionIdMap> instance;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "shell/browser/api/electron_api_web_frame_main.h"
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -36,6 +35,7 @@
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/v8_util.h"
|
||||
#include "third_party/abseil-cpp/absl/container/flat_hash_map.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace electron::api {
|
||||
// Using FrameTreeNode allows us to track frame across navigations. This
|
||||
// is most similar to how <iframe> works.
|
||||
using FrameTreeNodeIdMap =
|
||||
std::unordered_map<content::FrameTreeNodeId, WebFrameMain*>;
|
||||
absl::flat_hash_map<content::FrameTreeNodeId, WebFrameMain*>;
|
||||
|
||||
// Token -> WebFrameMain*
|
||||
// Maps exact RFH to a WebFrameMain instance.
|
||||
|
||||
Reference in New Issue
Block a user