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

Side by Side Diff: mojo/edk/system/node_channel.h

Issue 2738853002: Connections now take a ConnectionParams instead of a pipe handle. (Closed)
Patch Set: Fix Win release build. 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/system/core.cc ('k') | mojo/edk/system/node_channel.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef MOJO_EDK_SYSTEM_NODE_CHANNEL_H_ 5 #ifndef MOJO_EDK_SYSTEM_NODE_CHANNEL_H_
6 #define MOJO_EDK_SYSTEM_NODE_CHANNEL_H_ 6 #define MOJO_EDK_SYSTEM_NODE_CHANNEL_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/process/process_handle.h" 15 #include "base/process/process_handle.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "base/task_runner.h" 17 #include "base/task_runner.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "mojo/edk/embedder/connection_params.h"
19 #include "mojo/edk/embedder/embedder.h" 20 #include "mojo/edk/embedder/embedder.h"
20 #include "mojo/edk/embedder/platform_handle_vector.h" 21 #include "mojo/edk/embedder/platform_handle_vector.h"
21 #include "mojo/edk/embedder/scoped_platform_handle.h" 22 #include "mojo/edk/embedder/scoped_platform_handle.h"
22 #include "mojo/edk/system/channel.h" 23 #include "mojo/edk/system/channel.h"
23 #include "mojo/edk/system/ports/name.h" 24 #include "mojo/edk/system/ports/name.h"
24 25
25 #if defined(OS_MACOSX) && !defined(OS_IOS) 26 #if defined(OS_MACOSX) && !defined(OS_IOS)
26 #include "mojo/edk/system/mach_port_relay.h" 27 #include "mojo/edk/system/mach_port_relay.h"
27 #endif 28 #endif
28 29
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 virtual void OnChannelError(const ports::NodeName& node, 84 virtual void OnChannelError(const ports::NodeName& node,
84 NodeChannel* channel) = 0; 85 NodeChannel* channel) = 0;
85 86
86 #if defined(OS_MACOSX) && !defined(OS_IOS) 87 #if defined(OS_MACOSX) && !defined(OS_IOS)
87 virtual MachPortRelay* GetMachPortRelay() = 0; 88 virtual MachPortRelay* GetMachPortRelay() = 0;
88 #endif 89 #endif
89 }; 90 };
90 91
91 static scoped_refptr<NodeChannel> Create( 92 static scoped_refptr<NodeChannel> Create(
92 Delegate* delegate, 93 Delegate* delegate,
93 ScopedPlatformHandle platform_handle, 94 ConnectionParams connection_params,
94 scoped_refptr<base::TaskRunner> io_task_runner, 95 scoped_refptr<base::TaskRunner> io_task_runner,
95 const ProcessErrorCallback& process_error_callback); 96 const ProcessErrorCallback& process_error_callback);
96 97
97 static Channel::MessagePtr CreatePortsMessage(size_t payload_size, 98 static Channel::MessagePtr CreatePortsMessage(size_t payload_size,
98 void** payload, 99 void** payload,
99 size_t num_handles); 100 size_t num_handles);
100 101
101 static void GetPortsMessageData(Channel::Message* message, void** data, 102 static void GetPortsMessageData(Channel::Message* message, void** data,
102 size_t* num_data_bytes); 103 size_t* num_data_bytes);
103 104
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 #endif 161 #endif
161 162
162 private: 163 private:
163 friend class base::RefCountedThreadSafe<NodeChannel>; 164 friend class base::RefCountedThreadSafe<NodeChannel>;
164 165
165 using PendingMessageQueue = std::queue<Channel::MessagePtr>; 166 using PendingMessageQueue = std::queue<Channel::MessagePtr>;
166 using PendingRelayMessageQueue = 167 using PendingRelayMessageQueue =
167 std::queue<std::pair<ports::NodeName, Channel::MessagePtr>>; 168 std::queue<std::pair<ports::NodeName, Channel::MessagePtr>>;
168 169
169 NodeChannel(Delegate* delegate, 170 NodeChannel(Delegate* delegate,
170 ScopedPlatformHandle platform_handle, 171 ConnectionParams connection_params,
171 scoped_refptr<base::TaskRunner> io_task_runner, 172 scoped_refptr<base::TaskRunner> io_task_runner,
172 const ProcessErrorCallback& process_error_callback); 173 const ProcessErrorCallback& process_error_callback);
173 ~NodeChannel() override; 174 ~NodeChannel() override;
174 175
175 // Channel::Delegate: 176 // Channel::Delegate:
176 void OnChannelMessage(const void* payload, 177 void OnChannelMessage(const void* payload,
177 size_t payload_size, 178 size_t payload_size,
178 ScopedPlatformHandleVectorPtr handles) override; 179 ScopedPlatformHandleVectorPtr handles) override;
179 void OnChannelError() override; 180 void OnChannelError() override;
180 181
(...skipping 28 matching lines...) Expand all
209 PendingRelayMessageQueue pending_relay_messages_; 210 PendingRelayMessageQueue pending_relay_messages_;
210 #endif 211 #endif
211 212
212 DISALLOW_COPY_AND_ASSIGN(NodeChannel); 213 DISALLOW_COPY_AND_ASSIGN(NodeChannel);
213 }; 214 };
214 215
215 } // namespace edk 216 } // namespace edk
216 } // namespace mojo 217 } // namespace mojo
217 218
218 #endif // MOJO_EDK_SYSTEM_NODE_CHANNEL_H_ 219 #endif // MOJO_EDK_SYSTEM_NODE_CHANNEL_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/core.cc ('k') | mojo/edk/system/node_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698