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

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

Issue 2466433002: Add mojo::edk::ClosePeerConnection. (Closed)
Patch Set: Created 4 years, 1 month 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/embedder/embedder_unittest.cc » ('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 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 79 ScopedMessagePipeHandle ConnectToPeerProcess(ScopedPlatformHandle pipe) {
80 return ConnectToPeerProcess(std::move(pipe), GenerateRandomToken());
81 }
82
83 ScopedMessagePipeHandle ConnectToPeerProcess(ScopedPlatformHandle pipe,
84 const std::string& peer_token) {
80 CHECK(internal::g_process_delegate); 85 CHECK(internal::g_process_delegate);
81 DCHECK(pipe.is_valid()); 86 DCHECK(pipe.is_valid());
82 return internal::g_core->ConnectToPeerProcess(std::move(pipe)); 87 DCHECK(!peer_token.empty());
88 return internal::g_core->ConnectToPeerProcess(std::move(pipe), peer_token);
89 }
90
91 void ClosePeerConnection(const std::string& peer_token) {
92 CHECK(internal::g_process_delegate);
93 return internal::g_core->ClosePeerConnection(peer_token);
83 } 94 }
84 95
85 void Init() { 96 void Init() {
86 MojoSystemThunks thunks = MakeSystemThunks(); 97 MojoSystemThunks thunks = MakeSystemThunks();
87 size_t expected_size = MojoEmbedderSetSystemThunks(&thunks); 98 size_t expected_size = MojoEmbedderSetSystemThunks(&thunks);
88 DCHECK_EQ(expected_size, sizeof(thunks)); 99 DCHECK_EQ(expected_size, sizeof(thunks));
89 100
90 internal::g_core = new Core(); 101 internal::g_core = new Core();
91 } 102 }
92 103
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return base::HexEncode(random_bytes, 16); 186 return base::HexEncode(random_bytes, 16);
176 } 187 }
177 188
178 MojoResult SetProperty(MojoPropertyType type, const void* value) { 189 MojoResult SetProperty(MojoPropertyType type, const void* value) {
179 CHECK(internal::g_core); 190 CHECK(internal::g_core);
180 return internal::g_core->SetProperty(type, value); 191 return internal::g_core->SetProperty(type, value);
181 } 192 }
182 193
183 } // namespace edk 194 } // namespace edk
184 } // namespace mojo 195 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/embedder.h ('k') | mojo/edk/embedder/embedder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698