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

Side by Side Diff: ipc/ipc_channel_posix.h

Issue 14383024: ipc: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // 42 //
43 // The HELLO message from the client to the server is always sent using 43 // The HELLO message from the client to the server is always sent using
44 // sendmsg because it will contain the file descriptor that the server 44 // sendmsg because it will contain the file descriptor that the server
45 // needs to send file descriptors in later messages. 45 // needs to send file descriptors in later messages.
46 #define IPC_USES_READWRITE 1 46 #define IPC_USES_READWRITE 1
47 #endif 47 #endif
48 48
49 namespace IPC { 49 namespace IPC {
50 50
51 class Channel::ChannelImpl : public internal::ChannelReader, 51 class Channel::ChannelImpl : public internal::ChannelReader,
52 public MessageLoopForIO::Watcher { 52 public base::MessageLoopForIO::Watcher {
53 public: 53 public:
54 // Mirror methods of Channel, see ipc_channel.h for description. 54 // Mirror methods of Channel, see ipc_channel.h for description.
55 ChannelImpl(const IPC::ChannelHandle& channel_handle, Mode mode, 55 ChannelImpl(const IPC::ChannelHandle& channel_handle, Mode mode,
56 Listener* listener); 56 Listener* listener);
57 virtual ~ChannelImpl(); 57 virtual ~ChannelImpl();
58 bool Connect(); 58 bool Connect();
59 void Close(); 59 void Close();
60 bool Send(Message* message); 60 bool Send(Message* message);
61 int GetClientFileDescriptor(); 61 int GetClientFileDescriptor();
62 int TakeClientFileDescriptor(); 62 int TakeClientFileDescriptor();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // MessageLoopForIO::Watcher implementation. 111 // MessageLoopForIO::Watcher implementation.
112 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; 112 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
113 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; 113 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
114 114
115 Mode mode_; 115 Mode mode_;
116 116
117 base::ProcessId peer_pid_; 117 base::ProcessId peer_pid_;
118 118
119 // After accepting one client connection on our server socket we want to 119 // After accepting one client connection on our server socket we want to
120 // stop listening. 120 // stop listening.
121 MessageLoopForIO::FileDescriptorWatcher server_listen_connection_watcher_; 121 base::MessageLoopForIO::FileDescriptorWatcher
122 MessageLoopForIO::FileDescriptorWatcher read_watcher_; 122 server_listen_connection_watcher_;
123 MessageLoopForIO::FileDescriptorWatcher write_watcher_; 123 base::MessageLoopForIO::FileDescriptorWatcher read_watcher_;
124 base::MessageLoopForIO::FileDescriptorWatcher write_watcher_;
124 125
125 // Indicates whether we're currently blocked waiting for a write to complete. 126 // Indicates whether we're currently blocked waiting for a write to complete.
126 bool is_blocked_on_write_; 127 bool is_blocked_on_write_;
127 bool waiting_connect_; 128 bool waiting_connect_;
128 129
129 // If sending a message blocks then we use this variable 130 // If sending a message blocks then we use this variable
130 // to keep track of where we are. 131 // to keep track of where we are.
131 size_t message_send_bytes_written_; 132 size_t message_send_bytes_written_;
132 133
133 // File descriptor we're listening on for new connections if we listen 134 // File descriptor we're listening on for new connections if we listen
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // If non-zero, overrides the process ID sent in the hello message. 191 // If non-zero, overrides the process ID sent in the hello message.
191 static int global_pid_; 192 static int global_pid_;
192 #endif // OS_LINUX 193 #endif // OS_LINUX
193 194
194 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); 195 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl);
195 }; 196 };
196 197
197 } // namespace IPC 198 } // namespace IPC
198 199
199 #endif // IPC_IPC_CHANNEL_POSIX_H_ 200 #endif // IPC_IPC_CHANNEL_POSIX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698