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

Side by Side Diff: ipc/ipc_channel.h

Issue 659243002: Non-SFI Mode: Build ipc/ library by PNaCl toolchain for nacl_helper_nonsfi. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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 | « components/nacl_nonsfi.gyp ('k') | ipc/ipc_channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 IPC_IPC_CHANNEL_H_ 5 #ifndef IPC_IPC_CHANNEL_H_
6 #define IPC_IPC_CHANNEL_H_ 6 #define IPC_IPC_CHANNEL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #if defined(OS_POSIX) 10 #if defined(OS_POSIX)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 // Get its own process id. This value is told to the peer. 173 // Get its own process id. This value is told to the peer.
174 virtual base::ProcessId GetSelfPID() const = 0; 174 virtual base::ProcessId GetSelfPID() const = 0;
175 175
176 // Send a message over the Channel to the listener on the other end. 176 // Send a message over the Channel to the listener on the other end.
177 // 177 //
178 // |message| must be allocated using operator new. This object will be 178 // |message| must be allocated using operator new. This object will be
179 // deleted once the contents of the Message have been sent. 179 // deleted once the contents of the Message have been sent.
180 virtual bool Send(Message* message) = 0; 180 virtual bool Send(Message* message) = 0;
181 181
182 #if defined(OS_POSIX) && !defined(OS_NACL) 182 #if defined(OS_POSIX) && \
183 (!defined(OS_NACL) || defined(__native_client_nonsfi__))
dmichael (off chromium) 2014/10/20 19:17:21 This is unfortunately complicated. I guess the sh
hidehiko 2014/10/20 20:22:00 Yes, OS_NACL is defined for both. Actually both ar
183 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the 184 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the
184 // FD # for the client end of the socket. 185 // FD # for the client end of the socket.
185 // This method may only be called on the server side of a channel. 186 // This method may only be called on the server side of a channel.
186 // This method can be called on any thread. 187 // This method can be called on any thread.
187 virtual int GetClientFileDescriptor() const = 0; 188 virtual int GetClientFileDescriptor() const = 0;
188 189
189 // Same as GetClientFileDescriptor, but transfers the ownership of the 190 // Same as GetClientFileDescriptor, but transfers the ownership of the
190 // file descriptor to the caller. 191 // file descriptor to the caller.
191 // This method can be called on any thread. 192 // This method can be called on any thread.
192 virtual int TakeClientFileDescriptor() = 0; 193 virtual int TakeClientFileDescriptor() = 0;
193 #endif // defined(OS_POSIX) && !defined(OS_NACL) 194 #endif
194 195
195 // Returns true if a named server channel is initialized on the given channel 196 // Returns true if a named server channel is initialized on the given channel
196 // ID. Even if true, the server may have already accepted a connection. 197 // ID. Even if true, the server may have already accepted a connection.
197 static bool IsNamedServerInitialized(const std::string& channel_id); 198 static bool IsNamedServerInitialized(const std::string& channel_id);
198 199
199 #if !defined(OS_NACL) 200 #if !defined(OS_NACL) || defined(__native_client_nonsfi__)
200 // Generates a channel ID that's non-predictable and unique. 201 // Generates a channel ID that's non-predictable and unique.
201 static std::string GenerateUniqueRandomChannelID(); 202 static std::string GenerateUniqueRandomChannelID();
202 203
203 // Generates a channel ID that, if passed to the client as a shared secret, 204 // Generates a channel ID that, if passed to the client as a shared secret,
204 // will validate that the client's authenticity. On platforms that do not 205 // will validate that the client's authenticity. On platforms that do not
205 // require additional this is simply calls GenerateUniqueRandomChannelID(). 206 // require additional this is simply calls GenerateUniqueRandomChannelID().
206 // For portability the prefix should not include the \ character. 207 // For portability the prefix should not include the \ character.
207 static std::string GenerateVerifiedChannelID(const std::string& prefix); 208 static std::string GenerateVerifiedChannelID(const std::string& prefix);
208 #endif 209 #endif
209 210
210 #if defined(OS_LINUX) 211 #if defined(OS_LINUX) || defined(__native_client_nonsfi__)
211 // Sandboxed processes live in a PID namespace, so when sending the IPC hello 212 // Sandboxed processes live in a PID namespace, so when sending the IPC hello
212 // message from client to server we need to send the PID from the global 213 // message from client to server we need to send the PID from the global
213 // PID namespace. 214 // PID namespace.
214 static void SetGlobalPid(int pid); 215 static void SetGlobalPid(int pid);
215 #endif 216 #endif
216 217
217 #if defined(OS_ANDROID) 218 #if defined(OS_ANDROID)
218 // Most tests are single process and work the same on all platforms. However 219 // Most tests are single process and work the same on all platforms. However
219 // in some cases we want to test multi-process, and Android differs in that it 220 // in some cases we want to test multi-process, and Android differs in that it
220 // can't 'exec' after forking. This callback resets any data in the forked 221 // can't 'exec' after forking. This callback resets any data in the forked
221 // process such that it acts similar to if it was exec'd, for tests. 222 // process such that it acts similar to if it was exec'd, for tests.
222 static void NotifyProcessForkedForTesting(); 223 static void NotifyProcessForkedForTesting();
223 #endif 224 #endif
224 225
225 }; 226 };
226 227
227 #if defined(OS_POSIX) 228 #if defined(OS_POSIX)
228 // SocketPair() creates a pair of socket FDs suitable for using with 229 // SocketPair() creates a pair of socket FDs suitable for using with
229 // IPC::Channel. 230 // IPC::Channel.
230 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); 231 IPC_EXPORT bool SocketPair(int* fd1, int* fd2);
231 #endif 232 #endif
232 233
233 } // namespace IPC 234 } // namespace IPC
234 235
235 #endif // IPC_IPC_CHANNEL_H_ 236 #endif // IPC_IPC_CHANNEL_H_
OLDNEW
« no previous file with comments | « components/nacl_nonsfi.gyp ('k') | ipc/ipc_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698