| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 pipe_c2p_write_.reset(reinterpret_cast<HANDLE>(c2p_write)); | 93 pipe_c2p_write_.reset(reinterpret_cast<HANDLE>(c2p_write)); |
| 94 pipe_p2c_read_.reset(reinterpret_cast<HANDLE>(p2c_read)); | 94 pipe_p2c_read_.reset(reinterpret_cast<HANDLE>(p2c_read)); |
| 95 | 95 |
| 96 // Notify the parent that it's OK to proceed. We only need to wait to get to | 96 // Notify the parent that it's OK to proceed. We only need to wait to get to |
| 97 // the process entry point, but this is the easiest place we can notify. | 97 // the process entry point, but this is the easiest place we can notify. |
| 98 char c = ' '; | 98 char c = ' '; |
| 99 CheckedWriteFile(WritePipeHandle(), &c, sizeof(c)); | 99 CheckedWriteFile(WritePipeHandle(), &c, sizeof(c)); |
| 100 | 100 |
| 101 // Invoke the child side of the test. | 101 // Invoke the child side of the test. |
| 102 WinMultiprocessChild(); | 102 WinMultiprocessChild(); |
| 103 exit(0); | 103 |
| 104 if (testing::Test::HasFailure()) |
| 105 exit(255); |
| 106 exit(EXIT_SUCCESS); |
| 104 } else { | 107 } else { |
| 105 // If we're in the parent, make pipes for child-to-parent and | 108 // If we're in the parent, make pipes for child-to-parent and |
| 106 // parent-to-child communication. Mark them as inheritable via the | 109 // parent-to-child communication. Mark them as inheritable via the |
| 107 // SECURITY_ATTRIBUTES, but use SetHandleInformation to ensure that the | 110 // SECURITY_ATTRIBUTES, but use SetHandleInformation to ensure that the |
| 108 // parent sides are not inherited. | 111 // parent sides are not inherited. |
| 109 SECURITY_ATTRIBUTES security_attributes = {0}; | 112 SECURITY_ATTRIBUTES security_attributes = {0}; |
| 110 security_attributes.nLength = sizeof(SECURITY_ATTRIBUTES); | 113 security_attributes.nLength = sizeof(SECURITY_ATTRIBUTES); |
| 111 security_attributes.bInheritHandle = true; | 114 security_attributes.bInheritHandle = true; |
| 112 | 115 |
| 113 HANDLE c2p_read, c2p_write; | 116 HANDLE c2p_read, c2p_write; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 pipe_c2p_write_.reset(); | 221 pipe_c2p_write_.reset(); |
| 219 } | 222 } |
| 220 | 223 |
| 221 HANDLE WinMultiprocess::ChildProcess() const { | 224 HANDLE WinMultiprocess::ChildProcess() const { |
| 222 EXPECT_NE(nullptr, child_handle_.get()); | 225 EXPECT_NE(nullptr, child_handle_.get()); |
| 223 return child_handle_.get(); | 226 return child_handle_.get(); |
| 224 } | 227 } |
| 225 | 228 |
| 226 } // namespace test | 229 } // namespace test |
| 227 } // namespace crashpad | 230 } // namespace crashpad |
| OLD | NEW |