OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 char c; | 161 char c; |
162 CheckedReadFile(pipe_c2p_read_.get(), &c, sizeof(c)); | 162 CheckedReadFile(pipe_c2p_read_.get(), &c, sizeof(c)); |
163 ASSERT_EQ(' ', c); | 163 ASSERT_EQ(' ', c); |
164 | 164 |
165 // These have been passed to the child, close our side. | 165 // These have been passed to the child, close our side. |
166 pipe_c2p_write_.reset(); | 166 pipe_c2p_write_.reset(); |
167 pipe_p2c_read_.reset(); | 167 pipe_p2c_read_.reset(); |
168 | 168 |
169 WinMultiprocessParent(); | 169 WinMultiprocessParent(); |
170 | 170 |
| 171 // Close our side of the handles now that we're done. The child can |
| 172 // use this to know when it's safe to complete. |
| 173 pipe_p2c_write_.reset(); |
| 174 pipe_c2p_read_.reset(); |
| 175 |
171 // Wait for the child to complete. | 176 // Wait for the child to complete. |
172 ASSERT_EQ(WAIT_OBJECT_0, | 177 ASSERT_EQ(WAIT_OBJECT_0, |
173 WaitForSingleObject(child_handle_.get(), INFINITE)); | 178 WaitForSingleObject(child_handle_.get(), INFINITE)); |
174 | 179 |
175 DWORD exit_code; | 180 DWORD exit_code; |
176 ASSERT_TRUE(GetExitCodeProcess(child_handle_.get(), &exit_code)); | 181 ASSERT_TRUE(GetExitCodeProcess(child_handle_.get(), &exit_code)); |
177 ASSERT_EQ(exit_code_, exit_code); | 182 ASSERT_EQ(exit_code_, exit_code); |
178 } | 183 } |
179 } | 184 } |
180 | 185 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 pipe_c2p_write_.reset(); | 218 pipe_c2p_write_.reset(); |
214 } | 219 } |
215 | 220 |
216 HANDLE WinMultiprocess::ChildProcess() const { | 221 HANDLE WinMultiprocess::ChildProcess() const { |
217 EXPECT_NE(nullptr, child_handle_.get()); | 222 EXPECT_NE(nullptr, child_handle_.get()); |
218 return child_handle_.get(); | 223 return child_handle_.get(); |
219 } | 224 } |
220 | 225 |
221 } // namespace test | 226 } // namespace test |
222 } // namespace crashpad | 227 } // namespace crashpad |
OLD | NEW |