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, |
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 "test/win/win_child_process.h" | 15 #include "test/win/win_child_process.h" |
16 | 16 |
17 #include <windows.h> | 17 #include <windows.h> |
18 #include <shellapi.h> | 18 #include <shellapi.h> |
19 | 19 |
20 #include <string> | 20 #include <string> |
| 21 #include <utility> |
21 | 22 |
22 #include "base/logging.h" | 23 #include "base/logging.h" |
23 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
24 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
25 #include "gtest/gtest.h" | 26 #include "gtest/gtest.h" |
26 #include "util/stdlib/move.h" | |
27 #include "util/stdlib/string_number_conversion.h" | 27 #include "util/stdlib/string_number_conversion.h" |
28 #include "util/string/split_string.h" | 28 #include "util/string/split_string.h" |
29 #include "util/win/handle.h" | 29 #include "util/win/handle.h" |
30 #include "util/win/scoped_local_alloc.h" | 30 #include "util/win/scoped_local_alloc.h" |
31 #include "test/paths.h" | 31 #include "test/paths.h" |
32 | 32 |
33 namespace crashpad { | 33 namespace crashpad { |
34 namespace test { | 34 namespace test { |
35 | 35 |
36 namespace { | 36 namespace { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 return false; | 119 return false; |
120 } | 120 } |
121 ScopedFileHANDLE temp_read(read); | 121 ScopedFileHANDLE temp_read(read); |
122 ScopedFileHANDLE temp_write(write); | 122 ScopedFileHANDLE temp_write(write); |
123 | 123 |
124 if (!read_inheritable && !UnsetHandleInheritance(temp_read.get())) | 124 if (!read_inheritable && !UnsetHandleInheritance(temp_read.get())) |
125 return false; | 125 return false; |
126 if (!write_inheritable && !UnsetHandleInheritance(temp_write.get())) | 126 if (!write_inheritable && !UnsetHandleInheritance(temp_write.get())) |
127 return false; | 127 return false; |
128 | 128 |
129 *read_handle = crashpad::move(temp_read); | 129 *read_handle = std::move(temp_read); |
130 *write_handle = crashpad::move(temp_write); | 130 *write_handle = std::move(temp_write); |
131 | 131 |
132 return true; | 132 return true; |
133 } | 133 } |
134 | 134 |
135 } // namespace | 135 } // namespace |
136 | 136 |
137 WinChildProcess::WinChildProcess() { | 137 WinChildProcess::WinChildProcess() { |
138 std::string switch_value; | 138 std::string switch_value; |
139 CHECK(GetSwitch(kIsMultiprocessChild, &switch_value)); | 139 CHECK(GetSwitch(kIsMultiprocessChild, &switch_value)); |
140 | 140 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 if (!LoggingReadFile(handles_for_parent->read.get(), &c, sizeof(c))) { | 206 if (!LoggingReadFile(handles_for_parent->read.get(), &c, sizeof(c))) { |
207 ADD_FAILURE() << "LoggedReadFile"; | 207 ADD_FAILURE() << "LoggedReadFile"; |
208 return scoped_ptr<Handles>(); | 208 return scoped_ptr<Handles>(); |
209 } | 209 } |
210 | 210 |
211 if (c != ' ') { | 211 if (c != ' ') { |
212 ADD_FAILURE() << "invalid data read from child"; | 212 ADD_FAILURE() << "invalid data read from child"; |
213 return scoped_ptr<Handles>(); | 213 return scoped_ptr<Handles>(); |
214 } | 214 } |
215 | 215 |
216 return crashpad::move(handles_for_parent); | 216 return std::move(handles_for_parent); |
217 } | 217 } |
218 | 218 |
219 FileHandle WinChildProcess::ReadPipeHandle() const { | 219 FileHandle WinChildProcess::ReadPipeHandle() const { |
220 return pipe_read_.get(); | 220 return pipe_read_.get(); |
221 } | 221 } |
222 | 222 |
223 FileHandle WinChildProcess::WritePipeHandle() const { | 223 FileHandle WinChildProcess::WritePipeHandle() const { |
224 return pipe_write_.get(); | 224 return pipe_write_.get(); |
225 } | 225 } |
226 | 226 |
227 void WinChildProcess::CloseReadPipe() { | 227 void WinChildProcess::CloseReadPipe() { |
228 pipe_read_.reset(); | 228 pipe_read_.reset(); |
229 } | 229 } |
230 | 230 |
231 void WinChildProcess::CloseWritePipe() { | 231 void WinChildProcess::CloseWritePipe() { |
232 pipe_write_.reset(); | 232 pipe_write_.reset(); |
233 } | 233 } |
234 | 234 |
235 } // namespace test | 235 } // namespace test |
236 } // namespace crashpad | 236 } // namespace crashpad |
OLD | NEW |