| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ShutdownIPCSupport() { | 106 void ShutdownIPCSupport() { |
| 107 CHECK(internal::g_process_delegate); | 107 CHECK(internal::g_process_delegate); |
| 108 CHECK(internal::g_core); | 108 CHECK(internal::g_core); |
| 109 internal::g_core->RequestShutdown( | 109 internal::g_core->RequestShutdown( |
| 110 base::Bind(&ProcessDelegate::OnShutdownComplete, | 110 base::Bind(&ProcessDelegate::OnShutdownComplete, |
| 111 base::Unretained(internal::g_process_delegate))); | 111 base::Unretained(internal::g_process_delegate))); |
| 112 } | 112 } |
| 113 | 113 |
| 114 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 115 void SetMachPortProviderIfNeeded(base::PortProvider* port_provider) { |
| 116 DCHECK(port_provider); |
| 117 internal::g_core->SetMachPortProviderIfNeeded(port_provider); |
| 118 } |
| 119 #endif |
| 120 |
| 114 ScopedMessagePipeHandle CreateMessagePipe( | 121 ScopedMessagePipeHandle CreateMessagePipe( |
| 115 ScopedPlatformHandle platform_handle) { | 122 ScopedPlatformHandle platform_handle) { |
| 116 CHECK(internal::g_process_delegate); | 123 CHECK(internal::g_process_delegate); |
| 117 return internal::g_core->CreateMessagePipe(std::move(platform_handle)); | 124 return internal::g_core->CreateMessagePipe(std::move(platform_handle)); |
| 118 } | 125 } |
| 119 | 126 |
| 120 ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token) { | 127 ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token) { |
| 121 CHECK(internal::g_process_delegate); | 128 CHECK(internal::g_process_delegate); |
| 122 return internal::g_core->CreateParentMessagePipe(token); | 129 return internal::g_core->CreateParentMessagePipe(token); |
| 123 } | 130 } |
| 124 | 131 |
| 125 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { | 132 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { |
| 126 CHECK(internal::g_process_delegate); | 133 CHECK(internal::g_process_delegate); |
| 127 return internal::g_core->CreateChildMessagePipe(token); | 134 return internal::g_core->CreateChildMessagePipe(token); |
| 128 } | 135 } |
| 129 | 136 |
| 130 std::string GenerateRandomToken() { | 137 std::string GenerateRandomToken() { |
| 131 char random_bytes[16]; | 138 char random_bytes[16]; |
| 132 crypto::RandBytes(random_bytes, 16); | 139 crypto::RandBytes(random_bytes, 16); |
| 133 return base::HexEncode(random_bytes, 16); | 140 return base::HexEncode(random_bytes, 16); |
| 134 } | 141 } |
| 135 | 142 |
| 136 } // namespace edk | 143 } // namespace edk |
| 137 } // namespace mojo | 144 } // namespace mojo |
| OLD | NEW |