Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: util/test/multiprocess.h

Issue 853853002: win: Stub reorganization of MultiprocessExec (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « util/test/mac/mach_multiprocess.cc ('k') | util/test/multiprocess.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_UTIL_TEST_MULTIPROCESS_H_ 15 #ifndef CRASHPAD_UTIL_TEST_MULTIPROCESS_H_
16 #define CRASHPAD_UTIL_TEST_MULTIPROCESS_H_ 16 #define CRASHPAD_UTIL_TEST_MULTIPROCESS_H_
17 17
18 #include <unistd.h> 18 #include <sys/types.h>
19 19
20 #include "base/basictypes.h" 20 #include "base/basictypes.h"
21 #include "util/file/file_io.h"
21 22
22 namespace crashpad { 23 namespace crashpad {
23 namespace test { 24 namespace test {
24 25
25 namespace internal { 26 namespace internal {
26 struct MultiprocessInfo; 27 struct MultiprocessInfo;
27 }; 28 };
28 29
29 //! \brief Manages a multiprocess test. 30 //! \brief Manages a multiprocess test.
30 //! 31 //!
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 //! 102 //!
102 //! Subclass implementations may signal failure by raising their own fatal 103 //! Subclass implementations may signal failure by raising their own fatal
103 //! gtest assertions. 104 //! gtest assertions.
104 virtual void PreFork(); 105 virtual void PreFork();
105 106
106 //! \brief Returns the child process’ process ID. 107 //! \brief Returns the child process’ process ID.
107 //! 108 //!
108 //! This method may only be called by the parent process. 109 //! This method may only be called by the parent process.
109 pid_t ChildPID() const; 110 pid_t ChildPID() const;
110 111
111 //! \brief Returns the read pipe’s file descriptor. 112 //! \brief Returns the read pipe’s file handle.
112 //! 113 //!
113 //! This method may be called by either the parent or the child process. 114 //! This method may be called by either the parent or the child process.
114 //! Anything written to the write pipe in the partner process will appear 115 //! Anything written to the write pipe in the partner process will appear
115 //! on the this file descriptor in this process. 116 //! on this file handle in this process.
116 //! 117 //!
117 //! It is an error to call this after CloseReadPipe() has been called. 118 //! It is an error to call this after CloseReadPipe() has been called.
118 //! 119 //!
119 //! \return The read pipe’s file descriptor. 120 //! \return The read pipe’s file handle.
120 int ReadPipeFD() const; 121 FileHandle ReadPipeHandle() const;
121 122
122 //! \brief Returns the write pipe’s file descriptor. 123 //! \brief Returns the write pipe’s file handle.
123 //! 124 //!
124 //! This method may be called by either the parent or the child process. 125 //! This method may be called by either the parent or the child process.
125 //! Anything written to this file descriptor in this process will appear on 126 //! Anything written to this file handle in this process will appear on
126 //! the read pipe in the partner process. 127 //! the read pipe in the partner process.
127 //! 128 //!
128 //! It is an error to call this after CloseWritePipe() has been called. 129 //! It is an error to call this after CloseWritePipe() has been called.
129 //! 130 //!
130 //! \return The write pipe’s file descriptor. 131 //! \return The write pipe’s file handle.
131 int WritePipeFD() const; 132 FileHandle WritePipeHandle() const;
132 133
133 //! \brief Closes the read pipe. 134 //! \brief Closes the read pipe.
134 //! 135 //!
135 //! This method may be called by either the parent or the child process. An 136 //! This method may be called by either the parent or the child process. An
136 //! attempt to write to the write pipe in the partner process will fail with 137 //! attempt to write to the write pipe in the partner process will fail with
137 //! `EPIPE` or `SIGPIPE`. ReadPipeFD() must not be called after this. 138 //! `EPIPE` or `SIGPIPE`. ReadPipeHandle() must not be called after this.
138 void CloseReadPipe(); 139 void CloseReadPipe();
139 140
140 //! \brief Closes the write pipe. 141 //! \brief Closes the write pipe.
141 //! 142 //!
142 //! This method may be called by either the parent or the child process. An 143 //! This method may be called by either the parent or the child process. An
143 //! attempt to read from the read pipe in the partner process will indicate 144 //! attempt to read from the read pipe in the partner process will indicate
144 //! end-of-file. WritePipeFD() must not be called after this. 145 //! end-of-file. WritePipeHandle() must not be called after this.
145 void CloseWritePipe(); 146 void CloseWritePipe();
146 147
147 private: 148 private:
148 //! \brief Runs the parent side of the test. 149 //! \brief Runs the parent side of the test.
149 //! 150 //!
150 //! This method establishes the parent’s environment and calls 151 //! This method establishes the parent’s environment and calls
151 //! MultiprocessParent(). 152 //! MultiprocessParent().
152 void RunParent(); 153 void RunParent();
153 154
154 //! \brief Runs the child side of the test. 155 //! \brief Runs the child side of the test.
(...skipping 27 matching lines...) Expand all
182 int code_; 183 int code_;
183 TerminationReason reason_; 184 TerminationReason reason_;
184 185
185 DISALLOW_COPY_AND_ASSIGN(Multiprocess); 186 DISALLOW_COPY_AND_ASSIGN(Multiprocess);
186 }; 187 };
187 188
188 } // namespace test 189 } // namespace test
189 } // namespace crashpad 190 } // namespace crashpad
190 191
191 #endif // CRASHPAD_UTIL_TEST_MULTIPROCESS_H_ 192 #endif // CRASHPAD_UTIL_TEST_MULTIPROCESS_H_
OLDNEW
« no previous file with comments | « util/test/mac/mach_multiprocess.cc ('k') | util/test/multiprocess.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698