| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/task_runner.h" | 16 #include "base/task_runner.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "mojo/edk/embedder/embedder_internal.h" | 18 #include "mojo/edk/embedder/embedder_internal.h" |
| 19 #include "mojo/edk/embedder/entrypoints.h" | 19 #include "mojo/edk/embedder/entrypoints.h" |
| 20 #include "mojo/edk/embedder/platform_channel_pair.h" | 20 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 21 #include "mojo/edk/system/channel.h" |
| 21 #include "mojo/edk/system/core.h" | 22 #include "mojo/edk/system/core.h" |
| 22 #include "mojo/edk/system/node_controller.h" | 23 #include "mojo/edk/system/node_controller.h" |
| 23 | 24 |
| 24 #if !defined(OS_NACL) | 25 #if !defined(OS_NACL) |
| 25 #include "crypto/random.h" | 26 #include "crypto/random.h" |
| 26 #endif | 27 #endif |
| 27 | 28 |
| 28 namespace mojo { | 29 namespace mojo { |
| 29 namespace edk { | 30 namespace edk { |
| 30 | 31 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 size_t expected_size = MojoEmbedderSetSystemThunks(&thunks); | 76 size_t expected_size = MojoEmbedderSetSystemThunks(&thunks); |
| 76 DCHECK_EQ(expected_size, sizeof(thunks)); | 77 DCHECK_EQ(expected_size, sizeof(thunks)); |
| 77 | 78 |
| 78 internal::g_core = new Core(); | 79 internal::g_core = new Core(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void SetDefaultProcessErrorCallback(const ProcessErrorCallback& callback) { | 82 void SetDefaultProcessErrorCallback(const ProcessErrorCallback& callback) { |
| 82 internal::g_core->SetDefaultProcessErrorCallback(callback); | 83 internal::g_core->SetDefaultProcessErrorCallback(callback); |
| 83 } | 84 } |
| 84 | 85 |
| 86 void SetUseLegacyTransportProtocol(bool use_legacy_protocol) { |
| 87 Channel::Message::SetUseLegacyTransportProtocol(use_legacy_protocol); |
| 88 } |
| 89 |
| 85 MojoResult CreatePlatformHandleWrapper( | 90 MojoResult CreatePlatformHandleWrapper( |
| 86 ScopedPlatformHandle platform_handle, | 91 ScopedPlatformHandle platform_handle, |
| 87 MojoHandle* platform_handle_wrapper_handle) { | 92 MojoHandle* platform_handle_wrapper_handle) { |
| 88 return internal::g_core->CreatePlatformHandleWrapper( | 93 return internal::g_core->CreatePlatformHandleWrapper( |
| 89 std::move(platform_handle), platform_handle_wrapper_handle); | 94 std::move(platform_handle), platform_handle_wrapper_handle); |
| 90 } | 95 } |
| 91 | 96 |
| 92 MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle, | 97 MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle, |
| 93 ScopedPlatformHandle* platform_handle) { | 98 ScopedPlatformHandle* platform_handle) { |
| 94 return internal::g_core->PassWrappedPlatformHandle( | 99 return internal::g_core->PassWrappedPlatformHandle( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return base::HexEncode(random_bytes, 16); | 154 return base::HexEncode(random_bytes, 16); |
| 150 } | 155 } |
| 151 | 156 |
| 152 MojoResult SetProperty(MojoPropertyType type, const void* value) { | 157 MojoResult SetProperty(MojoPropertyType type, const void* value) { |
| 153 CHECK(internal::g_core); | 158 CHECK(internal::g_core); |
| 154 return internal::g_core->SetProperty(type, value); | 159 return internal::g_core->SetProperty(type, value); |
| 155 } | 160 } |
| 156 | 161 |
| 157 } // namespace edk | 162 } // namespace edk |
| 158 } // namespace mojo | 163 } // namespace mojo |
| OLD | NEW |