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

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

Issue 1685183004: Bootstrap Mojo IPC independent of Chrome IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: and fix posix 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 unified diff | Download patch
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return node_controller_.get(); 74 return node_controller_.get();
75 } 75 }
76 76
77 scoped_refptr<Dispatcher> Core::GetDispatcher(MojoHandle handle) { 77 scoped_refptr<Dispatcher> Core::GetDispatcher(MojoHandle handle) {
78 base::AutoLock lock(handles_lock_); 78 base::AutoLock lock(handles_lock_);
79 return handles_.GetDispatcher(handle); 79 return handles_.GetDispatcher(handle);
80 } 80 }
81 81
82 void Core::AddChild(base::ProcessHandle process_handle, 82 void Core::AddChild(base::ProcessHandle process_handle,
83 ScopedPlatformHandle platform_handle) { 83 ScopedPlatformHandle platform_handle) {
84 GetNodeController()->ConnectToChild(process_handle, 84 GetNodeController()->ConnectToChild(
85 std::move(platform_handle)); 85 process_handle, std::move(platform_handle), "");
86 }
87
88 void Core::AddChild(base::ProcessHandle process_handle,
89 ScopedPlatformHandle platform_handle,
90 const std::string& secret) {
91 GetNodeController()->ConnectToChild(
92 process_handle, std::move(platform_handle), secret);
86 } 93 }
87 94
88 void Core::InitChild(ScopedPlatformHandle platform_handle) { 95 void Core::InitChild(ScopedPlatformHandle platform_handle) {
89 GetNodeController()->ConnectToParent(std::move(platform_handle)); 96 GetNodeController()->ConnectToParent(std::move(platform_handle), "");
97 }
98
99 void Core::InitChild(ScopedPlatformHandle platform_handle,
100 const std::string& secret) {
101 GetNodeController()->ConnectToParent(std::move(platform_handle), secret);
90 } 102 }
91 103
92 MojoHandle Core::AddDispatcher(scoped_refptr<Dispatcher> dispatcher) { 104 MojoHandle Core::AddDispatcher(scoped_refptr<Dispatcher> dispatcher) {
93 base::AutoLock lock(handles_lock_); 105 base::AutoLock lock(handles_lock_);
94 return handles_.AddDispatcher(dispatcher); 106 return handles_.AddDispatcher(dispatcher);
95 } 107 }
96 108
97 bool Core::AddDispatchersFromTransit( 109 bool Core::AddDispatchersFromTransit(
98 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers, 110 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers,
99 MojoHandle* handles) { 111 MojoHandle* handles) {
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 scoped_ptr<NodeController> node_controller) { 735 scoped_ptr<NodeController> node_controller) {
724 // It's OK to leak this reference. At this point we know the IO loop is still 736 // It's OK to leak this reference. At this point we know the IO loop is still
725 // running, and we know the NodeController will observe its eventual 737 // running, and we know the NodeController will observe its eventual
726 // destruction. This tells the NodeController to delete itself when that 738 // destruction. This tells the NodeController to delete itself when that
727 // happens. 739 // happens.
728 node_controller.release()->DestroyOnIOThreadShutdown(); 740 node_controller.release()->DestroyOnIOThreadShutdown();
729 } 741 }
730 742
731 } // namespace edk 743 } // namespace edk
732 } // namespace mojo 744 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698