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

Side by Side Diff: ipc/ipc_channel_posix.h

Issue 669953003: Revert of Standardize usage of virtual/override/final in ipc/ (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 | « ipc/ipc_channel_factory.cc ('k') | ipc/ipc_channel_posix_unittest.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_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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #endif 49 #endif
50 50
51 namespace IPC { 51 namespace IPC {
52 52
53 class IPC_EXPORT ChannelPosix : public Channel, 53 class IPC_EXPORT ChannelPosix : public Channel,
54 public internal::ChannelReader, 54 public internal::ChannelReader,
55 public base::MessageLoopForIO::Watcher { 55 public base::MessageLoopForIO::Watcher {
56 public: 56 public:
57 ChannelPosix(const IPC::ChannelHandle& channel_handle, Mode mode, 57 ChannelPosix(const IPC::ChannelHandle& channel_handle, Mode mode,
58 Listener* listener); 58 Listener* listener);
59 ~ChannelPosix() override; 59 virtual ~ChannelPosix();
60 60
61 // Channel implementation 61 // Channel implementation
62 bool Connect() override; 62 virtual bool Connect() override;
63 void Close() override; 63 virtual void Close() override;
64 bool Send(Message* message) override; 64 virtual bool Send(Message* message) override;
65 base::ProcessId GetPeerPID() const override; 65 virtual base::ProcessId GetPeerPID() const override;
66 base::ProcessId GetSelfPID() const override; 66 virtual base::ProcessId GetSelfPID() const override;
67 int GetClientFileDescriptor() const override; 67 virtual int GetClientFileDescriptor() const override;
68 base::ScopedFD TakeClientFileDescriptor() override; 68 virtual base::ScopedFD TakeClientFileDescriptor() override;
69 69
70 // Returns true if the channel supports listening for connections. 70 // Returns true if the channel supports listening for connections.
71 bool AcceptsConnections() const; 71 bool AcceptsConnections() const;
72 72
73 // Returns true if the channel supports listening for connections and is 73 // Returns true if the channel supports listening for connections and is
74 // currently connected. 74 // currently connected.
75 bool HasAcceptedConnection() const; 75 bool HasAcceptedConnection() const;
76 76
77 // Closes any currently connected socket, and returns to a listening state 77 // Closes any currently connected socket, and returns to a listening state
78 // for more connections. 78 // for more connections.
(...skipping 16 matching lines...) Expand all
95 bool ProcessOutgoingMessages(); 95 bool ProcessOutgoingMessages();
96 96
97 bool AcceptConnection(); 97 bool AcceptConnection();
98 void ClosePipeOnError(); 98 void ClosePipeOnError();
99 int GetHelloMessageProcId() const; 99 int GetHelloMessageProcId() const;
100 void QueueHelloMessage(); 100 void QueueHelloMessage();
101 void CloseFileDescriptors(Message* msg); 101 void CloseFileDescriptors(Message* msg);
102 void QueueCloseFDMessage(int fd, int hops); 102 void QueueCloseFDMessage(int fd, int hops);
103 103
104 // ChannelReader implementation. 104 // ChannelReader implementation.
105 ReadState ReadData(char* buffer, int buffer_len, int* bytes_read) override; 105 virtual ReadState ReadData(char* buffer,
106 bool WillDispatchInputMessage(Message* msg) override; 106 int buffer_len,
107 bool DidEmptyInputBuffers() override; 107 int* bytes_read) override;
108 void HandleInternalMessage(const Message& msg) override; 108 virtual bool WillDispatchInputMessage(Message* msg) override;
109 virtual bool DidEmptyInputBuffers() override;
110 virtual void HandleInternalMessage(const Message& msg) override;
109 111
110 #if defined(IPC_USES_READWRITE) 112 #if defined(IPC_USES_READWRITE)
111 // Reads the next message from the fd_pipe_ and appends them to the 113 // Reads the next message from the fd_pipe_ and appends them to the
112 // input_fds_ queue. Returns false if there was a message receiving error. 114 // input_fds_ queue. Returns false if there was a message receiving error.
113 // True means there was a message and it was processed properly, or there was 115 // True means there was a message and it was processed properly, or there was
114 // no messages. 116 // no messages.
115 bool ReadFileDescriptorsFromFDPipe(); 117 bool ReadFileDescriptorsFromFDPipe();
116 #endif 118 #endif
117 119
118 // Finds the set of file descriptors in the given message. On success, 120 // Finds the set of file descriptors in the given message. On success,
119 // appends the descriptors to the input_fds_ member and returns true 121 // appends the descriptors to the input_fds_ member and returns true
120 // 122 //
121 // Returns false if the message was truncated. In this case, any handles that 123 // Returns false if the message was truncated. In this case, any handles that
122 // were sent will be closed. 124 // were sent will be closed.
123 bool ExtractFileDescriptorsFromMsghdr(msghdr* msg); 125 bool ExtractFileDescriptorsFromMsghdr(msghdr* msg);
124 126
125 // Closes all handles in the input_fds_ list and clears the list. This is 127 // Closes all handles in the input_fds_ list and clears the list. This is
126 // used to clean up handles in error conditions to avoid leaking the handles. 128 // used to clean up handles in error conditions to avoid leaking the handles.
127 void ClearInputFDs(); 129 void ClearInputFDs();
128 130
129 // MessageLoopForIO::Watcher implementation. 131 // MessageLoopForIO::Watcher implementation.
130 void OnFileCanReadWithoutBlocking(int fd) override; 132 virtual void OnFileCanReadWithoutBlocking(int fd) override;
131 void OnFileCanWriteWithoutBlocking(int fd) override; 133 virtual void OnFileCanWriteWithoutBlocking(int fd) override;
132 134
133 Mode mode_; 135 Mode mode_;
134 136
135 base::ProcessId peer_pid_; 137 base::ProcessId peer_pid_;
136 138
137 // After accepting one client connection on our server socket we want to 139 // After accepting one client connection on our server socket we want to
138 // stop listening. 140 // stop listening.
139 base::MessageLoopForIO::FileDescriptorWatcher 141 base::MessageLoopForIO::FileDescriptorWatcher
140 server_listen_connection_watcher_; 142 server_listen_connection_watcher_;
141 base::MessageLoopForIO::FileDescriptorWatcher read_watcher_; 143 base::MessageLoopForIO::FileDescriptorWatcher read_watcher_;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // If non-zero, overrides the process ID sent in the hello message. 218 // If non-zero, overrides the process ID sent in the hello message.
217 static int global_pid_; 219 static int global_pid_;
218 #endif // OS_LINUX 220 #endif // OS_LINUX
219 221
220 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelPosix); 222 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelPosix);
221 }; 223 };
222 224
223 } // namespace IPC 225 } // namespace IPC
224 226
225 #endif // IPC_IPC_CHANNEL_POSIX_H_ 227 #endif // IPC_IPC_CHANNEL_POSIX_H_
OLDNEW
« no previous file with comments | « ipc/ipc_channel_factory.cc ('k') | ipc/ipc_channel_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698