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

Side by Side Diff: chrome/common/ipc_message.h

Issue 20027: Capability: passing fds over IPC (Closed)
Patch Set: ... Created 11 years, 10 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 | « chrome/common/ipc_channel_posix.cc ('k') | chrome/common/ipc_message.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 CHROME_COMMON_IPC_MESSAGE_H__ 5 #ifndef CHROME_COMMON_IPC_MESSAGE_H__
6 #define CHROME_COMMON_IPC_MESSAGE_H__ 6 #define CHROME_COMMON_IPC_MESSAGE_H__
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/pickle.h" 11 #include "base/pickle.h"
12 #include "testing/gtest/include/gtest/gtest_prod.h" 12 #include "testing/gtest/include/gtest/gtest_prod.h"
13 13
14 #if defined(OS_WIN) 14 #if defined(OS_WIN)
15 // TODO(port): IPC message logging hasn't been ported to other platforms yet. 15 // TODO(port): IPC message logging hasn't been ported to other platforms yet.
16 #ifndef NDEBUG 16 #ifndef NDEBUG
17 #define IPC_MESSAGE_LOG_ENABLED 17 #define IPC_MESSAGE_LOG_ENABLED
18 #endif 18 #endif
19 #elif defined(OS_POSIX)
20 #include "chrome/common/file_descriptor_posix.h"
19 #endif 21 #endif
20 22
21 namespace IPC { 23 namespace IPC {
22 24
23 //------------------------------------------------------------------------------ 25 //------------------------------------------------------------------------------
24 26
25 class Channel; 27 class Channel;
26 class Message; 28 class Message;
27 struct LogData; 29 struct LogData;
28 30
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Used for async messages with no parameters. 154 // Used for async messages with no parameters.
153 static void Log(const Message* msg, std::wstring* l) { 155 static void Log(const Message* msg, std::wstring* l) {
154 } 156 }
155 157
156 // Find the end of the message data that starts at range_start. Returns NULL 158 // Find the end of the message data that starts at range_start. Returns NULL
157 // if the entire message is not found in the given data range. 159 // if the entire message is not found in the given data range.
158 static const char* FindNext(const char* range_start, const char* range_end) { 160 static const char* FindNext(const char* range_start, const char* range_end) {
159 return Pickle::FindNext(sizeof(Header), range_start, range_end); 161 return Pickle::FindNext(sizeof(Header), range_start, range_end);
160 } 162 }
161 163
164 #if defined(OS_POSIX)
165 DescriptorSet* descriptor_set() const { return &descriptor_set_; }
166 #endif
167
162 #ifdef IPC_MESSAGE_LOG_ENABLED 168 #ifdef IPC_MESSAGE_LOG_ENABLED
163 // Adds the outgoing time from Time::Now() at the end of the message and sets 169 // Adds the outgoing time from Time::Now() at the end of the message and sets
164 // a bit to indicate that it's been added. 170 // a bit to indicate that it's been added.
165 void set_sent_time(int64 time); 171 void set_sent_time(int64 time);
166 int64 sent_time() const; 172 int64 sent_time() const;
167 173
168 void set_received_time(int64 time) const; 174 void set_received_time(int64 time) const;
169 int64 received_time() const { return received_time_; } 175 int64 received_time() const { return received_time_; }
170 void set_output_params(const std::wstring& op) const { output_params_ = op; } 176 void set_output_params(const std::wstring& op) const { output_params_ = op; }
171 const std::wstring& output_params() const { return output_params_; } 177 const std::wstring& output_params() const { return output_params_; }
(...skipping 22 matching lines...) Expand all
194 SYNC_BIT = 0x0004, 200 SYNC_BIT = 0x0004,
195 REPLY_BIT = 0x0008, 201 REPLY_BIT = 0x0008,
196 REPLY_ERROR_BIT = 0x0010, 202 REPLY_ERROR_BIT = 0x0010,
197 UNBLOCK_BIT = 0x0020, 203 UNBLOCK_BIT = 0x0020,
198 PUMPING_MSGS_BIT= 0x0040, 204 PUMPING_MSGS_BIT= 0x0040,
199 HAS_SENT_TIME_BIT = 0x0080, 205 HAS_SENT_TIME_BIT = 0x0080,
200 }; 206 };
201 207
202 #pragma pack(push, 2) 208 #pragma pack(push, 2)
203 struct Header : Pickle::Header { 209 struct Header : Pickle::Header {
204 int32 routing; // ID of the view that this message is destined for 210 int32 routing; // ID of the view that this message is destined for
205 uint16 type; // specifies the user-defined message type 211 uint16 type; // specifies the user-defined message type
206 uint16 flags; // specifies control flags for the message 212 uint16 flags; // specifies control flags for the message
213 #if defined(OS_POSIX)
214 uint32 num_fds; // the number of descriptors included with this message
215 #endif
207 }; 216 };
208 #pragma pack(pop) 217 #pragma pack(pop)
209 218
210 Header* header() { 219 Header* header() {
211 return headerT<Header>(); 220 return headerT<Header>();
212 } 221 }
213 const Header* header() const { 222 const Header* header() const {
214 return headerT<Header>(); 223 return headerT<Header>();
215 } 224 }
216 225
217 void InitLoggingVariables(); 226 void InitLoggingVariables();
218 227
228 #if defined(OS_POSIX)
229 // The set of file descriptors associated with this message.
230 mutable DescriptorSet descriptor_set_;
231 #endif
232
219 #ifdef IPC_MESSAGE_LOG_ENABLED 233 #ifdef IPC_MESSAGE_LOG_ENABLED
220 // Used for logging. 234 // Used for logging.
221 mutable int64 received_time_; 235 mutable int64 received_time_;
222 mutable std::wstring output_params_; 236 mutable std::wstring output_params_;
223 mutable LogData* log_data_; 237 mutable LogData* log_data_;
224 mutable bool dont_log_; 238 mutable bool dont_log_;
225 #endif 239 #endif
226 }; 240 };
227 241
228 //------------------------------------------------------------------------------ 242 //------------------------------------------------------------------------------
229 243
230 } // namespace IPC 244 } // namespace IPC
231 245
232 enum SpecialRoutingIDs { 246 enum SpecialRoutingIDs {
233 // indicates that we don't have a routing ID yet. 247 // indicates that we don't have a routing ID yet.
234 MSG_ROUTING_NONE = -2, 248 MSG_ROUTING_NONE = -2,
235 249
236 // indicates a general message not sent to a particular tab. 250 // indicates a general message not sent to a particular tab.
237 MSG_ROUTING_CONTROL = kint32max, 251 MSG_ROUTING_CONTROL = kint32max,
238 }; 252 };
239 253
240 #define IPC_REPLY_ID 0xFFF0 // Special message id for replies 254 #define IPC_REPLY_ID 0xFFF0 // Special message id for replies
241 #define IPC_LOGGING_ID 0xFFF1 // Special message id for logging 255 #define IPC_LOGGING_ID 0xFFF1 // Special message id for logging
242 256
243 #endif // CHROME_COMMON_IPC_MESSAGE_H__ 257 #endif // CHROME_COMMON_IPC_MESSAGE_H__
244 258
OLDNEW
« no previous file with comments | « chrome/common/ipc_channel_posix.cc ('k') | chrome/common/ipc_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698