| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 namespace crashpad { | 48 namespace crashpad { |
| 49 namespace test { | 49 namespace test { |
| 50 | 50 |
| 51 namespace internal { | 51 namespace internal { |
| 52 | 52 |
| 53 struct MachMultiprocessInfo { | 53 struct MachMultiprocessInfo { |
| 54 MachMultiprocessInfo() | 54 MachMultiprocessInfo() |
| 55 : service_name(), | 55 : service_name(), |
| 56 local_port(MACH_PORT_NULL), | 56 local_port(MACH_PORT_NULL), |
| 57 remote_port(MACH_PORT_NULL), | 57 remote_port(MACH_PORT_NULL), |
| 58 child_task(MACH_PORT_NULL) {} | 58 child_task(TASK_NULL) { |
| 59 } |
| 59 | 60 |
| 60 std::string service_name; | 61 std::string service_name; |
| 61 base::mac::ScopedMachReceiveRight local_port; | 62 base::mac::ScopedMachReceiveRight local_port; |
| 62 base::mac::ScopedMachSendRight remote_port; | 63 base::mac::ScopedMachSendRight remote_port; |
| 63 base::mac::ScopedMachSendRight child_task; // valid only in parent | 64 base::mac::ScopedMachSendRight child_task; // valid only in parent |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 } // namespace internal | 67 } // namespace internal |
| 67 | 68 |
| 68 MachMultiprocess::MachMultiprocess() : Multiprocess(), info_(NULL) { | 69 MachMultiprocess::MachMultiprocess() : Multiprocess(), info_(NULL) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 EXPECT_NE(kMachPortNull, info_->local_port); | 106 EXPECT_NE(kMachPortNull, info_->local_port); |
| 106 return info_->local_port; | 107 return info_->local_port; |
| 107 } | 108 } |
| 108 | 109 |
| 109 mach_port_t MachMultiprocess::RemotePort() const { | 110 mach_port_t MachMultiprocess::RemotePort() const { |
| 110 EXPECT_NE(kMachPortNull, info_->remote_port); | 111 EXPECT_NE(kMachPortNull, info_->remote_port); |
| 111 return info_->remote_port; | 112 return info_->remote_port; |
| 112 } | 113 } |
| 113 | 114 |
| 114 task_t MachMultiprocess::ChildTask() const { | 115 task_t MachMultiprocess::ChildTask() const { |
| 115 EXPECT_NE(kMachPortNull, info_->child_task); | 116 EXPECT_NE(TASK_NULL, info_->child_task); |
| 116 return info_->child_task; | 117 return info_->child_task; |
| 117 } | 118 } |
| 118 | 119 |
| 119 void MachMultiprocess::MultiprocessParent() { | 120 void MachMultiprocess::MultiprocessParent() { |
| 120 ReceiveHelloMessage message = {}; | 121 ReceiveHelloMessage message = {}; |
| 121 | 122 |
| 122 kern_return_t kr = | 123 kern_return_t kr = |
| 123 mach_msg(&message.header, | 124 mach_msg(&message.header, |
| 124 MACH_RCV_MSG | MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0) | | 125 MACH_RCV_MSG | MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0) | |
| 125 MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_AUDIT), | 126 MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_AUDIT), |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if (testing::Test::HasFailure()) { | 270 if (testing::Test::HasFailure()) { |
| 270 // Trigger the ScopedForbidReturn destructor. | 271 // Trigger the ScopedForbidReturn destructor. |
| 271 return; | 272 return; |
| 272 } | 273 } |
| 273 | 274 |
| 274 forbid_return.Disarm(); | 275 forbid_return.Disarm(); |
| 275 } | 276 } |
| 276 | 277 |
| 277 } // namespace test | 278 } // namespace test |
| 278 } // namespace crashpad | 279 } // namespace crashpad |
| OLD | NEW |