| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 void SetParentPipeHandleFromCommandLine() { | 71 void SetParentPipeHandleFromCommandLine() { |
| 72 ScopedPlatformHandle platform_channel = | 72 ScopedPlatformHandle platform_channel = |
| 73 PlatformChannelPair::PassClientHandleFromParentProcess( | 73 PlatformChannelPair::PassClientHandleFromParentProcess( |
| 74 *base::CommandLine::ForCurrentProcess()); | 74 *base::CommandLine::ForCurrentProcess()); |
| 75 CHECK(platform_channel.is_valid()); | 75 CHECK(platform_channel.is_valid()); |
| 76 SetParentPipeHandle(std::move(platform_channel)); | 76 SetParentPipeHandle(std::move(platform_channel)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 ScopedMessagePipeHandle ConnectToPeerProcess(ScopedPlatformHandle pipe) { | 79 ScopedMessagePipeHandle ConnectToPeerProcess(ScopedPlatformHandle pipe) { |
| 80 return ConnectToPeerProcess(std::move(pipe), GenerateRandomToken()); |
| 81 } |
| 82 |
| 83 ScopedMessagePipeHandle ConnectToPeerProcess(ScopedPlatformHandle pipe, |
| 84 const std::string& peer_token) { |
| 80 CHECK(internal::g_process_delegate); | 85 CHECK(internal::g_process_delegate); |
| 81 DCHECK(pipe.is_valid()); | 86 DCHECK(pipe.is_valid()); |
| 82 return internal::g_core->ConnectToPeerProcess(std::move(pipe)); | 87 DCHECK(!peer_token.empty()); |
| 88 return internal::g_core->ConnectToPeerProcess(std::move(pipe), peer_token); |
| 89 } |
| 90 |
| 91 void ClosePeerConnection(const std::string& peer_token) { |
| 92 CHECK(internal::g_process_delegate); |
| 93 return internal::g_core->ClosePeerConnection(peer_token); |
| 83 } | 94 } |
| 84 | 95 |
| 85 void Init() { | 96 void Init() { |
| 86 MojoSystemThunks thunks = MakeSystemThunks(); | 97 MojoSystemThunks thunks = MakeSystemThunks(); |
| 87 size_t expected_size = MojoEmbedderSetSystemThunks(&thunks); | 98 size_t expected_size = MojoEmbedderSetSystemThunks(&thunks); |
| 88 DCHECK_EQ(expected_size, sizeof(thunks)); | 99 DCHECK_EQ(expected_size, sizeof(thunks)); |
| 89 | 100 |
| 90 internal::g_core = new Core(); | 101 internal::g_core = new Core(); |
| 91 } | 102 } |
| 92 | 103 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 return base::HexEncode(random_bytes, 16); | 186 return base::HexEncode(random_bytes, 16); |
| 176 } | 187 } |
| 177 | 188 |
| 178 MojoResult SetProperty(MojoPropertyType type, const void* value) { | 189 MojoResult SetProperty(MojoPropertyType type, const void* value) { |
| 179 CHECK(internal::g_core); | 190 CHECK(internal::g_core); |
| 180 return internal::g_core->SetProperty(type, value); | 191 return internal::g_core->SetProperty(type, value); |
| 181 } | 192 } |
| 182 | 193 |
| 183 } // namespace edk | 194 } // namespace edk |
| 184 } // namespace mojo | 195 } // namespace mojo |
| OLD | NEW |