| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 void SetParentPipeHandle(ScopedPlatformHandle pipe) { | 52 void SetParentPipeHandle(ScopedPlatformHandle pipe) { |
| 53 CHECK(internal::g_core); | 53 CHECK(internal::g_core); |
| 54 internal::g_core->InitChild(std::move(pipe)); | 54 internal::g_core->InitChild(std::move(pipe)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void SetParentPipeHandleFromCommandLine() { | 57 void SetParentPipeHandleFromCommandLine() { |
| 58 ScopedPlatformHandle platform_channel = | 58 ScopedPlatformHandle platform_channel = |
| 59 PlatformChannelPair::PassClientHandleFromParentProcess( | 59 PlatformChannelPair::PassClientHandleFromParentProcess( |
| 60 *base::CommandLine::ForCurrentProcess()); | 60 *base::CommandLine::ForCurrentProcess()); |
| 61 if (platform_channel.is_valid()) | 61 CHECK(platform_channel.is_valid()); |
| 62 SetParentPipeHandle(std::move(platform_channel)); | 62 SetParentPipeHandle(std::move(platform_channel)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void Init() { | 65 void Init() { |
| 66 internal::g_core = new Core(); | 66 internal::g_core = new Core(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 MojoResult AsyncWait(MojoHandle handle, | 69 MojoResult AsyncWait(MojoHandle handle, |
| 70 MojoHandleSignals signals, | 70 MojoHandleSignals signals, |
| 71 const base::Callback<void(MojoResult)>& callback) { | 71 const base::Callback<void(MojoResult)>& callback) { |
| 72 CHECK(internal::g_core); | 72 CHECK(internal::g_core); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 136 } |
| 137 | 137 |
| 138 std::string GenerateRandomToken() { | 138 std::string GenerateRandomToken() { |
| 139 char random_bytes[16]; | 139 char random_bytes[16]; |
| 140 crypto::RandBytes(random_bytes, 16); | 140 crypto::RandBytes(random_bytes, 16); |
| 141 return base::HexEncode(random_bytes, 16); | 141 return base::HexEncode(random_bytes, 16); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace edk | 144 } // namespace edk |
| 145 } // namespace mojo | 145 } // namespace mojo |
| OLD | NEW |