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

Unified Diff: base/multiprocess_test.h

Issue 14497: POSIX: don't leak FDs when launching child Processes. (Closed)
Patch Set: Fix Windows Compilation Created 12 years 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/base.xcodeproj/project.pbxproj ('k') | base/process_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/multiprocess_test.h
diff --git a/base/multiprocess_test.h b/base/multiprocess_test.h
index a9c67d5faec9834f115c41b581dbe25b2f26e933..535e13e8cbba0f6e5794db001b451deb4a44ec31 100644
--- a/base/multiprocess_test.h
+++ b/base/multiprocess_test.h
@@ -66,10 +66,31 @@ class MultiProcessTest : public PlatformTest {
base::ProcessHandle SpawnChild(const std::wstring& procname,
bool debug_on_start) {
- CommandLine cl;
- base::ProcessHandle handle = static_cast<base::ProcessHandle>(NULL);
+#if defined(OS_WIN)
+ return SpawnChildImpl(procname, false);
+#elif defined(OS_POSIX)
+ base::file_handle_mapping_vector empty_file_list;
+ return SpawnChildImpl(procname, empty_file_list, false);
+#endif
+ }
+
+#if defined(OS_POSIX)
+ base::ProcessHandle SpawnChild(
+ const std::wstring& procname,
+ const base::file_handle_mapping_vector& fds_to_map,
+ bool debug_on_start) {
+ return SpawnChildImpl(procname, fds_to_map, false);
+ }
+
+#endif
+ private:
#if defined(OS_WIN)
+ base::ProcessHandle SpawnChildImpl(
+ const std::wstring& procname,
+ bool debug_on_start) {
+ CommandLine cl;
+ base::ProcessHandle handle = static_cast<base::ProcessHandle>(NULL);
std::wstring clstr = cl.command_line_string();
CommandLine::AppendSwitchWithValue(&clstr, kRunClientProcess, procname);
@@ -78,7 +99,16 @@ class MultiProcessTest : public PlatformTest {
}
base::LaunchApp(clstr, false, true, &handle);
+ return handle;
+ }
#elif defined(OS_POSIX)
+ base::ProcessHandle SpawnChildImpl(
+ const std::wstring& procname,
+ const base::file_handle_mapping_vector& fds_to_map,
+ bool debug_on_start) {
+ CommandLine cl;
+ base::ProcessHandle handle = static_cast<base::ProcessHandle>(NULL);
+
std::vector<std::string> clvec(cl.argv());
std::wstring wswitchstr =
CommandLine::PrefixedSwitchStringWithValue(kRunClientProcess,
@@ -89,11 +119,10 @@ class MultiProcessTest : public PlatformTest {
std::string switchstr = WideToUTF8(wswitchstr);
clvec.push_back(switchstr.c_str());
- base::LaunchApp(clvec, false, &handle);
-#endif
-
+ base::LaunchApp(clvec, fds_to_map, false, &handle);
return handle;
}
+#endif
};
#endif // BASE_MULTIPROCESS_TEST_H__
« no previous file with comments | « base/base.xcodeproj/project.pbxproj ('k') | base/process_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698