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

Side by Side Diff: ipc/ipc_channel.h

Issue 9547009: Factor out the shared parts of IPC channel reading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | « ipc/ipc.gypi ('k') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "ipc/ipc_channel_handle.h" 10 #include "ipc/ipc_channel_handle.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 MODE_NAMED_CLIENT = MODE_CLIENT_FLAG | MODE_NAMED_FLAG, 87 MODE_NAMED_CLIENT = MODE_CLIENT_FLAG | MODE_NAMED_FLAG,
88 #if defined(OS_POSIX) 88 #if defined(OS_POSIX)
89 // An "open" named server accepts connections from ANY client. 89 // An "open" named server accepts connections from ANY client.
90 // The caller must then implement their own access-control based on the 90 // The caller must then implement their own access-control based on the
91 // client process' user Id. 91 // client process' user Id.
92 MODE_OPEN_NAMED_SERVER = MODE_OPEN_ACCESS_FLAG | MODE_SERVER_FLAG | 92 MODE_OPEN_NAMED_SERVER = MODE_OPEN_ACCESS_FLAG | MODE_SERVER_FLAG |
93 MODE_NAMED_FLAG 93 MODE_NAMED_FLAG
94 #endif 94 #endif
95 }; 95 };
96 96
97 // The Hello message is internal to the Channel class. It is sent
98 // by the peer when the channel is connected. The message contains
99 // just the process id (pid). The message has a special routing_id
100 // (MSG_ROUTING_NONE) and type (HELLO_MESSAGE_TYPE).
101 enum {
102 HELLO_MESSAGE_TYPE = kuint16max // Maximum value of message type (uint16),
103 // to avoid conflicting with normal
104 // message types, which are enumeration
105 // constants starting from 0.
106 };
107
97 // The maximum message size in bytes. Attempting to receive a message of this 108 // The maximum message size in bytes. Attempting to receive a message of this
98 // size or bigger results in a channel error. 109 // size or bigger results in a channel error.
99 static const size_t kMaximumMessageSize = 128 * 1024 * 1024; 110 static const size_t kMaximumMessageSize = 128 * 1024 * 1024;
100 111
101 // Ammount of data to read at once from the pipe. 112 // Ammount of data to read at once from the pipe.
102 static const size_t kReadBufferSize = 4 * 1024; 113 static const size_t kReadBufferSize = 4 * 1024;
103 114
104 // Initialize a Channel. 115 // Initialize a Channel.
105 // 116 //
106 // |channel_handle| identifies the communication Channel. For POSIX, if 117 // |channel_handle| identifies the communication Channel. For POSIX, if
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Used in Chrome by the TestSink to provide a dummy channel implementation 201 // Used in Chrome by the TestSink to provide a dummy channel implementation
191 // for testing. TestSink overrides the "interesting" functions in Channel so 202 // for testing. TestSink overrides the "interesting" functions in Channel so
192 // no actual implementation is needed. This will cause un-overridden calls to 203 // no actual implementation is needed. This will cause un-overridden calls to
193 // segfault. Do not use outside of test code! 204 // segfault. Do not use outside of test code!
194 Channel() : channel_impl_(0) { } 205 Channel() : channel_impl_(0) { }
195 206
196 private: 207 private:
197 // PIMPL to which all channel calls are delegated. 208 // PIMPL to which all channel calls are delegated.
198 class ChannelImpl; 209 class ChannelImpl;
199 ChannelImpl *channel_impl_; 210 ChannelImpl *channel_impl_;
200
201 // The Hello message is internal to the Channel class. It is sent
202 // by the peer when the channel is connected. The message contains
203 // just the process id (pid). The message has a special routing_id
204 // (MSG_ROUTING_NONE) and type (HELLO_MESSAGE_TYPE).
205 enum {
206 HELLO_MESSAGE_TYPE = kuint16max // Maximum value of message type (uint16),
207 // to avoid conflicting with normal
208 // message types, which are enumeration
209 // constants starting from 0.
210 };
211 }; 211 };
212 212
213 } // namespace IPC 213 } // namespace IPC
214 214
215 #endif // IPC_IPC_CHANNEL_H_ 215 #endif // IPC_IPC_CHANNEL_H_
OLDNEW
« no previous file with comments | « ipc/ipc.gypi ('k') | ipc/ipc_channel_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698