summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-12 21:53:33 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-12 21:53:33 +0000
commite53f0d679b2d9e06cf056fa80d8e5175f1ff59e2 (patch)
treee718f5ab4cd54f0e49cc2a28f4afce9ea20f865d /base
parent8266d6688589e140bf71fb862be16239880e20e6 (diff)
downloadchromium_src-e53f0d679b2d9e06cf056fa80d8e5175f1ff59e2.zip
chromium_src-e53f0d679b2d9e06cf056fa80d8e5175f1ff59e2.tar.gz
chromium_src-e53f0d679b2d9e06cf056fa80d8e5175f1ff59e2.tar.bz2
Revert "Clean up users of a deprecated base::LaunchApp API."
This reverts commit r92240, ChromeOS failures. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92244 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/process_util.h11
-rw-r--r--base/test/multiprocess_test.cc32
-rw-r--r--base/test/multiprocess_test.h16
3 files changed, 43 insertions, 16 deletions
diff --git a/base/process_util.h b/base/process_util.h
index 6820d42..a7b5aa8 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -347,6 +347,17 @@ inline bool LaunchAppAsUser(UserTokenHandle token,
BASE_API bool LaunchProcess(const std::vector<std::string>& argv,
const LaunchOptions& options);
+// TODO(evan): deprecated; change callers to use LaunchProcess, remove.
+inline bool LaunchApp(const std::vector<std::string>& argv,
+ const file_handle_mapping_vector& fds_to_remap,
+ bool wait, ProcessHandle* process_handle) {
+ LaunchOptions options;
+ options.fds_to_remap = &fds_to_remap;
+ options.wait = wait;
+ options.process_handle = process_handle;
+ return LaunchProcess(argv, options);
+}
+
// AlterEnvironment returns a modified environment vector, constructed from the
// given environment and the list of changes given in |changes|. Each key in
// the environment is matched against the first element of the pairs. In the
diff --git a/base/test/multiprocess_test.cc b/base/test/multiprocess_test.cc
index c691b5f..a1a3bbe 100644
--- a/base/test/multiprocess_test.cc
+++ b/base/test/multiprocess_test.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,8 +19,12 @@ MultiProcessTest::MultiProcessTest() {
ProcessHandle MultiProcessTest::SpawnChild(const std::string& procname,
bool debug_on_start) {
+#if defined(OS_WIN)
+ return SpawnChildImpl(procname, debug_on_start);
+#elif defined(OS_POSIX)
file_handle_mapping_vector empty_file_list;
return SpawnChildImpl(procname, empty_file_list, debug_on_start);
+#endif
}
#if defined(OS_POSIX)
@@ -41,20 +45,30 @@ CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname,
return cl;
}
+#if defined(OS_WIN)
+
+ProcessHandle MultiProcessTest::SpawnChildImpl(const std::string& procname,
+ bool debug_on_start) {
+ ProcessHandle handle = static_cast<ProcessHandle>(NULL);
+ LaunchApp(MakeCmdLine(procname, debug_on_start),
+ false, true, &handle);
+ return handle;
+}
+
+#elif defined(OS_POSIX)
+
+// TODO(port): with the CommandLine refactoring, this code is very similar
+// to the Windows code. Investigate whether this can be made shorter.
ProcessHandle MultiProcessTest::SpawnChildImpl(
const std::string& procname,
const file_handle_mapping_vector& fds_to_map,
bool debug_on_start) {
ProcessHandle handle = kNullProcessHandle;
- base::LaunchOptions options;
- options.process_handle = &handle;
-#if defined(OS_WIN)
- options.start_hidden = true;
-#else
- options.fds_to_remap = &fds_to_map;
-#endif
- base::LaunchProcess(MakeCmdLine(procname, debug_on_start), options);
+ LaunchApp(MakeCmdLine(procname, debug_on_start).argv(),
+ fds_to_map, false, &handle);
return handle;
}
+#endif
+
} // namespace base
diff --git a/base/test/multiprocess_test.h b/base/test/multiprocess_test.h
index bfb9e2a..af7a180 100644
--- a/base/test/multiprocess_test.h
+++ b/base/test/multiprocess_test.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -58,9 +58,6 @@ class MultiProcessTest : public PlatformTest {
ProcessHandle SpawnChild(const std::string& procname, bool debug_on_start);
#if defined(OS_POSIX)
- // TODO(evan): see if we can delete this via more refactoring.
- // SpawnChild() should just take a base::LaunchOptions so that we don't
- // need multiple versions of it.
ProcessHandle SpawnChild(const std::string& procname,
const file_handle_mapping_vector& fds_to_map,
bool debug_on_start);
@@ -71,12 +68,17 @@ class MultiProcessTest : public PlatformTest {
bool debug_on_start);
private:
- // Shared implementation of SpawnChild.
- // TODO: |fds_to_map| is unused on Windows; see above TODO about
- // further refactoring.
+#if defined(OS_WIN)
+ ProcessHandle SpawnChildImpl(const std::string& procname,
+ bool debug_on_start);
+
+#elif defined(OS_POSIX)
+ // TODO(port): with the CommandLine refactoring, this code is very similar
+ // to the Windows code. Investigate whether this can be made shorter.
ProcessHandle SpawnChildImpl(const std::string& procname,
const file_handle_mapping_vector& fds_to_map,
bool debug_on_start);
+#endif
DISALLOW_COPY_AND_ASSIGN(MultiProcessTest);
};