| 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 20 matching lines...) Expand all Loading... |
| 31 ProcessDelegate* g_process_delegate; | 31 ProcessDelegate* g_process_delegate; |
| 32 | 32 |
| 33 Core* GetCore() { return g_core; } | 33 Core* GetCore() { return g_core; } |
| 34 | 34 |
| 35 } // namespace internal | 35 } // namespace internal |
| 36 | 36 |
| 37 void SetMaxMessageSize(size_t bytes) { | 37 void SetMaxMessageSize(size_t bytes) { |
| 38 } | 38 } |
| 39 | 39 |
| 40 void ChildProcessLaunched(base::ProcessHandle child_process, | 40 void ChildProcessLaunched(base::ProcessHandle child_process, |
| 41 ScopedPlatformHandle server_pipe) { | 41 ScopedPlatformHandle server_pipe, |
| 42 const std::string& child_token) { |
| 42 CHECK(internal::g_core); | 43 CHECK(internal::g_core); |
| 43 internal::g_core->AddChild(child_process, std::move(server_pipe)); | 44 internal::g_core->AddChild(child_process, std::move(server_pipe), |
| 45 child_token); |
| 46 } |
| 47 |
| 48 void ChildProcessLaunchFailed(const std::string& child_token) { |
| 49 CHECK(internal::g_core); |
| 50 internal::g_core->ChildLaunchFailed(child_token); |
| 44 } | 51 } |
| 45 | 52 |
| 46 void SetParentPipeHandle(ScopedPlatformHandle pipe) { | 53 void SetParentPipeHandle(ScopedPlatformHandle pipe) { |
| 47 CHECK(internal::g_core); | 54 CHECK(internal::g_core); |
| 48 internal::g_core->InitChild(std::move(pipe)); | 55 internal::g_core->InitChild(std::move(pipe)); |
| 49 } | 56 } |
| 50 | 57 |
| 51 void SetParentPipeHandleFromCommandLine() { | 58 void SetParentPipeHandleFromCommandLine() { |
| 52 ScopedPlatformHandle platform_channel = | 59 ScopedPlatformHandle platform_channel = |
| 53 PlatformChannelPair::PassClientHandleFromParentProcess( | 60 PlatformChannelPair::PassClientHandleFromParentProcess( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 internal::g_core->SetMachPortProvider(port_provider); | 126 internal::g_core->SetMachPortProvider(port_provider); |
| 120 } | 127 } |
| 121 #endif | 128 #endif |
| 122 | 129 |
| 123 ScopedMessagePipeHandle CreateMessagePipe( | 130 ScopedMessagePipeHandle CreateMessagePipe( |
| 124 ScopedPlatformHandle platform_handle) { | 131 ScopedPlatformHandle platform_handle) { |
| 125 CHECK(internal::g_process_delegate); | 132 CHECK(internal::g_process_delegate); |
| 126 return internal::g_core->CreateMessagePipe(std::move(platform_handle)); | 133 return internal::g_core->CreateMessagePipe(std::move(platform_handle)); |
| 127 } | 134 } |
| 128 | 135 |
| 129 ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token) { | 136 ScopedMessagePipeHandle CreateParentMessagePipe( |
| 137 const std::string& token, const std::string& child_token) { |
| 130 CHECK(internal::g_process_delegate); | 138 CHECK(internal::g_process_delegate); |
| 131 return internal::g_core->CreateParentMessagePipe(token); | 139 return internal::g_core->CreateParentMessagePipe(token, child_token); |
| 132 } | 140 } |
| 133 | 141 |
| 134 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { | 142 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { |
| 135 CHECK(internal::g_process_delegate); | 143 CHECK(internal::g_process_delegate); |
| 136 return internal::g_core->CreateChildMessagePipe(token); | 144 return internal::g_core->CreateChildMessagePipe(token); |
| 137 } | 145 } |
| 138 | 146 |
| 139 std::string GenerateRandomToken() { | 147 std::string GenerateRandomToken() { |
| 140 char random_bytes[16]; | 148 char random_bytes[16]; |
| 141 crypto::RandBytes(random_bytes, 16); | 149 crypto::RandBytes(random_bytes, 16); |
| 142 return base::HexEncode(random_bytes, 16); | 150 return base::HexEncode(random_bytes, 16); |
| 143 } | 151 } |
| 144 | 152 |
| 145 } // namespace edk | 153 } // namespace edk |
| 146 } // namespace mojo | 154 } // namespace mojo |
| OLD | NEW |