| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/embedder.h" | 5 #include "mojo/edk/embedder/embedder.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ShutdownIPCSupport() { | 114 void ShutdownIPCSupport() { |
| 115 CHECK(internal::g_process_delegate); | 115 CHECK(internal::g_process_delegate); |
| 116 CHECK(internal::g_core); | 116 CHECK(internal::g_core); |
| 117 internal::g_core->RequestShutdown( | 117 internal::g_core->RequestShutdown( |
| 118 base::Bind(&ProcessDelegate::OnShutdownComplete, | 118 base::Bind(&ProcessDelegate::OnShutdownComplete, |
| 119 base::Unretained(internal::g_process_delegate))); | 119 base::Unretained(internal::g_process_delegate))); |
| 120 } | 120 } |
| 121 | 121 |
| 122 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 123 void SetMachPortProvider(base::PortProvider* port_provider) { |
| 124 DCHECK(port_provider); |
| 125 internal::g_core->SetMachPortProvider(port_provider); |
| 126 } |
| 127 #endif |
| 128 |
| 122 ScopedMessagePipeHandle CreateMessagePipe( | 129 ScopedMessagePipeHandle CreateMessagePipe( |
| 123 ScopedPlatformHandle platform_handle) { | 130 ScopedPlatformHandle platform_handle) { |
| 124 CHECK(internal::g_process_delegate); | 131 CHECK(internal::g_process_delegate); |
| 125 return internal::g_core->CreateMessagePipe(std::move(platform_handle)); | 132 return internal::g_core->CreateMessagePipe(std::move(platform_handle)); |
| 126 } | 133 } |
| 127 | 134 |
| 128 ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token) { | 135 ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token) { |
| 129 CHECK(internal::g_process_delegate); | 136 CHECK(internal::g_process_delegate); |
| 130 return internal::g_core->CreateParentMessagePipe(token); | 137 return internal::g_core->CreateParentMessagePipe(token); |
| 131 } | 138 } |
| 132 | 139 |
| 133 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { | 140 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { |
| 134 CHECK(internal::g_process_delegate); | 141 CHECK(internal::g_process_delegate); |
| 135 return internal::g_core->CreateChildMessagePipe(token); | 142 return internal::g_core->CreateChildMessagePipe(token); |
| 136 } | 143 } |
| 137 | 144 |
| 138 std::string GenerateRandomToken() { | 145 std::string GenerateRandomToken() { |
| 139 char random_bytes[16]; | 146 char random_bytes[16]; |
| 140 crypto::RandBytes(random_bytes, 16); | 147 crypto::RandBytes(random_bytes, 16); |
| 141 return base::HexEncode(random_bytes, 16); | 148 return base::HexEncode(random_bytes, 16); |
| 142 } | 149 } |
| 143 | 150 |
| 144 } // namespace edk | 151 } // namespace edk |
| 145 } // namespace mojo | 152 } // namespace mojo |
| OLD | NEW |