| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 //! \brief Returns the child process’ process ID. | 109 //! \brief Returns the child process’ process ID. |
| 110 //! | 110 //! |
| 111 //! This method may only be called by the parent process. | 111 //! This method may only be called by the parent process. |
| 112 pid_t ChildPID() const; | 112 pid_t ChildPID() const; |
| 113 | 113 |
| 114 //! \brief Returns the read pipe’s file descriptor. | 114 //! \brief Returns the read pipe’s file descriptor. |
| 115 //! | 115 //! |
| 116 //! This method may be called by either the parent or the child process. | 116 //! This method may be called by either the parent or the child process. |
| 117 //! Anything written to the write pipe in the partner process will appear | 117 //! Anything written to the write pipe in the partner process will appear |
| 118 //! on the this file descriptor in this process. | 118 //! on the this file descriptor in this process. |
| 119 //! |
| 120 //! It is an error to call this after CloseReadPipe() has been called. |
| 121 //! |
| 122 //! \return The read pipe’s file descriptor. |
| 119 int ReadPipeFD() const; | 123 int ReadPipeFD() const; |
| 120 | 124 |
| 121 //! \brief Returns the write pipe’s file descriptor. | 125 //! \brief Returns the write pipe’s file descriptor. |
| 122 //! | 126 //! |
| 123 //! This method may be called by either the parent or the child process. | 127 //! This method may be called by either the parent or the child process. |
| 124 //! Anything written to this file descriptor in this process will appear on | 128 //! Anything written to this file descriptor in this process will appear on |
| 125 //! the read pipe in the partner process. | 129 //! the read pipe in the partner process. |
| 130 //! |
| 131 //! It is an error to call this after CloseWritePipe() has been called. |
| 132 //! |
| 133 //! \return The write pipe’s file descriptor. |
| 126 int WritePipeFD() const; | 134 int WritePipeFD() const; |
| 127 | 135 |
| 136 //! \brief Closes the read pipe. |
| 137 //! |
| 138 //! This method may be called by either the parent or the child process. An |
| 139 //! attempt to write to the write pipe in the partner process will fail with |
| 140 //! `EPIPE` or `SIGPIPE`. ReadPipeFD() must not be called after this. |
| 141 void CloseReadPipe(); |
| 142 |
| 143 //! \brief Closes the write pipe. |
| 144 //! |
| 145 //! This method may be called by either the parent or the child process. An |
| 146 //! attempt to read from the read pipe in the partner process will indicate |
| 147 //! end-of-file. WritePipeFD() must not be called after this. |
| 148 void CloseWritePipe(); |
| 149 |
| 128 private: | 150 private: |
| 129 //! \brief Runs the parent side of the test. | 151 //! \brief Runs the parent side of the test. |
| 130 //! | 152 //! |
| 131 //! This method establishes the parent’s environment and calls | 153 //! This method establishes the parent’s environment and calls |
| 132 //! MultiprocessParent(). | 154 //! MultiprocessParent(). |
| 133 void RunParent(); | 155 void RunParent(); |
| 134 | 156 |
| 135 //! \brief Runs the child side of the test. | 157 //! \brief Runs the child side of the test. |
| 136 //! | 158 //! |
| 137 //! This method establishes the child’s environment, calls | 159 //! This method establishes the child’s environment, calls |
| (...skipping 25 matching lines...) Expand all Loading... |
| 163 int code_; | 185 int code_; |
| 164 TerminationReason reason_; | 186 TerminationReason reason_; |
| 165 | 187 |
| 166 DISALLOW_COPY_AND_ASSIGN(Multiprocess); | 188 DISALLOW_COPY_AND_ASSIGN(Multiprocess); |
| 167 }; | 189 }; |
| 168 | 190 |
| 169 } // namespace test | 191 } // namespace test |
| 170 } // namespace crashpad | 192 } // namespace crashpad |
| 171 | 193 |
| 172 #endif // CRASHPAD_UTIL_TEST_MULTIPROCESS_H_ | 194 #endif // CRASHPAD_UTIL_TEST_MULTIPROCESS_H_ |
| OLD | NEW |