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 "mojo/edk/system/ipc_support.h" | 5 #include "mojo/edk/system/ipc_support.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "mojo/edk/embedder/master_process_delegate.h" | 8 #include "mojo/edk/embedder/master_process_delegate.h" |
9 #include "mojo/edk/embedder/slave_process_delegate.h" | 9 #include "mojo/edk/embedder/slave_process_delegate.h" |
10 #include "mojo/edk/system/channel_manager.h" | 10 #include "mojo/edk/system/channel_manager.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 DCHECK(slave_process_identifier); | 134 DCHECK(slave_process_identifier); |
135 DCHECK_EQ(process_type_, embedder::ProcessType::MASTER); | 135 DCHECK_EQ(process_type_, embedder::ProcessType::MASTER); |
136 | 136 |
137 *slave_process_identifier = | 137 *slave_process_identifier = |
138 static_cast<system::MasterConnectionManager*>(connection_manager()) | 138 static_cast<system::MasterConnectionManager*>(connection_manager()) |
139 ->AddSlaveAndBootstrap(slave_info, platform_handle.Pass(), | 139 ->AddSlaveAndBootstrap(slave_info, platform_handle.Pass(), |
140 connection_id); | 140 connection_id); |
141 | 141 |
142 system::ProcessIdentifier peer_id = system::kInvalidProcessIdentifier; | 142 system::ProcessIdentifier peer_id = system::kInvalidProcessIdentifier; |
143 embedder::ScopedPlatformHandle platform_connection_handle; | 143 embedder::ScopedPlatformHandle platform_connection_handle; |
144 CHECK_EQ(connection_manager()->Connect(connection_id, &peer_id, | 144 CHECK(connection_manager()->Connect(connection_id, &peer_id, |
145 &platform_connection_handle), | 145 &platform_connection_handle)); |
146 ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION); | |
147 DCHECK_EQ(peer_id, *slave_process_identifier); | 146 DCHECK_EQ(peer_id, *slave_process_identifier); |
148 DCHECK(platform_connection_handle.is_valid()); | 147 DCHECK(platform_connection_handle.is_valid()); |
149 return platform_connection_handle; | 148 return platform_connection_handle; |
150 } | 149 } |
151 | 150 |
152 embedder::ScopedPlatformHandle IPCSupport::ConnectToMasterInternal( | 151 embedder::ScopedPlatformHandle IPCSupport::ConnectToMasterInternal( |
153 const ConnectionIdentifier& connection_id) { | 152 const ConnectionIdentifier& connection_id) { |
154 DCHECK_EQ(process_type_, embedder::ProcessType::SLAVE); | 153 DCHECK_EQ(process_type_, embedder::ProcessType::SLAVE); |
155 | 154 |
156 system::ProcessIdentifier peer_id; | 155 system::ProcessIdentifier peer_id; |
157 embedder::ScopedPlatformHandle platform_connection_handle; | 156 embedder::ScopedPlatformHandle platform_connection_handle; |
158 CHECK_EQ(connection_manager()->Connect(connection_id, &peer_id, | 157 CHECK(connection_manager()->Connect(connection_id, &peer_id, |
159 &platform_connection_handle), | 158 &platform_connection_handle)); |
160 ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION); | |
161 DCHECK_EQ(peer_id, system::kMasterProcessIdentifier); | 159 DCHECK_EQ(peer_id, system::kMasterProcessIdentifier); |
162 DCHECK(platform_connection_handle.is_valid()); | 160 DCHECK(platform_connection_handle.is_valid()); |
163 return platform_connection_handle; | 161 return platform_connection_handle; |
164 } | 162 } |
165 | 163 |
166 } // namespace system | 164 } // namespace system |
167 } // namespace mojo | 165 } // namespace mojo |
OLD | NEW |