 Chromium Code Reviews
 Chromium Code Reviews Issue 2950153002:
  Improve process launch handle sharing API.  (Closed)
    
  
    Issue 2950153002:
  Improve process launch handle sharing API.  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <windows.h> | 7 #include <windows.h> | 
| 8 | 8 | 
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" | 
| 10 #include "base/bind.h" | 10 #include "base/bind.h" | 
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 // "64-bit versions of Windows use 32-bit handles for | 118 // "64-bit versions of Windows use 32-bit handles for | 
| 119 // interoperability. When sharing a handle between 32-bit and 64-bit | 119 // interoperability. When sharing a handle between 32-bit and 64-bit | 
| 120 // applications, only the lower 32 bits are significant, so it is | 120 // applications, only the lower 32 bits are significant, so it is | 
| 121 // safe to truncate the handle (when passing it from 64-bit to | 121 // safe to truncate the handle (when passing it from 64-bit to | 
| 122 // 32-bit) or sign-extend the handle (when passing it from 32-bit to | 122 // 32-bit) or sign-extend the handle (when passing it from 32-bit to | 
| 123 // 64-bit)." | 123 // 64-bit)." | 
| 124 python_command.AppendArg("--startup-pipe=" + | 124 python_command.AppendArg("--startup-pipe=" + | 
| 125 base::IntToString(reinterpret_cast<uintptr_t>(child_write))); | 125 base::IntToString(reinterpret_cast<uintptr_t>(child_write))); | 
| 126 | 126 | 
| 127 base::LaunchOptions launch_options; | 127 base::LaunchOptions launch_options; | 
| 128 launch_options.inherit_handles = true; | 128 launch_options.inherit_mode = base::LaunchOptions::Inherit::kAll; | 
| 
jschuh
2017/07/24 19:41:27
Leave a TODO here.
 | |
| 129 process_ = base::LaunchProcess(python_command, launch_options); | 129 process_ = base::LaunchProcess(python_command, launch_options); | 
| 130 if (!process_.IsValid()) { | 130 if (!process_.IsValid()) { | 
| 131 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); | 131 LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); | 
| 132 ::CloseHandle(child_write); | 132 ::CloseHandle(child_write); | 
| 133 return false; | 133 return false; | 
| 134 } | 134 } | 
| 135 | 135 | 
| 136 ::CloseHandle(child_write); | 136 ::CloseHandle(child_write); | 
| 137 return true; | 137 return true; | 
| 138 } | 138 } | 
| (...skipping 18 matching lines...) Expand all Loading... | |
| 157 | 157 | 
| 158 if (!ParseServerData(server_data)) { | 158 if (!ParseServerData(server_data)) { | 
| 159 LOG(ERROR) << "Could not parse server_data: " << server_data; | 159 LOG(ERROR) << "Could not parse server_data: " << server_data; | 
| 160 return false; | 160 return false; | 
| 161 } | 161 } | 
| 162 | 162 | 
| 163 return true; | 163 return true; | 
| 164 } | 164 } | 
| 165 | 165 | 
| 166 } // namespace net | 166 } // namespace net | 
| OLD | NEW |