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

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

Issue 2111453002: [mojo-edk] Duplicate process handle and take ownership in NodeChannel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | 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>
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 // Permanently stop the channel from sending or receiving messages. 103 // Permanently stop the channel from sending or receiving messages.
104 void ShutDown(); 104 void ShutDown();
105 105
106 // Leaks the pipe handle instead of closing it on shutdown. 106 // Leaks the pipe handle instead of closing it on shutdown.
107 void LeakHandleOnShutdown(); 107 void LeakHandleOnShutdown();
108 108
109 // Invokes the bad message callback for this channel, if any. 109 // Invokes the bad message callback for this channel, if any.
110 void NotifyBadMessage(const std::string& error); 110 void NotifyBadMessage(const std::string& error);
111 111
112 // Note: On Windows, we take ownership of the remote process handle.
112 void SetRemoteProcessHandle(base::ProcessHandle process_handle); 113 void SetRemoteProcessHandle(base::ProcessHandle process_handle);
113 bool HasRemoteProcessHandle(); 114 bool HasRemoteProcessHandle();
114 // Note: The returned |ProcessHandle| is owned by the caller and should be 115 // Note: The returned |ProcessHandle| is owned by the caller and should be
115 // freed if necessary. 116 // freed if necessary.
116 base::ProcessHandle CopyRemoteProcessHandle(); 117 base::ProcessHandle CopyRemoteProcessHandle();
117 118
118 // Used for context in Delegate calls (via |from_node| arguments.) 119 // Used for context in Delegate calls (via |from_node| arguments.)
119 void SetRemoteNodeName(const ports::NodeName& name); 120 void SetRemoteNodeName(const ports::NodeName& name);
120 121
121 void AcceptChild(const ports::NodeName& parent_name, 122 void AcceptChild(const ports::NodeName& parent_name,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 const ProcessErrorCallback process_error_callback_; 185 const ProcessErrorCallback process_error_callback_;
185 186
186 base::Lock channel_lock_; 187 base::Lock channel_lock_;
187 scoped_refptr<Channel> channel_; 188 scoped_refptr<Channel> channel_;
188 189
189 // Must only be accessed from |io_task_runner_|'s thread. 190 // Must only be accessed from |io_task_runner_|'s thread.
190 ports::NodeName remote_node_name_; 191 ports::NodeName remote_node_name_;
191 192
192 base::Lock remote_process_handle_lock_; 193 base::Lock remote_process_handle_lock_;
193 base::ProcessHandle remote_process_handle_ = base::kNullProcessHandle; 194 base::ProcessHandle remote_process_handle_ = base::kNullProcessHandle;
195 #if defined(OS_WIN)
196 ScopedPlatformHandle scoped_remote_process_handle_;
197 #endif
194 198
195 #if defined(OS_MACOSX) && !defined(OS_IOS) 199 #if defined(OS_MACOSX) && !defined(OS_IOS)
196 base::Lock pending_mach_messages_lock_; 200 base::Lock pending_mach_messages_lock_;
197 PendingMessageQueue pending_write_messages_; 201 PendingMessageQueue pending_write_messages_;
198 PendingRelayMessageQueue pending_relay_messages_; 202 PendingRelayMessageQueue pending_relay_messages_;
199 #endif 203 #endif
200 204
201 DISALLOW_COPY_AND_ASSIGN(NodeChannel); 205 DISALLOW_COPY_AND_ASSIGN(NodeChannel);
202 }; 206 };
203 207
204 } // namespace edk 208 } // namespace edk
205 } // namespace mojo 209 } // namespace mojo
206 210
207 #endif // MOJO_EDK_SYSTEM_NODE_CHANNEL_H_ 211 #endif // MOJO_EDK_SYSTEM_NODE_CHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/node_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698