Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/test/spawned_test_server/local_test_server.h" | 5 #include "net/test/spawned_test_server/local_test_server.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool LocalTestServer::Stop() { | 121 bool LocalTestServer::Stop() { |
| 122 CleanUpWhenStoppingServer(); | 122 CleanUpWhenStoppingServer(); |
| 123 | 123 |
| 124 if (!process_handle_) | 124 if (!process_handle_) |
| 125 return true; | 125 return true; |
| 126 | 126 |
| 127 // First check if the process has already terminated. | 127 // First check if the process has already terminated. |
| 128 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta()); | 128 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta()); |
| 129 if (!ret) | 129 if (!ret) { |
| 130 #if defined(OS_WIN) | |
|
Paweł Hajdan Jr.
2013/12/02 19:37:56
Let's close the job handle always when returning f
M-A Ruel
2013/12/02 20:13:16
and removed stale comment at lines 136-137.
| |
| 131 job_handle_.Close(); | |
| 132 #endif | |
| 130 ret = base::KillProcess(process_handle_, 1, true); | 133 ret = base::KillProcess(process_handle_, 1, true); |
| 134 } | |
| 131 | 135 |
| 136 // TODO(maruel): This doesn't work on Windows because it kills cmd.exe | |
| 137 // instead of python.exe. http://crbug.com/321703 | |
| 132 if (ret) { | 138 if (ret) { |
| 133 base::CloseProcessHandle(process_handle_); | 139 base::CloseProcessHandle(process_handle_); |
| 134 process_handle_ = base::kNullProcessHandle; | 140 process_handle_ = base::kNullProcessHandle; |
| 135 } else { | 141 } else { |
| 136 VLOG(1) << "Kill failed?"; | 142 VLOG(1) << "Kill failed?"; |
| 137 } | 143 } |
| 138 | 144 |
| 139 return ret; | 145 return ret; |
| 140 } | 146 } |
| 141 | 147 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 break; | 249 break; |
| 244 default: | 250 default: |
| 245 NOTREACHED(); | 251 NOTREACHED(); |
| 246 return false; | 252 return false; |
| 247 } | 253 } |
| 248 | 254 |
| 249 return true; | 255 return true; |
| 250 } | 256 } |
| 251 | 257 |
| 252 } // namespace net | 258 } // namespace net |
| OLD | NEW |