refactor: use std::map::try_emplace()
over std::map::insert()
(#46761)
refactor: prefer std::map::try_emplace() over std::map::insert()
This commit is contained in:
parent
8fa7d324d1
commit
b40b4dc015
10 changed files with 15 additions and 21 deletions
|
@ -94,8 +94,7 @@ AutofillDriver* AutofillDriverFactory::DriverForFrame(
|
|||
void AutofillDriverFactory::AddDriverForFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
CreationCallback factory_method) {
|
||||
auto insertion_result =
|
||||
driver_map_.insert(std::make_pair(render_frame_host, nullptr));
|
||||
auto insertion_result = driver_map_.try_emplace(render_frame_host, nullptr);
|
||||
// This can be called twice for the key representing the main frame.
|
||||
if (insertion_result.second) {
|
||||
insertion_result.first->second = std::move(factory_method).Run();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue