Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: base/process/launch_posix.cc

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Merge Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/launch_mac.cc ('k') | base/process/launch_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/launch_posix.cc
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
index ed5ef96674a0d39caa4ca5c62d41fcd18784509d..9c769891062f784b82d6476528940544fd5f077b 100644
--- a/base/process/launch_posix.cc
+++ b/base/process/launch_posix.cc
@@ -307,15 +307,10 @@ Process LaunchProcess(const std::vector<std::string>& argv,
}
#endif
- size_t fd_shuffle_size = 0;
- if (options.fds_to_remap) {
- fd_shuffle_size = options.fds_to_remap->size();
- }
-
InjectiveMultimap fd_shuffle1;
InjectiveMultimap fd_shuffle2;
- fd_shuffle1.reserve(fd_shuffle_size);
- fd_shuffle2.reserve(fd_shuffle_size);
+ fd_shuffle1.reserve(options.fds_to_remap.size());
+ fd_shuffle2.reserve(options.fds_to_remap.size());
std::vector<char*> argv_cstr;
argv_cstr.reserve(argv.size() + 1);
@@ -455,14 +450,12 @@ Process LaunchProcess(const std::vector<std::string>& argv,
}
#endif // defined(OS_CHROMEOS)
- if (options.fds_to_remap) {
- // Cannot use STL iterators here, since debug iterators use locks.
- for (size_t i = 0; i < options.fds_to_remap->size(); ++i) {
- const FileHandleMappingVector::value_type& value =
- (*options.fds_to_remap)[i];
- fd_shuffle1.push_back(InjectionArc(value.first, value.second, false));
- fd_shuffle2.push_back(InjectionArc(value.first, value.second, false));
- }
+ // Cannot use STL iterators here, since debug iterators use locks.
+ for (size_t i = 0; i < options.fds_to_remap.size(); ++i) {
+ const FileHandleMappingVector::value_type& value =
+ options.fds_to_remap[i];
+ fd_shuffle1.push_back(InjectionArc(value.first, value.second, false));
+ fd_shuffle2.push_back(InjectionArc(value.first, value.second, false));
}
if (!options.environ.empty() || options.clear_environ)
« no previous file with comments | « base/process/launch_mac.cc ('k') | base/process/launch_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698