| OLD | NEW |
| 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 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 | 7 |
| 8 #include <mach/mach.h> | 8 #include <mach/mach.h> |
| 9 #include <mach/message.h> | 9 #include <mach/message.h> |
| 10 #include <servers/bootstrap.h> | 10 #include <servers/bootstrap.h> |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 GetDataPacket()->id = EndianU32_NtoL(message_id); | 160 GetDataPacket()->id = EndianU32_NtoL(message_id); |
| 161 } | 161 } |
| 162 | 162 |
| 163 int32_t GetMessageID() { return EndianU32_LtoN(GetDataPacket()->id); } | 163 int32_t GetMessageID() { return EndianU32_LtoN(GetDataPacket()->id); } |
| 164 | 164 |
| 165 // Adds a descriptor (typically a mach port) to be translated | 165 // Adds a descriptor (typically a mach port) to be translated |
| 166 // returns true if successful, otherwise not enough space | 166 // returns true if successful, otherwise not enough space |
| 167 bool AddDescriptor(const MachMsgPortDescriptor &desc); | 167 bool AddDescriptor(const MachMsgPortDescriptor &desc); |
| 168 | 168 |
| 169 int GetDescriptorCount() const { | 169 int GetDescriptorCount() const { |
| 170 return storage_->body.msgh_descriptor_count; | 170 return storage_->body.msgh_descriptor_count; |
| 171 } | 171 } |
| 172 | |
| 173 MachMsgPortDescriptor *GetDescriptor(int n); | 172 MachMsgPortDescriptor *GetDescriptor(int n); |
| 174 | 173 |
| 175 // Convenience method which gets the mach port described by the descriptor | 174 // Convenience method which gets the mach port described by the descriptor |
| 176 mach_port_t GetTranslatedPort(int n); | 175 mach_port_t GetTranslatedPort(int n); |
| 177 | 176 |
| 178 // A simple message is one with no descriptors | 177 // A simple message is one with no descriptors |
| 179 bool IsSimpleMessage() const { return GetDescriptorCount() == 0; } | 178 bool IsSimpleMessage() const { return GetDescriptorCount() == 0; } |
| 180 | 179 |
| 181 // Sets raw data for the message (returns false if not enough space) | 180 // Sets raw data for the message (returns false if not enough space) |
| 182 bool SetData(const void* data, int32_t data_length); | 181 bool SetData(const void* data, int32_t data_length); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 mach_msg_timeout_t timeout); | 311 mach_msg_timeout_t timeout); |
| 313 | 312 |
| 314 private: | 313 private: |
| 315 mach_port_t send_port_; | 314 mach_port_t send_port_; |
| 316 kern_return_t init_result_; | 315 kern_return_t init_result_; |
| 317 | 316 |
| 318 DISALLOW_COPY_AND_ASSIGN(MachPortSender); | 317 DISALLOW_COPY_AND_ASSIGN(MachPortSender); |
| 319 }; | 318 }; |
| 320 | 319 |
| 321 #endif // BASE_MACH_IPC_MAC_H_ | 320 #endif // BASE_MACH_IPC_MAC_H_ |
| OLD | NEW |