chore: use emplace when possible (#37877)

This commit is contained in:
David Sanders 2023-04-10 23:21:03 -07:00 committed by GitHub
parent 3c0c4d5c27
commit 82442239bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 9 deletions

View file

@ -106,10 +106,10 @@ UtilityProcessWrapper::UtilityProcessWrapper(
return; return;
} }
if (io_handle == IOHandle::STDOUT) { 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]; stdout_read_fd_ = pipe_fd[0];
} else if (io_handle == IOHandle::STDERR) { } 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]; stderr_read_fd_ = pipe_fd[0];
} }
#endif #endif
@ -135,9 +135,9 @@ UtilityProcessWrapper::UtilityProcessWrapper(
return; return;
} }
if (io_handle == IOHandle::STDOUT) { 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) { } 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 #endif
} }

View file

@ -99,8 +99,8 @@ bool RelaunchAppWithHelper(const base::FilePath& helper,
base::LaunchOptions options; base::LaunchOptions options;
#if BUILDFLAG(IS_POSIX) #if BUILDFLAG(IS_POSIX)
options.fds_to_remap.push_back( options.fds_to_remap.emplace_back(pipe_write_fd.get(),
std::make_pair(pipe_write_fd.get(), internal::kRelauncherSyncFD)); internal::kRelauncherSyncFD);
base::Process process = base::LaunchProcess(relaunch_argv, options); base::Process process = base::LaunchProcess(relaunch_argv, options);
#elif BUILDFLAG(IS_WIN) #elif BUILDFLAG(IS_WIN)
base::Process process = base::LaunchProcess( base::Process process = base::LaunchProcess(

View file

@ -82,8 +82,8 @@ int LaunchProgram(const StringVector& relauncher_args,
base::LaunchOptions options; base::LaunchOptions options;
options.new_process_group = true; // detach options.new_process_group = true; // detach
options.fds_to_remap.push_back(std::make_pair(devnull.get(), STDERR_FILENO)); options.fds_to_remap.emplace_back(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(), STDOUT_FILENO);
base::Process process = base::LaunchProcess(argv, options); base::Process process = base::LaunchProcess(argv, options);
return process.IsValid() ? 0 : 1; return process.IsValid() ? 0 : 1;

View file

@ -19,7 +19,7 @@ void ObjectCache::CacheProxiedObject(v8::Local<v8::Value> from,
auto obj = from.As<v8::Object>(); auto obj = from.As<v8::Object>();
int hash = obj->GetIdentityHash(); int hash = obj->GetIdentityHash();
proxy_map_[hash].push_front(std::make_pair(from, proxy_value)); proxy_map_[hash].emplace_front(from, proxy_value);
} }
} }