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

Side by Side Diff: util/test/multiprocess_posix.cc

Issue 880763002: Reorganize Multiprocess and implement for Windows (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fixes Created 5 years, 10 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
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 #include "util/test/multiprocess.h" 15 #include "util/test/multiprocess.h"
16 16
17 #include <signal.h> 17 #include <signal.h>
18 #include <stdlib.h> 18 #include <stdlib.h>
19 #include <sys/wait.h> 19 #include <sys/wait.h>
Mark Mentovai 2015/01/28 22:32:54 This needs <unistd.h> now that you’ve removed it f
scottmg 2015/01/28 22:48:25 Done.
20 20
21 #include <string> 21 #include <string>
22 22
23 #include "base/auto_reset.h" 23 #include "base/auto_reset.h"
24 #include "base/files/scoped_file.h" 24 #include "base/files/scoped_file.h"
25 #include "base/logging.h" 25 #include "base/logging.h"
26 #include "base/memory/scoped_ptr.h" 26 #include "base/memory/scoped_ptr.h"
27 #include "base/posix/eintr_wrapper.h" 27 #include "base/posix/eintr_wrapper.h"
28 #include "base/strings/stringprintf.h" 28 #include "base/strings/stringprintf.h"
29 #include "gtest/gtest.h" 29 #include "gtest/gtest.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 info_->pipe_p2c_read.reset(pipe_fds_p2c[0]); 147 info_->pipe_p2c_read.reset(pipe_fds_p2c[0]);
148 info_->pipe_p2c_write.reset(pipe_fds_p2c[1]); 148 info_->pipe_p2c_write.reset(pipe_fds_p2c[1]);
149 } 149 }
150 150
151 pid_t Multiprocess::ChildPID() const { 151 pid_t Multiprocess::ChildPID() const {
152 EXPECT_NE(0, info_->child_pid); 152 EXPECT_NE(0, info_->child_pid);
153 return info_->child_pid; 153 return info_->child_pid;
154 } 154 }
155 155
156 int Multiprocess::ReadPipeFD() const { 156 FileHandle Multiprocess::ReadPipeHandle() const {
157 int fd = info_->child_pid ? info_->pipe_c2p_read.get() 157 int fd = info_->child_pid ? info_->pipe_c2p_read.get()
158 : info_->pipe_p2c_read.get(); 158 : info_->pipe_p2c_read.get();
159 CHECK_NE(fd, -1); 159 CHECK_NE(fd, -1);
160 return fd; 160 return fd;
161 } 161 }
162 162
163 int Multiprocess::WritePipeFD() const { 163 FileHandle Multiprocess::WritePipeHandle() const {
164 int fd = info_->child_pid ? info_->pipe_p2c_write.get() 164 int fd = info_->child_pid ? info_->pipe_p2c_write.get()
165 : info_->pipe_c2p_write.get(); 165 : info_->pipe_c2p_write.get();
166 CHECK_NE(fd, -1); 166 CHECK_NE(fd, -1);
167 return fd; 167 return fd;
168 } 168 }
169 169
170 void Multiprocess::CloseReadPipe() { 170 void Multiprocess::CloseReadPipe() {
171 if (info_->child_pid) { 171 if (info_->child_pid) {
172 info_->pipe_c2p_read.reset(); 172 info_->pipe_c2p_read.reset();
173 } else { 173 } else {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 if (testing::Test::HasFailure()) { 209 if (testing::Test::HasFailure()) {
210 // Trigger the ScopedForbidReturn destructor. 210 // Trigger the ScopedForbidReturn destructor.
211 return; 211 return;
212 } 212 }
213 213
214 exit(0); 214 exit(0);
215 } 215 }
216 216
217 } // namespace test 217 } // namespace test
218 } // namespace crashpad 218 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698