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

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

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 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 <unordered_map> 8 #include <unordered_map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Permanently stop the channel from sending or receiving messages. 80 // Permanently stop the channel from sending or receiving messages.
81 void ShutDown(); 81 void ShutDown();
82 82
83 void SetRemoteProcessHandle(base::ProcessHandle process_handle); 83 void SetRemoteProcessHandle(base::ProcessHandle process_handle);
84 bool HasRemoteProcessHandle(); 84 bool HasRemoteProcessHandle();
85 ScopedPlatformHandle CopyRemoteProcessHandle(); 85 ScopedPlatformHandle CopyRemoteProcessHandle();
86 86
87 // Used for context in Delegate calls (via |from_node| arguments.) 87 // Used for context in Delegate calls (via |from_node| arguments.)
88 void SetRemoteNodeName(const ports::NodeName& name); 88 void SetRemoteNodeName(const ports::NodeName& name);
89 89
90 // If this is called with a non-empty |secret|, the channel expects the next
91 // message it receives to exactly match the contents of |secret|. This must be
92 // called before calling Start().
93 void SetExpectedSecret(const std::string& secret);
94
95 // Sends a secret to the remote end.
96 void SendSecret(const std::string& secret);
97
90 void AcceptChild(const ports::NodeName& parent_name, 98 void AcceptChild(const ports::NodeName& parent_name,
91 const ports::NodeName& token); 99 const ports::NodeName& token);
92 void AcceptParent(const ports::NodeName& token, 100 void AcceptParent(const ports::NodeName& token,
93 const ports::NodeName& child_name); 101 const ports::NodeName& child_name);
94 void AddBrokerClient(const ports::NodeName& client_name, 102 void AddBrokerClient(const ports::NodeName& client_name,
95 ScopedPlatformHandle process_handle); 103 ScopedPlatformHandle process_handle);
96 void BrokerClientAdded(const ports::NodeName& client_name, 104 void BrokerClientAdded(const ports::NodeName& client_name,
97 ScopedPlatformHandle broker_channel); 105 ScopedPlatformHandle broker_channel);
98 void AcceptBrokerClient(const ports::NodeName& broker_name, 106 void AcceptBrokerClient(const ports::NodeName& broker_name,
99 ScopedPlatformHandle broker_channel); 107 ScopedPlatformHandle broker_channel);
(...skipping 28 matching lines...) Expand all
128 void OnChannelError() override; 136 void OnChannelError() override;
129 137
130 void WriteChannelMessage(Channel::MessagePtr message); 138 void WriteChannelMessage(Channel::MessagePtr message);
131 139
132 Delegate* const delegate_; 140 Delegate* const delegate_;
133 const scoped_refptr<base::TaskRunner> io_task_runner_; 141 const scoped_refptr<base::TaskRunner> io_task_runner_;
134 142
135 base::Lock channel_lock_; 143 base::Lock channel_lock_;
136 scoped_refptr<Channel> channel_; 144 scoped_refptr<Channel> channel_;
137 145
146 // Must be set before calling Start(), if at all.
147 std::string expected_secret_;
148
138 // Must only be accessed from |io_task_runner_|'s thread. 149 // Must only be accessed from |io_task_runner_|'s thread.
139 ports::NodeName remote_node_name_; 150 ports::NodeName remote_node_name_;
140 151
141 #if defined(OS_WIN) 152 #if defined(OS_WIN)
142 base::Lock remote_process_handle_lock_; 153 base::Lock remote_process_handle_lock_;
143 base::ProcessHandle remote_process_handle_ = base::kNullProcessHandle; 154 base::ProcessHandle remote_process_handle_ = base::kNullProcessHandle;
144 #endif 155 #endif
145 156
146 DISALLOW_COPY_AND_ASSIGN(NodeChannel); 157 DISALLOW_COPY_AND_ASSIGN(NodeChannel);
147 }; 158 };
148 159
149 } // namespace edk 160 } // namespace edk
150 } // namespace mojo 161 } // namespace mojo
151 162
152 #endif // MOJO_EDK_SYSTEM_NODE_CHANNEL_H_ 163 #endif // MOJO_EDK_SYSTEM_NODE_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698