| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |