| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <mach/mach.h> | 5 #include <mach/mach.h> |
| 6 #include <mach/mach_vm.h> | 6 #include <mach/mach_vm.h> |
| 7 #include <servers/bootstrap.h> | 7 #include <servers/bootstrap.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // Pass the service name to the child process. | 197 // Pass the service name to the child process. |
| 198 command_line.AppendSwitchASCII(g_service_switch_name, service_name_); | 198 command_line.AppendSwitchASCII(g_service_switch_name, service_name_); |
| 199 return command_line; | 199 return command_line; |
| 200 } | 200 } |
| 201 | 201 |
| 202 void SetUpChild(const std::string& name) { | 202 void SetUpChild(const std::string& name) { |
| 203 // Make a random service name so that this test doesn't conflict with other | 203 // Make a random service name so that this test doesn't conflict with other |
| 204 // similar tests. | 204 // similar tests. |
| 205 service_name_ = CreateRandomServiceName(); | 205 service_name_ = CreateRandomServiceName(); |
| 206 server_port_.reset(BecomeMachServer(service_name_.c_str())); | 206 server_port_.reset(BecomeMachServer(service_name_.c_str())); |
| 207 child_process_ = SpawnChild(name); | 207 base::SpawnChildResult spawn_result = SpawnChild(name); |
| 208 child_process_ = std::move(spawn_result.process); |
| 208 client_port_.reset(ReceiveMachPort(server_port_.get())); | 209 client_port_.reset(ReceiveMachPort(server_port_.get())); |
| 209 } | 210 } |
| 210 | 211 |
| 211 static const int s_memory_size = 99999; | 212 static const int s_memory_size = 99999; |
| 212 | 213 |
| 213 protected: | 214 protected: |
| 214 std::string service_name_; | 215 std::string service_name_; |
| 215 | 216 |
| 216 // A port on which the main process listens for mach messages from the child | 217 // A port on which the main process listens for mach messages from the child |
| 217 // process. | 218 // process. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 451 |
| 451 // Intentionally map with |readonly| set to |false|. | 452 // Intentionally map with |readonly| set to |false|. |
| 452 SharedMemory shared_memory2(shm2, false); | 453 SharedMemory shared_memory2(shm2, false); |
| 453 shared_memory2.Map(s_memory_size); | 454 shared_memory2.Map(s_memory_size); |
| 454 } | 455 } |
| 455 | 456 |
| 456 EXPECT_EQ(active_name_count, GetActiveNameCount()); | 457 EXPECT_EQ(active_name_count, GetActiveNameCount()); |
| 457 } | 458 } |
| 458 | 459 |
| 459 } // namespace base | 460 } // namespace base |
| OLD | NEW |