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

Side by Side Diff: ipc/ipc_channel_posix.h

Issue 320433002: IPC::Channel: Reduce POSIX specific API surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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_POSIX_H_ 5 #ifndef IPC_IPC_CHANNEL_POSIX_H_
6 #define IPC_IPC_CHANNEL_POSIX_H_ 6 #define IPC_IPC_CHANNEL_POSIX_H_
7 7
8 #include "ipc/ipc_channel.h" 8 #include "ipc/ipc_channel.h"
9 9
10 #include <sys/socket.h> // for CMSG macros 10 #include <sys/socket.h> // for CMSG macros
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // needs to send file descriptors in later messages. 46 // needs to send file descriptors in later messages.
47 #define IPC_USES_READWRITE 1 47 #define IPC_USES_READWRITE 1
48 #endif 48 #endif
49 49
50 namespace IPC { 50 namespace IPC {
51 51
52 class ChannelPosix : public Channel, 52 class ChannelPosix : public Channel,
53 public internal::ChannelReader, 53 public internal::ChannelReader,
54 public base::MessageLoopForIO::Watcher { 54 public base::MessageLoopForIO::Watcher {
55 public: 55 public:
56 // Mirror methods of Channel, see ipc_channel.h for description.
57 ChannelPosix(const IPC::ChannelHandle& channel_handle, Mode mode, 56 ChannelPosix(const IPC::ChannelHandle& channel_handle, Mode mode,
58 Listener* listener); 57 Listener* listener);
58
jam 2014/06/06 14:47:13 nit: no blank line needed
59 virtual ~ChannelPosix(); 59 virtual ~ChannelPosix();
60 60
61 // Channel implementation 61 // Channel implementation
62 virtual bool Connect() OVERRIDE; 62 virtual bool Connect() OVERRIDE;
63 virtual void Close() OVERRIDE; 63 virtual void Close() OVERRIDE;
64 virtual bool Send(Message* message) OVERRIDE; 64 virtual bool Send(Message* message) OVERRIDE;
65 virtual base::ProcessId GetPeerPID() const OVERRIDE; 65 virtual base::ProcessId GetPeerPID() const OVERRIDE;
66 virtual int GetClientFileDescriptor() const OVERRIDE; 66 virtual int GetClientFileDescriptor() const OVERRIDE;
67 virtual int TakeClientFileDescriptor() OVERRIDE; 67 virtual int TakeClientFileDescriptor() OVERRIDE;
68 virtual bool AcceptsConnections() const OVERRIDE; 68
69 virtual bool HasAcceptedConnection() const OVERRIDE; 69 // Returns true if the channel supports listening for connections.
70 virtual bool GetPeerEuid(uid_t* peer_euid) const OVERRIDE; 70 bool AcceptsConnections() const;
71 virtual void ResetToAcceptingConnectionState() OVERRIDE; 71
72 // Returns true if the channel supports listening for connections and is
73 // currently connected.
74 bool HasAcceptedConnection() const;
75
76 // Closes any currently connected socket, and returns to a listening state
77 // for more connections.
78 void ResetToAcceptingConnectionState();
79
80 // Returns true if the peer process' effective user id can be determined, in
81 // which case the supplied peer_euid is updated with it.
82 bool GetPeerEuid(uid_t* peer_euid) const;
72 83
73 void CloseClientFileDescriptor(); 84 void CloseClientFileDescriptor();
74 85
75 static bool IsNamedServerInitialized(const std::string& channel_id); 86 static bool IsNamedServerInitialized(const std::string& channel_id);
76 #if defined(OS_LINUX) 87 #if defined(OS_LINUX)
77 static void SetGlobalPid(int pid); 88 static void SetGlobalPid(int pid);
78 #endif // OS_LINUX 89 #endif // OS_LINUX
79 90
80 private: 91 private:
81 bool CreatePipe(const IPC::ChannelHandle& channel_handle); 92 bool CreatePipe(const IPC::ChannelHandle& channel_handle);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // If non-zero, overrides the process ID sent in the hello message. 217 // If non-zero, overrides the process ID sent in the hello message.
207 static int global_pid_; 218 static int global_pid_;
208 #endif // OS_LINUX 219 #endif // OS_LINUX
209 220
210 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelPosix); 221 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelPosix);
211 }; 222 };
212 223
213 } // namespace IPC 224 } // namespace IPC
214 225
215 #endif // IPC_IPC_CHANNEL_POSIX_H_ 226 #endif // IPC_IPC_CHANNEL_POSIX_H_
OLDNEW
« no previous file with comments | « ipc/ipc_channel.h ('k') | ipc/ipc_channel_posix.cc » ('j') | ipc/ipc_channel_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698