Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Side by Side Diff: mojo/edk/embedder/embedder.cc

Issue 2765673002: Revert of Making the Mojo Channel Messages legacy mode dynamic. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/embedder/embedder.h ('k') | mojo/edk/system/channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
22 #include "mojo/edk/system/core.h" 21 #include "mojo/edk/system/core.h"
23 #include "mojo/edk/system/node_controller.h" 22 #include "mojo/edk/system/node_controller.h"
24 23
25 #if !defined(OS_NACL) 24 #if !defined(OS_NACL)
26 #include "crypto/random.h" 25 #include "crypto/random.h"
27 #endif 26 #endif
28 27
29 namespace mojo { 28 namespace mojo {
30 namespace edk { 29 namespace edk {
31 30
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 67 }
69 68
70 void ClosePeerConnection(const std::string& peer_token) { 69 void ClosePeerConnection(const std::string& peer_token) {
71 return internal::g_core->ClosePeerConnection(peer_token); 70 return internal::g_core->ClosePeerConnection(peer_token);
72 } 71 }
73 72
74 void Init() { 73 void Init() {
75 MojoSystemThunks thunks = MakeSystemThunks(); 74 MojoSystemThunks thunks = MakeSystemThunks();
76 size_t expected_size = MojoEmbedderSetSystemThunks(&thunks); 75 size_t expected_size = MojoEmbedderSetSystemThunks(&thunks);
77 DCHECK_EQ(expected_size, sizeof(thunks)); 76 DCHECK_EQ(expected_size, sizeof(thunks));
78 #if defined(MOJO_EDK_LEGACY_PROTOCOL) 77
79 SetUseLegacyTransportProtocol(true);
80 #endif
81 internal::g_core = new Core(); 78 internal::g_core = new Core();
82 } 79 }
83 80
84 void SetDefaultProcessErrorCallback(const ProcessErrorCallback& callback) { 81 void SetDefaultProcessErrorCallback(const ProcessErrorCallback& callback) {
85 internal::g_core->SetDefaultProcessErrorCallback(callback); 82 internal::g_core->SetDefaultProcessErrorCallback(callback);
86 } 83 }
87 84
88 void SetUseLegacyTransportProtocol(bool use_legacy_protocol) {
89 Channel::Message::SetUseLegacyTransportProtocol(use_legacy_protocol);
90 }
91
92 MojoResult CreatePlatformHandleWrapper( 85 MojoResult CreatePlatformHandleWrapper(
93 ScopedPlatformHandle platform_handle, 86 ScopedPlatformHandle platform_handle,
94 MojoHandle* platform_handle_wrapper_handle) { 87 MojoHandle* platform_handle_wrapper_handle) {
95 return internal::g_core->CreatePlatformHandleWrapper( 88 return internal::g_core->CreatePlatformHandleWrapper(
96 std::move(platform_handle), platform_handle_wrapper_handle); 89 std::move(platform_handle), platform_handle_wrapper_handle);
97 } 90 }
98 91
99 MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle, 92 MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
100 ScopedPlatformHandle* platform_handle) { 93 ScopedPlatformHandle* platform_handle) {
101 return internal::g_core->PassWrappedPlatformHandle( 94 return internal::g_core->PassWrappedPlatformHandle(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return base::HexEncode(random_bytes, 16); 149 return base::HexEncode(random_bytes, 16);
157 } 150 }
158 151
159 MojoResult SetProperty(MojoPropertyType type, const void* value) { 152 MojoResult SetProperty(MojoPropertyType type, const void* value) {
160 CHECK(internal::g_core); 153 CHECK(internal::g_core);
161 return internal::g_core->SetProperty(type, value); 154 return internal::g_core->SetProperty(type, value);
162 } 155 }
163 156
164 } // namespace edk 157 } // namespace edk
165 } // namespace mojo 158 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/embedder.h ('k') | mojo/edk/system/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698