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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 internal::g_core->RequestShutdown(callback); | 148 internal::g_core->RequestShutdown(callback); |
149 } | 149 } |
150 | 150 |
151 #if defined(OS_MACOSX) && !defined(OS_IOS) | 151 #if defined(OS_MACOSX) && !defined(OS_IOS) |
152 void SetMachPortProvider(base::PortProvider* port_provider) { | 152 void SetMachPortProvider(base::PortProvider* port_provider) { |
153 DCHECK(port_provider); | 153 DCHECK(port_provider); |
154 internal::g_core->SetMachPortProvider(port_provider); | 154 internal::g_core->SetMachPortProvider(port_provider); |
155 } | 155 } |
156 #endif | 156 #endif |
157 | 157 |
158 ScopedMessagePipeHandle CreateMessagePipe( | |
159 ScopedPlatformHandle platform_handle) { | |
160 return internal::g_core->CreateMessagePipe(std::move(platform_handle)); | |
161 } | |
162 | |
163 ScopedMessagePipeHandle CreateParentMessagePipe( | 158 ScopedMessagePipeHandle CreateParentMessagePipe( |
164 const std::string& token, const std::string& child_token) { | 159 const std::string& token, const std::string& child_token) { |
165 return internal::g_core->CreateParentMessagePipe(token, child_token); | 160 return internal::g_core->CreateParentMessagePipe(token, child_token); |
166 } | 161 } |
167 | 162 |
168 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { | 163 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { |
169 return internal::g_core->CreateChildMessagePipe(token); | 164 return internal::g_core->CreateChildMessagePipe(token); |
170 } | 165 } |
171 | 166 |
172 std::string GenerateRandomToken() { | 167 std::string GenerateRandomToken() { |
173 char random_bytes[16]; | 168 char random_bytes[16]; |
174 #if defined(OS_NACL) | 169 #if defined(OS_NACL) |
175 // Not secure. For NaCl only! | 170 // Not secure. For NaCl only! |
176 base::RandBytes(random_bytes, 16); | 171 base::RandBytes(random_bytes, 16); |
177 #else | 172 #else |
178 crypto::RandBytes(random_bytes, 16); | 173 crypto::RandBytes(random_bytes, 16); |
179 #endif | 174 #endif |
180 return base::HexEncode(random_bytes, 16); | 175 return base::HexEncode(random_bytes, 16); |
181 } | 176 } |
182 | 177 |
183 MojoResult SetProperty(MojoPropertyType type, const void* value) { | 178 MojoResult SetProperty(MojoPropertyType type, const void* value) { |
184 CHECK(internal::g_core); | 179 CHECK(internal::g_core); |
185 return internal::g_core->SetProperty(type, value); | 180 return internal::g_core->SetProperty(type, value); |
186 } | 181 } |
187 | 182 |
188 } // namespace edk | 183 } // namespace edk |
189 } // namespace mojo | 184 } // namespace mojo |
OLD | NEW |