| 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" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/process_util.h" |
| 16 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 17 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 18 #include "base/test/test_timeouts.h" | 19 #include "base/test/test_timeouts.h" |
| 19 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
| 20 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 21 #include "base/win/scoped_handle.h" | 22 #include "base/win/scoped_handle.h" |
| 22 | 23 |
| 23 #pragma comment(lib, "crypt32.lib") | 24 #pragma comment(lib, "crypt32.lib") |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // 64-bit)." | 126 // 64-bit)." |
| 126 python_command.AppendArg("--startup-pipe=" + | 127 python_command.AppendArg("--startup-pipe=" + |
| 127 base::IntToString(reinterpret_cast<uintptr_t>(child_write))); | 128 base::IntToString(reinterpret_cast<uintptr_t>(child_write))); |
| 128 | 129 |
| 129 job_handle_.Set(CreateJobObject(NULL, NULL)); | 130 job_handle_.Set(CreateJobObject(NULL, NULL)); |
| 130 if (!job_handle_.IsValid()) { | 131 if (!job_handle_.IsValid()) { |
| 131 LOG(ERROR) << "Could not create JobObject."; | 132 LOG(ERROR) << "Could not create JobObject."; |
| 132 return false; | 133 return false; |
| 133 } | 134 } |
| 134 | 135 |
| 135 JOBOBJECT_EXTENDED_LIMIT_INFORMATION limit_info = {0}; | 136 if (!base::SetJobObjectAsKillOnJobClose(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."; | 137 LOG(ERROR) << "Could not SetInformationJobObject."; |
| 141 return false; | 138 return false; |
| 142 } | 139 } |
| 143 | 140 |
| 144 base::LaunchOptions launch_options; | 141 base::LaunchOptions launch_options; |
| 145 launch_options.inherit_handles = true; | 142 launch_options.inherit_handles = true; |
| 146 launch_options.job_handle = job_handle_.Get(); | 143 launch_options.job_handle = job_handle_.Get(); |
| 147 if (!base::LaunchProcess(python_command, launch_options, &process_handle_)) { | 144 if (!base::LaunchProcess(python_command, launch_options, &process_handle_)) { |
| 148 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); | 145 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); |
| 149 return false; | 146 return false; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 172 | 169 |
| 173 if (!ParseServerData(server_data)) { | 170 if (!ParseServerData(server_data)) { |
| 174 LOG(ERROR) << "Could not parse server_data: " << server_data; | 171 LOG(ERROR) << "Could not parse server_data: " << server_data; |
| 175 return false; | 172 return false; |
| 176 } | 173 } |
| 177 | 174 |
| 178 return true; | 175 return true; |
| 179 } | 176 } |
| 180 | 177 |
| 181 } // namespace net | 178 } // namespace net |
| OLD | NEW |