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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
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) { |
| 80 CHECK(internal::g_process_delegate); |
| 81 DCHECK(pipe.is_valid()); |
| 82 return internal::g_core->ConnectToPeerProcess(std::move(pipe)); |
| 83 } |
| 84 |
79 void Init() { | 85 void Init() { |
80 MojoSystemThunks thunks = MakeSystemThunks(); | 86 MojoSystemThunks thunks = MakeSystemThunks(); |
81 size_t expected_size = MojoEmbedderSetSystemThunks(&thunks); | 87 size_t expected_size = MojoEmbedderSetSystemThunks(&thunks); |
82 DCHECK_EQ(expected_size, sizeof(thunks)); | 88 DCHECK_EQ(expected_size, sizeof(thunks)); |
83 | 89 |
84 internal::g_core = new Core(); | 90 internal::g_core = new Core(); |
85 } | 91 } |
86 | 92 |
87 void SetDefaultProcessErrorCallback(const ProcessErrorCallback& callback) { | 93 void SetDefaultProcessErrorCallback(const ProcessErrorCallback& callback) { |
88 internal::g_core->SetDefaultProcessErrorCallback(callback); | 94 internal::g_core->SetDefaultProcessErrorCallback(callback); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 return base::HexEncode(random_bytes, 16); | 175 return base::HexEncode(random_bytes, 16); |
170 } | 176 } |
171 | 177 |
172 MojoResult SetProperty(MojoPropertyType type, const void* value) { | 178 MojoResult SetProperty(MojoPropertyType type, const void* value) { |
173 CHECK(internal::g_core); | 179 CHECK(internal::g_core); |
174 return internal::g_core->SetProperty(type, value); | 180 return internal::g_core->SetProperty(type, value); |
175 } | 181 } |
176 | 182 |
177 } // namespace edk | 183 } // namespace edk |
178 } // namespace mojo | 184 } // namespace mojo |
OLD | NEW |