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

Side by Side Diff: net/test/test_server_win.cc

Issue 8667006: Extract similar code into SetJobObjectAsKillOnJobClose() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« base/process_util_win.cc ('K') | « chrome/test/ui/ui_test_suite.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/test_server.h" 5 #include "net/test/test_server.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <wincrypt.h> 8 #include <wincrypt.h>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // 64-bit)." 125 // 64-bit)."
126 python_command.AppendArg("--startup-pipe=" + 126 python_command.AppendArg("--startup-pipe=" +
127 base::IntToString(reinterpret_cast<uintptr_t>(child_write))); 127 base::IntToString(reinterpret_cast<uintptr_t>(child_write)));
128 128
129 job_handle_.Set(CreateJobObject(NULL, NULL)); 129 job_handle_.Set(CreateJobObject(NULL, NULL));
130 if (!job_handle_.IsValid()) { 130 if (!job_handle_.IsValid()) {
131 LOG(ERROR) << "Could not create JobObject."; 131 LOG(ERROR) << "Could not create JobObject.";
132 return false; 132 return false;
133 } 133 }
134 134
135 JOBOBJECT_EXTENDED_LIMIT_INFORMATION limit_info = {0}; 135 if (!SetJobObjectAsKillOnJoClose(job_handle_.Get())) {
136 limit_info.BasicLimitInformation.LimitFlags =
137 JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
138 if (0 == SetInformationJobObject(job_handle_.Get(),
139 JobObjectExtendedLimitInformation, &limit_info, sizeof(limit_info))) {
140 LOG(ERROR) << "Could not SetInformationJobObject."; 136 LOG(ERROR) << "Could not SetInformationJobObject.";
141 return false; 137 return false;
142 } 138 }
143 139
144 base::LaunchOptions launch_options; 140 base::LaunchOptions launch_options;
145 launch_options.inherit_handles = true; 141 launch_options.inherit_handles = true;
146 launch_options.job_handle = job_handle_.Get(); 142 launch_options.job_handle = job_handle_.Get();
147 if (!base::LaunchProcess(python_command, launch_options, &process_handle_)) { 143 if (!base::LaunchProcess(python_command, launch_options, &process_handle_)) {
148 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); 144 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString();
149 return false; 145 return false;
(...skipping 22 matching lines...) Expand all
172 168
173 if (!ParseServerData(server_data)) { 169 if (!ParseServerData(server_data)) {
174 LOG(ERROR) << "Could not parse server_data: " << server_data; 170 LOG(ERROR) << "Could not parse server_data: " << server_data;
175 return false; 171 return false;
176 } 172 }
177 173
178 return true; 174 return true;
179 } 175 }
180 176
181 } // namespace net 177 } // namespace net
OLDNEW
« base/process_util_win.cc ('K') | « chrome/test/ui/ui_test_suite.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698