From 82442239bcfbcf68c6729524115f1d3529c43f64 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Mon, 10 Apr 2023 23:21:03 -0700 Subject: [PATCH] chore: use emplace when possible (#37877) --- shell/browser/api/electron_api_utility_process.cc | 8 ++++---- shell/browser/relauncher.cc | 4 ++-- shell/browser/relauncher_mac.cc | 4 ++-- shell/renderer/api/context_bridge/object_cache.cc | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/shell/browser/api/electron_api_utility_process.cc b/shell/browser/api/electron_api_utility_process.cc index 78b1a133cbde..8ba6dd956327 100644 --- a/shell/browser/api/electron_api_utility_process.cc +++ b/shell/browser/api/electron_api_utility_process.cc @@ -106,10 +106,10 @@ UtilityProcessWrapper::UtilityProcessWrapper( return; } if (io_handle == IOHandle::STDOUT) { - fds_to_remap.push_back(std::make_pair(pipe_fd[1], STDOUT_FILENO)); + fds_to_remap.emplace_back(pipe_fd[1], STDOUT_FILENO); stdout_read_fd_ = pipe_fd[0]; } else if (io_handle == IOHandle::STDERR) { - fds_to_remap.push_back(std::make_pair(pipe_fd[1], STDERR_FILENO)); + fds_to_remap.emplace_back(pipe_fd[1], STDERR_FILENO); stderr_read_fd_ = pipe_fd[0]; } #endif @@ -135,9 +135,9 @@ UtilityProcessWrapper::UtilityProcessWrapper( return; } if (io_handle == IOHandle::STDOUT) { - fds_to_remap.push_back(std::make_pair(devnull, STDOUT_FILENO)); + fds_to_remap.emplace_back(devnull, STDOUT_FILENO); } else if (io_handle == IOHandle::STDERR) { - fds_to_remap.push_back(std::make_pair(devnull, STDERR_FILENO)); + fds_to_remap.emplace_back(devnull, STDERR_FILENO); } #endif } diff --git a/shell/browser/relauncher.cc b/shell/browser/relauncher.cc index d357824ba30d..43921a64efb9 100644 --- a/shell/browser/relauncher.cc +++ b/shell/browser/relauncher.cc @@ -99,8 +99,8 @@ bool RelaunchAppWithHelper(const base::FilePath& helper, base::LaunchOptions options; #if BUILDFLAG(IS_POSIX) - options.fds_to_remap.push_back( - std::make_pair(pipe_write_fd.get(), internal::kRelauncherSyncFD)); + options.fds_to_remap.emplace_back(pipe_write_fd.get(), + internal::kRelauncherSyncFD); base::Process process = base::LaunchProcess(relaunch_argv, options); #elif BUILDFLAG(IS_WIN) base::Process process = base::LaunchProcess( diff --git a/shell/browser/relauncher_mac.cc b/shell/browser/relauncher_mac.cc index c46cec6aa5cd..d18baadfb2ee 100644 --- a/shell/browser/relauncher_mac.cc +++ b/shell/browser/relauncher_mac.cc @@ -82,8 +82,8 @@ int LaunchProgram(const StringVector& relauncher_args, base::LaunchOptions options; options.new_process_group = true; // detach - options.fds_to_remap.push_back(std::make_pair(devnull.get(), STDERR_FILENO)); - options.fds_to_remap.push_back(std::make_pair(devnull.get(), STDOUT_FILENO)); + options.fds_to_remap.emplace_back(devnull.get(), STDERR_FILENO); + options.fds_to_remap.emplace_back(devnull.get(), STDOUT_FILENO); base::Process process = base::LaunchProcess(argv, options); return process.IsValid() ? 0 : 1; diff --git a/shell/renderer/api/context_bridge/object_cache.cc b/shell/renderer/api/context_bridge/object_cache.cc index 47870fd95ec7..5685ff63bf96 100644 --- a/shell/renderer/api/context_bridge/object_cache.cc +++ b/shell/renderer/api/context_bridge/object_cache.cc @@ -19,7 +19,7 @@ void ObjectCache::CacheProxiedObject(v8::Local from, auto obj = from.As(); int hash = obj->GetIdentityHash(); - proxy_map_[hash].push_front(std::make_pair(from, proxy_value)); + proxy_map_[hash].emplace_front(from, proxy_value); } }