| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/embedder/pending_process_connection.h" | 5 #include "mojo/edk/embedder/pending_process_connection.h" |
| 6 | 6 |
| 7 #include "mojo/edk/embedder/embedder.h" | 7 #include "mojo/edk/embedder/embedder.h" |
| 8 #include "mojo/edk/embedder/embedder_internal.h" | 8 #include "mojo/edk/embedder/embedder_internal.h" |
| 9 #include "mojo/edk/system/core.h" | 9 #include "mojo/edk/system/core.h" |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ScopedMessagePipeHandle PendingProcessConnection::CreateMessagePipe( | 26 ScopedMessagePipeHandle PendingProcessConnection::CreateMessagePipe( |
| 27 std::string* token) { | 27 std::string* token) { |
| 28 has_message_pipes_ = true; | 28 has_message_pipes_ = true; |
| 29 DCHECK(internal::g_core); | 29 DCHECK(internal::g_core); |
| 30 *token = GenerateRandomToken(); | 30 *token = GenerateRandomToken(); |
| 31 return internal::g_core->CreateParentMessagePipe(*token, process_token_); | 31 return internal::g_core->CreateParentMessagePipe(*token, process_token_); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void PendingProcessConnection::Connect( | 34 void PendingProcessConnection::Connect( |
| 35 base::ProcessHandle process, | 35 base::ProcessHandle process, |
| 36 ScopedPlatformHandle channel, | 36 ConnectionParam connection_param, |
| 37 const ProcessErrorCallback& error_callback) { | 37 const ProcessErrorCallback& error_callback) { |
| 38 // It's now safe to avoid cleanup in the destructor, as the lifetime of any | 38 // It's now safe to avoid cleanup in the destructor, as the lifetime of any |
| 39 // associated resources is effectively bound to the |channel| passed to | 39 // associated resources is effectively bound to the |channel| passed to |
| 40 // AddChild() below. | 40 // AddChild() below. |
| 41 DCHECK(!connected_); | 41 DCHECK(!connected_); |
| 42 connected_ = true; | 42 connected_ = true; |
| 43 | 43 |
| 44 DCHECK(internal::g_core); | 44 DCHECK(internal::g_core); |
| 45 internal::g_core->AddChild(process, std::move(channel), process_token_, | 45 internal::g_core->AddChild(process, std::move(connection_param), |
| 46 error_callback); | 46 process_token_, error_callback); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace edk | 49 } // namespace edk |
| 50 } // namespace mojo | 50 } // namespace mojo |
| OLD | NEW |