| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |