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

Side by Side Diff: ipc/ipc_channel.h

Issue 9968111: Make IPC channels track their peer process ID (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | ipc/ipc_channel_posix.h » ('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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/process.h"
12 #include "ipc/ipc_channel_handle.h" 13 #include "ipc/ipc_channel_handle.h"
13 #include "ipc/ipc_message.h" 14 #include "ipc/ipc_message.h"
14 15
15 namespace IPC { 16 namespace IPC {
16 17
17 //------------------------------------------------------------------------------ 18 //------------------------------------------------------------------------------
18 // See 19 // See
19 // http://www.chromium.org/developers/design-documents/inter-process-communicati on 20 // http://www.chromium.org/developers/design-documents/inter-process-communicati on
20 // for overview of IPC in Chromium. 21 // for overview of IPC in Chromium.
21 22
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Close this Channel explicitly. May be called multiple times. 143 // Close this Channel explicitly. May be called multiple times.
143 // On POSIX calling close on an IPC channel that listens for connections will 144 // On POSIX calling close on an IPC channel that listens for connections will
144 // cause it to close any accepted connections, and it will stop listening for 145 // cause it to close any accepted connections, and it will stop listening for
145 // new connections. If you just want to close the currently accepted 146 // new connections. If you just want to close the currently accepted
146 // connection and listen for new ones, use ResetToAcceptingConnectionState. 147 // connection and listen for new ones, use ResetToAcceptingConnectionState.
147 void Close(); 148 void Close();
148 149
149 // Modify the Channel's listener. 150 // Modify the Channel's listener.
150 void set_listener(Listener* listener); 151 void set_listener(Listener* listener);
151 152
153 // Get the process ID for the connected peer.
154 // Returns base::kNullProcessId if the peer is not connected yet.
155 base::ProcessId peer_pid() const;
156
152 // Send a message over the Channel to the listener on the other end. 157 // Send a message over the Channel to the listener on the other end.
153 // 158 //
154 // |message| must be allocated using operator new. This object will be 159 // |message| must be allocated using operator new. This object will be
155 // deleted once the contents of the Message have been sent. 160 // deleted once the contents of the Message have been sent.
156 virtual bool Send(Message* message) OVERRIDE; 161 virtual bool Send(Message* message) OVERRIDE;
157 162
158 #if defined(OS_POSIX) && !defined(OS_NACL) 163 #if defined(OS_POSIX) && !defined(OS_NACL)
159 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the 164 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the
160 // FD # for the client end of the socket. 165 // FD # for the client end of the socket.
161 // This method may only be called on the server side of a channel. 166 // This method may only be called on the server side of a channel.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 222
218 private: 223 private:
219 // PIMPL to which all channel calls are delegated. 224 // PIMPL to which all channel calls are delegated.
220 class ChannelImpl; 225 class ChannelImpl;
221 ChannelImpl *channel_impl_; 226 ChannelImpl *channel_impl_;
222 }; 227 };
223 228
224 } // namespace IPC 229 } // namespace IPC
225 230
226 #endif // IPC_IPC_CHANNEL_H_ 231 #endif // IPC_IPC_CHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | ipc/ipc_channel_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698