chore: use emplace when possible (#37911)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
This commit is contained in:
trop[bot]
2023-04-11 21:13:01 +02:00
committed by GitHub
parent bae3380b38
commit d7d5ec5f00
4 changed files with 9 additions and 9 deletions

View File

@@ -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
}

View File

@@ -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(

View File

@@ -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;

View File

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