Commit e14f7ce9 authored by Xinghui Lu's avatar Xinghui Lu Committed by Commit Bot

Replace std::map with base::flat_map in safe browsing services_delegate

Pros: Good memory locality, low overhead especially for smaller maps.
Cons: Inserts and removals are O(n). But since the keys are profiles,
there shouldn't be too many insert and remove operations.

Bug: 995926
Change-Id: I2b26d5ebeba3c12732c3ad71a772afaa0262cf08
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845577Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Commit-Queue: Xinghui Lu <xinghuilu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703801}
parent 1173223d
......@@ -148,16 +148,16 @@ class ServicesDelegate {
// Unowned pointer
ServicesCreator* const services_creator_;
// TODO(xinghuilu@): Change it to base::map<>
// Tracks existing Profiles, and their corresponding
// ChromePasswordProtectionService instances.
// Accessed on UI thread.
std::map<Profile*, std::unique_ptr<ChromePasswordProtectionService>>
base::flat_map<Profile*, std::unique_ptr<ChromePasswordProtectionService>>
password_protection_service_map_;
// Tracks existing Profiles, and their corresponding VerdictCacheManager
// instances. Accessed on UI thread.
std::map<Profile*, std::unique_ptr<VerdictCacheManager>> cache_manager_map_;
base::flat_map<Profile*, std::unique_ptr<VerdictCacheManager>>
cache_manager_map_;
};
} // namespace safe_browsing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment