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 13 matching lines...) Expand all Loading... |
24 namespace test { | 24 namespace test { |
25 | 25 |
26 namespace internal { | 26 namespace internal { |
27 struct MachMultiprocessInfo; | 27 struct MachMultiprocessInfo; |
28 } // namespace internal | 28 } // namespace internal |
29 | 29 |
30 //! \brief Manages a Mach-aware multiprocess test. | 30 //! \brief Manages a Mach-aware multiprocess test. |
31 //! | 31 //! |
32 //! These tests are `fork()`-based. The parent process has access to the child | 32 //! These tests are `fork()`-based. The parent process has access to the child |
33 //! process’ task port. The parent and child processes are able to communicate | 33 //! process’ task port. The parent and child processes are able to communicate |
34 //! via Mach IPC, and the child process can also send messages to the parent | 34 //! via Mach IPC, and via a pair of POSIX pipes. |
35 //! process via a POSIX pipe. | |
36 //! | 35 //! |
37 //! Subclasses are expected to implement the parent and child by overriding the | 36 //! Subclasses are expected to implement the parent and child by overriding the |
38 //! appropriate methods. | 37 //! appropriate methods. |
39 class MachMultiprocess { | 38 class MachMultiprocess { |
40 public: | 39 public: |
41 MachMultiprocess(); | 40 MachMultiprocess(); |
42 | 41 |
43 //! \brief Runs the test. | 42 //! \brief Runs the test. |
44 //! | 43 //! |
45 //! This method establishes the proper testing environment and calls | 44 //! This method establishes the proper testing environment and calls |
(...skipping 26 matching lines...) Expand all Loading... |
72 //! `FAIL()`, etc. | 71 //! `FAIL()`, etc. |
73 //! | 72 //! |
74 //! Subclasses must implement this method to define how the child operates. | 73 //! Subclasses must implement this method to define how the child operates. |
75 virtual void Child() = 0; | 74 virtual void Child() = 0; |
76 | 75 |
77 //! \brief Returns the child process’ process ID. | 76 //! \brief Returns the child process’ process ID. |
78 //! | 77 //! |
79 //! This method may only be called by the parent process. | 78 //! This method may only be called by the parent process. |
80 pid_t ChildPID() const; | 79 pid_t ChildPID() const; |
81 | 80 |
82 //! \brief Returns the pipe’s file descriptor. | 81 //! \brief Returns the read pipe’s file descriptor. |
83 //! | 82 //! |
84 //! This method may be called by either the parent or the child process. In | 83 //! This method may be called by either the parent or the child process. |
85 //! the parent process, the pipe is read-only, and in the child process, it is | 84 //! Anything written to the write pipe in the partner process will appear |
86 //! write-only. | 85 //! on the this file descriptor in this process. |
87 int PipeFD() const; | 86 int ReadPipeFD() const; |
| 87 |
| 88 //! \brief Returns the write pipe’s file descriptor. |
| 89 //! |
| 90 //! This method may be called by either the parent or the child process. |
| 91 //! Anything written to this file descriptor in this process will appear on |
| 92 //! the read pipe in the partner process. |
| 93 int WritePipeFD() const; |
88 | 94 |
89 //! \brief Returns a receive right for the local port. | 95 //! \brief Returns a receive right for the local port. |
90 //! | 96 //! |
91 //! This method may be called by either the parent or the child process. It | 97 //! This method may be called by either the parent or the child process. It |
92 //! returns a receive right, with a corresponding send right held in the | 98 //! returns a receive right, with a corresponding send right held in the |
93 //! opposing process. | 99 //! opposing process. |
94 mach_port_t LocalPort() const; | 100 mach_port_t LocalPort() const; |
95 | 101 |
96 //! \brief Returns a send right for the remote port. | 102 //! \brief Returns a send right for the remote port. |
97 //! | 103 //! |
(...skipping 26 matching lines...) Expand all Loading... |
124 | 130 |
125 internal::MachMultiprocessInfo* info_; | 131 internal::MachMultiprocessInfo* info_; |
126 | 132 |
127 DISALLOW_COPY_AND_ASSIGN(MachMultiprocess); | 133 DISALLOW_COPY_AND_ASSIGN(MachMultiprocess); |
128 }; | 134 }; |
129 | 135 |
130 } // namespace test | 136 } // namespace test |
131 } // namespace crashpad | 137 } // namespace crashpad |
132 | 138 |
133 #endif // CRASHPAD_UTIL_TEST_MAC_MACH_MULTIPROCESS_H_ | 139 #endif // CRASHPAD_UTIL_TEST_MAC_MACH_MULTIPROCESS_H_ |
OLD | NEW |