| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void ShutdownIPCSupport() { | 100 void ShutdownIPCSupport() { |
| 101 CHECK(internal::g_process_delegate); | 101 CHECK(internal::g_process_delegate); |
| 102 CHECK(internal::g_core); | 102 CHECK(internal::g_core); |
| 103 internal::g_core->RequestShutdown( | 103 internal::g_core->RequestShutdown( |
| 104 base::Bind(&ProcessDelegate::OnShutdownComplete, | 104 base::Bind(&ProcessDelegate::OnShutdownComplete, |
| 105 base::Unretained(internal::g_process_delegate))); | 105 base::Unretained(internal::g_process_delegate))); |
| 106 } | 106 } |
| 107 | 107 |
| 108 ScopedMessagePipeHandle CreateMessagePipe( | 108 ScopedMessagePipeHandle CreateMessagePipe( |
| 109 ScopedPlatformHandle platform_handle) { | 109 ScopedPlatformHandle platform_handle) { |
| 110 DCHECK(internal::g_core); | 110 CHECK(internal::g_process_delegate); |
| 111 CHECK(internal::g_core); |
| 111 return internal::g_core->CreateMessagePipe(std::move(platform_handle)); | 112 return internal::g_core->CreateMessagePipe(std::move(platform_handle)); |
| 112 } | 113 } |
| 113 | 114 |
| 114 ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token) { | 115 ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token) { |
| 115 DCHECK(internal::g_core); | 116 CHECK(internal::g_process_delegate); |
| 117 CHECK(internal::g_core); |
| 116 return internal::g_core->CreateParentMessagePipe(token); | 118 return internal::g_core->CreateParentMessagePipe(token); |
| 117 } | 119 } |
| 118 | 120 |
| 119 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { | 121 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { |
| 120 DCHECK(internal::g_core); | 122 CHECK(internal::g_process_delegate); |
| 123 CHECK(internal::g_core); |
| 121 return internal::g_core->CreateChildMessagePipe(token); | 124 return internal::g_core->CreateChildMessagePipe(token); |
| 122 } | 125 } |
| 123 | 126 |
| 124 std::string GenerateRandomToken() { | 127 std::string GenerateRandomToken() { |
| 125 char random_bytes[16]; | 128 char random_bytes[16]; |
| 126 crypto::RandBytes(random_bytes, 16); | 129 crypto::RandBytes(random_bytes, 16); |
| 127 return base::HexEncode(random_bytes, 16); | 130 return base::HexEncode(random_bytes, 16); |
| 128 } | 131 } |
| 129 | 132 |
| 130 } // namespace edk | 133 } // namespace edk |
| 131 } // namespace mojo | 134 } // namespace mojo |
| OLD | NEW |