summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvargas <rvargas@chromium.org>2014-12-12 16:34:29 -0800
committerrvargas <rvargas@chromium.org>2014-12-13 00:35:29 +0000
commitac3c4b6c6a0732560b641e2884db9cfc2cc85259 (patch)
treeee4028c33a745ea2effc4ed91002ca9195602959
parent304529e882cd79826c1b8f222a0e855da2ba8a59 (diff)
downloadchromium_src-ac3c4b6c6a0732560b641e2884db9cfc2cc85259.zip
chromium_src-ac3c4b6c6a0732560b641e2884db9cfc2cc85259.tar.gz
chromium_src-ac3c4b6c6a0732560b641e2884db9cfc2cc85259.tar.bz2
Update net to use the new version of LaunchProcess.
BUG=417532 R=rtenneti@chromium.org Review URL: https://codereview.chromium.org/793463002 Cr-Commit-Position: refs/heads/master@{#308205}
-rw-r--r--net/disk_cache/blockfile/stress_cache.cc7
-rw-r--r--net/test/spawned_test_server/local_test_server.cc10
-rw-r--r--net/test/spawned_test_server/local_test_server.h6
-rw-r--r--net/test/spawned_test_server/local_test_server_posix.cc3
-rw-r--r--net/test/spawned_test_server/local_test_server_win.cc3
-rw-r--r--net/tools/crash_cache/crash_cache.cc7
6 files changed, 17 insertions, 19 deletions
diff --git a/net/disk_cache/blockfile/stress_cache.cc b/net/disk_cache/blockfile/stress_cache.cc
index f28e8af..d43cb74 100644
--- a/net/disk_cache/blockfile/stress_cache.cc
+++ b/net/disk_cache/blockfile/stress_cache.cc
@@ -27,7 +27,6 @@
#include "base/path_service.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
-#include "base/process/process_handle.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -59,14 +58,14 @@ int RunSlave(int iteration) {
base::CommandLine cmdline(exe);
cmdline.AppendArg(base::IntToString(iteration));
- base::ProcessHandle handle;
- if (!base::LaunchProcess(cmdline, base::LaunchOptions(), &handle)) {
+ base::Process process = base::LaunchProcess(cmdline, base::LaunchOptions());
+ if (!process.IsValid()) {
printf("Unable to run test\n");
return kError;
}
int exit_code;
- if (!base::WaitForExitCode(handle, &exit_code)) {
+ if (!process.WaitForExit(&exit_code)) {
printf("Unable to get return code\n");
return kError;
}
diff --git a/net/test/spawned_test_server/local_test_server.cc b/net/test/spawned_test_server/local_test_server.cc
index c85e05a..309c69c 100644
--- a/net/test/spawned_test_server/local_test_server.cc
+++ b/net/test/spawned_test_server/local_test_server.cc
@@ -121,18 +121,17 @@ bool LocalTestServer::BlockUntilStarted() {
bool LocalTestServer::Stop() {
CleanUpWhenStoppingServer();
- if (!process_handle_)
+ if (!process_.IsValid())
return true;
// First check if the process has already terminated.
- bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta());
+ bool ret = base::WaitForSingleProcess(process_.Handle(), base::TimeDelta());
if (!ret) {
- ret = base::KillProcess(process_handle_, 1, true);
+ ret = base::KillProcess(process_.Handle(), 1, true);
}
if (ret) {
- base::CloseProcessHandle(process_handle_);
- process_handle_ = base::kNullProcessHandle;
+ process_.Close();
} else {
VLOG(1) << "Kill failed?";
}
@@ -149,7 +148,6 @@ bool LocalTestServer::Init(const base::FilePath& document_root) {
// number out over a pipe that this TestServer object will read from. Once
// that is complete, the host port pair will contain the actual port.
DCHECK(!GetPort());
- process_handle_ = base::kNullProcessHandle;
base::FilePath src_dir;
if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir))
diff --git a/net/test/spawned_test_server/local_test_server.h b/net/test/spawned_test_server/local_test_server.h
index 37b1185..785d726 100644
--- a/net/test/spawned_test_server/local_test_server.h
+++ b/net/test/spawned_test_server/local_test_server.h
@@ -9,7 +9,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
-#include "base/process/process_handle.h"
+#include "base/process/process.h"
#include "net/test/spawned_test_server/base_test_server.h"
#if defined(OS_WIN)
@@ -92,8 +92,8 @@ class LocalTestServer : public BaseTestServer {
// Waits for the server to start. Returns true on success.
bool WaitToStart() WARN_UNUSED_RESULT;
- // Handle of the Python process running the test server.
- base::ProcessHandle process_handle_;
+ // The Python process running the test server.
+ base::Process process_;
#if defined(OS_WIN)
// The pipe file handle we read from.
diff --git a/net/test/spawned_test_server/local_test_server_posix.cc b/net/test/spawned_test_server/local_test_server_posix.cc
index 0edbedf1..c770152 100644
--- a/net/test/spawned_test_server/local_test_server_posix.cc
+++ b/net/test/spawned_test_server/local_test_server_posix.cc
@@ -139,7 +139,8 @@ bool LocalTestServer::LaunchPython(const base::FilePath& testserver_path) {
base::LaunchOptions options;
options.fds_to_remap = &map_write_fd;
- if (!base::LaunchProcess(python_command, options, &process_handle_)) {
+ process_ = base::LaunchProcess(python_command, options);
+ if (!process_.IsValid()) {
LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString();
return false;
}
diff --git a/net/test/spawned_test_server/local_test_server_win.cc b/net/test/spawned_test_server/local_test_server_win.cc
index 412e4e1..5eb5aaf 100644
--- a/net/test/spawned_test_server/local_test_server_win.cc
+++ b/net/test/spawned_test_server/local_test_server_win.cc
@@ -176,7 +176,8 @@ bool LocalTestServer::LaunchPython(const base::FilePath& testserver_path) {
base::LaunchOptions launch_options;
launch_options.inherit_handles = true;
- if (!base::LaunchProcess(python_command, launch_options, &process_handle_)) {
+ process_ = base::LaunchProcess(python_command, launch_options);
+ if (!process_.IsValid()) {
LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString();
return false;
}
diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc
index d548c79..9ec15bb 100644
--- a/net/tools/crash_cache/crash_cache.cc
+++ b/net/tools/crash_cache/crash_cache.cc
@@ -17,7 +17,6 @@
#include "base/path_service.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
-#include "base/process/process_handle.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -50,15 +49,15 @@ int RunSlave(RankCrashes action) {
base::CommandLine cmdline(exe);
cmdline.AppendArg(base::IntToString(action));
- base::ProcessHandle handle;
- if (!base::LaunchProcess(cmdline, base::LaunchOptions(), &handle)) {
+ base::Process process = base::LaunchProcess(cmdline, base::LaunchOptions());
+ if (!process.IsValid()) {
printf("Unable to run test %d\n", action);
return GENERIC;
}
int exit_code;
- if (!base::WaitForExitCode(handle, &exit_code)) {
+ if (!process.WaitForExit(&exit_code)) {
printf("Unable to get return code, test %d\n", action);
return GENERIC;
}