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

Unified Diff: mojo/edk/system/node_controller.cc

Issue 1740093002: [mojo-edk] Pass process handle through the broker on all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Maybe fix build? Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/node_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/node_controller.cc
diff --git a/mojo/edk/system/node_controller.cc b/mojo/edk/system/node_controller.cc
index 4c211acaf708b121f1da2d644fda90e99130beea..01fd33b734c683de253bd918e16a3a87e4d48273 100644
--- a/mojo/edk/system/node_controller.cc
+++ b/mojo/edk/system/node_controller.cc
@@ -577,7 +577,12 @@ void NodeController::OnAcceptParent(const ports::NodeName& from_node,
void NodeController::OnAddBrokerClient(const ports::NodeName& from_node,
const ports::NodeName& client_name,
- ScopedPlatformHandle process_handle) {
+ base::ProcessHandle process_handle) {
+#if defined(OS_WIN)
+ // Scoped handle to avoid leaks on error.
+ ScopedPlatformHandle scoped_process_handle =
+ ScopedPlatformHandle(PlatformHandle(process_handle));
+#endif
scoped_refptr<NodeChannel> sender = GetPeerChannel(from_node);
if (!sender) {
DLOG(ERROR) << "Ignoring AddBrokerClient from unknown sender.";
@@ -597,11 +602,13 @@ void NodeController::OnAddBrokerClient(const ports::NodeName& from_node,
#if defined(OS_WIN)
// The broker must have a working handle to the client process in order to
// properly copy other handles to and from the client.
- if(!process_handle.is_valid()) {
+ if (!scoped_process_handle.is_valid()) {
DLOG(ERROR) << "Broker rejecting client with invalid process handle.";
return;
}
- client->SetRemoteProcessHandle(process_handle.release().handle);
+ client->SetRemoteProcessHandle(scoped_process_handle.release().handle);
+#else
+ client->SetRemoteProcessHandle(process_handle);
#endif
AddPeer(client_name, client, true /* start_channel */);
« no previous file with comments | « mojo/edk/system/node_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698