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

Side by Side Diff: base/mach_ipc_mac.h

Issue 7461141: Rename BASE_API to BASE_EXPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | « base/mac/scoped_nsexception_enabler.h ('k') | base/md5.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 BASE_MACH_IPC_MAC_H_ 5 #ifndef BASE_MACH_IPC_MAC_H_
6 #define BASE_MACH_IPC_MAC_H_ 6 #define BASE_MACH_IPC_MAC_H_
7 #pragma once 7 #pragma once
8 8
9 #include <mach/mach.h> 9 #include <mach/mach.h>
10 #include <mach/message.h> 10 #include <mach/message.h>
11 #include <servers/bootstrap.h> 11 #include <servers/bootstrap.h>
12 #include <sys/types.h> 12 #include <sys/types.h>
13 13
14 #include <CoreServices/CoreServices.h> 14 #include <CoreServices/CoreServices.h>
15 15
16 #include "base/base_api.h" 16 #include "base/base_export.h"
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 18
19 //============================================================================== 19 //==============================================================================
20 // DISCUSSION: 20 // DISCUSSION:
21 // 21 //
22 // The three main classes of interest are 22 // The three main classes of interest are
23 // 23 //
24 // MachMessage: a wrapper for a Mach message of the following form 24 // MachMessage: a wrapper for a Mach message of the following form
25 // mach_msg_header_t 25 // mach_msg_header_t
26 // mach_msg_body_t 26 // mach_msg_body_t
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // or it can manage storage internally. 132 // or it can manage storage internally.
133 // 1. If storage is allocated internally, the combined size of the descriptors 133 // 1. If storage is allocated internally, the combined size of the descriptors
134 // plus data must be less than 1024. But as a benefit no memory allocation is 134 // plus data must be less than 1024. But as a benefit no memory allocation is
135 // necessary. 135 // necessary.
136 // 2. For external storage, a buffer of at least EmptyMessageSize() must be 136 // 2. For external storage, a buffer of at least EmptyMessageSize() must be
137 // provided. 137 // provided.
138 // 138 //
139 // A MachMessage object is used by ReceivePort::WaitForMessage 139 // A MachMessage object is used by ReceivePort::WaitForMessage
140 // and MachPortSender::SendMessage 140 // and MachPortSender::SendMessage
141 // 141 //
142 class BASE_API MachMessage { 142 class BASE_EXPORT MachMessage {
143 public: 143 public:
144 static const size_t kEmptyMessageSize; 144 static const size_t kEmptyMessageSize;
145 145
146 virtual ~MachMessage(); 146 virtual ~MachMessage();
147 147
148 // The receiver of the message can retrieve the raw data this way 148 // The receiver of the message can retrieve the raw data this way
149 u_int8_t *GetData() { 149 u_int8_t *GetData() {
150 return GetDataLength() > 0 ? GetDataPacket()->data : NULL; 150 return GetDataLength() > 0 ? GetDataPacket()->data : NULL;
151 } 151 }
152 152
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 public: 238 public:
239 MachReceiveMessage() : MachMessage() {} 239 MachReceiveMessage() : MachMessage() {}
240 MachReceiveMessage(void *storage, size_t storage_length) 240 MachReceiveMessage(void *storage, size_t storage_length)
241 : MachMessage(storage, storage_length) {} 241 : MachMessage(storage, storage_length) {}
242 242
243 private: 243 private:
244 DISALLOW_COPY_AND_ASSIGN(MachReceiveMessage); 244 DISALLOW_COPY_AND_ASSIGN(MachReceiveMessage);
245 }; 245 };
246 246
247 //============================================================================== 247 //==============================================================================
248 class BASE_API MachSendMessage : public MachMessage { 248 class BASE_EXPORT MachSendMessage : public MachMessage {
249 public: 249 public:
250 explicit MachSendMessage(int32_t message_id); 250 explicit MachSendMessage(int32_t message_id);
251 MachSendMessage(void *storage, size_t storage_length, int32_t message_id); 251 MachSendMessage(void *storage, size_t storage_length, int32_t message_id);
252 252
253 private: 253 private:
254 void Initialize(int32_t message_id); 254 void Initialize(int32_t message_id);
255 255
256 DISALLOW_COPY_AND_ASSIGN(MachSendMessage); 256 DISALLOW_COPY_AND_ASSIGN(MachSendMessage);
257 }; 257 };
258 258
259 //============================================================================== 259 //==============================================================================
260 // Represents a Mach port for which we have receive rights 260 // Represents a Mach port for which we have receive rights
261 class BASE_API ReceivePort { 261 class BASE_EXPORT ReceivePort {
262 public: 262 public:
263 // Creates a new Mach port for receiving messages and registers a name for it 263 // Creates a new Mach port for receiving messages and registers a name for it
264 explicit ReceivePort(const char *receive_port_name); 264 explicit ReceivePort(const char *receive_port_name);
265 265
266 // Given an already existing Mach port, use it. We take ownership of the 266 // Given an already existing Mach port, use it. We take ownership of the
267 // port and deallocate it in our destructor. 267 // port and deallocate it in our destructor.
268 explicit ReceivePort(mach_port_t receive_port); 268 explicit ReceivePort(mach_port_t receive_port);
269 269
270 // Create a new Mach port for receiving messages 270 // Create a new Mach port for receiving messages
271 ReceivePort(); 271 ReceivePort();
(...skipping 10 matching lines...) Expand all
282 282
283 private: 283 private:
284 mach_port_t port_; 284 mach_port_t port_;
285 kern_return_t init_result_; 285 kern_return_t init_result_;
286 286
287 DISALLOW_COPY_AND_ASSIGN(ReceivePort); 287 DISALLOW_COPY_AND_ASSIGN(ReceivePort);
288 }; 288 };
289 289
290 //============================================================================== 290 //==============================================================================
291 // Represents a Mach port for which we have send rights 291 // Represents a Mach port for which we have send rights
292 class BASE_API MachPortSender { 292 class BASE_EXPORT MachPortSender {
293 public: 293 public:
294 // get a port with send rights corresponding to a named registered service 294 // get a port with send rights corresponding to a named registered service
295 explicit MachPortSender(const char *receive_port_name); 295 explicit MachPortSender(const char *receive_port_name);
296 296
297 297
298 // Given an already existing Mach port, use it. Does not take ownership of 298 // Given an already existing Mach port, use it. Does not take ownership of
299 // |send_port|. 299 // |send_port|.
300 explicit MachPortSender(mach_port_t send_port); 300 explicit MachPortSender(mach_port_t send_port);
301 301
302 kern_return_t SendMessage(MachSendMessage &message, 302 kern_return_t SendMessage(MachSendMessage &message,
303 mach_msg_timeout_t timeout); 303 mach_msg_timeout_t timeout);
304 304
305 private: 305 private:
306 mach_port_t send_port_; 306 mach_port_t send_port_;
307 kern_return_t init_result_; 307 kern_return_t init_result_;
308 308
309 DISALLOW_COPY_AND_ASSIGN(MachPortSender); 309 DISALLOW_COPY_AND_ASSIGN(MachPortSender);
310 }; 310 };
311 311
312 } // namespace base 312 } // namespace base
313 313
314 #endif // BASE_MACH_IPC_MAC_H_ 314 #endif // BASE_MACH_IPC_MAC_H_
OLDNEW
« no previous file with comments | « base/mac/scoped_nsexception_enabler.h ('k') | base/md5.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698