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

Side by Side Diff: net/test/spawned_test_server/local_test_server.cc

Issue 248903002: Fix LocalTestServer shutdown on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 unified diff | Download patch
« base/process/kill_win.cc ('K') | « base/process/kill_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return SetupWhenServerStarted(); 118 return SetupWhenServerStarted();
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 #if defined(OS_WIN) 127 #if defined(OS_WIN)
128 // This kills all the processes in the job object. 128 // Kill all the processes in the job object.
129 // Passing 0 exit code so that WaitForSingleProcess below doesn't fail.
130 if (job_handle_ && !base::KillJob(job_handle_.Get(), 0, true)) {
131 VLOG(1) << "Job kill failed";
132 }
129 job_handle_.Close(); 133 job_handle_.Close();
130 #endif 134 #endif
131 135
132 // First check if the process has already terminated. 136 // First check if the process has already terminated.
133 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta()); 137 bool ret = base::WaitForSingleProcess(process_handle_, base::TimeDelta());
134 if (!ret) { 138 if (!ret) {
135 ret = base::KillProcess(process_handle_, 1, true); 139 ret = base::KillProcess(process_handle_, 1, true);
136 } 140 }
137 141
138 if (ret) { 142 if (ret) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 break; 254 break;
251 default: 255 default:
252 NOTREACHED(); 256 NOTREACHED();
253 return false; 257 return false;
254 } 258 }
255 259
256 return true; 260 return true;
257 } 261 }
258 262
259 } // namespace net 263 } // namespace net
OLDNEW
« base/process/kill_win.cc ('K') | « base/process/kill_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698