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

Side by Side Diff: mojo/edk/system/core.cc

Issue 1957893002: Avoid initializing child processes with an invalid parent pipe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/system/core.h" 5 #include "mojo/edk/system/core.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return handles_.GetDispatcher(handle); 80 return handles_.GetDispatcher(handle);
81 } 81 }
82 82
83 void Core::AddChild(base::ProcessHandle process_handle, 83 void Core::AddChild(base::ProcessHandle process_handle,
84 ScopedPlatformHandle platform_handle) { 84 ScopedPlatformHandle platform_handle) {
85 GetNodeController()->ConnectToChild(process_handle, 85 GetNodeController()->ConnectToChild(process_handle,
86 std::move(platform_handle)); 86 std::move(platform_handle));
87 } 87 }
88 88
89 void Core::InitChild(ScopedPlatformHandle platform_handle) { 89 void Core::InitChild(ScopedPlatformHandle platform_handle) {
90 GetNodeController()->ConnectToParent(std::move(platform_handle)); 90 if (platform_handle.is_valid())
91 GetNodeController()->ConnectToParent(std::move(platform_handle));
91 } 92 }
92 93
93 MojoHandle Core::AddDispatcher(scoped_refptr<Dispatcher> dispatcher) { 94 MojoHandle Core::AddDispatcher(scoped_refptr<Dispatcher> dispatcher) {
94 base::AutoLock lock(handles_lock_); 95 base::AutoLock lock(handles_lock_);
95 return handles_.AddDispatcher(dispatcher); 96 return handles_.AddDispatcher(dispatcher);
96 } 97 }
97 98
98 bool Core::AddDispatchersFromTransit( 99 bool Core::AddDispatchersFromTransit(
99 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers, 100 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers,
100 MojoHandle* handles) { 101 MojoHandle* handles) {
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 scoped_ptr<NodeController> node_controller) { 770 scoped_ptr<NodeController> node_controller) {
770 // It's OK to leak this reference. At this point we know the IO loop is still 771 // It's OK to leak this reference. At this point we know the IO loop is still
771 // running, and we know the NodeController will observe its eventual 772 // running, and we know the NodeController will observe its eventual
772 // destruction. This tells the NodeController to delete itself when that 773 // destruction. This tells the NodeController to delete itself when that
773 // happens. 774 // happens.
774 node_controller.release()->DestroyOnIOThreadShutdown(); 775 node_controller.release()->DestroyOnIOThreadShutdown();
775 } 776 }
776 777
777 } // namespace edk 778 } // namespace edk
778 } // namespace mojo 779 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698