| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SANDBOX_MAC_MACH_MESSAGE_SERVER_H_ | 5 #ifndef SANDBOX_MAC_MACH_MESSAGE_SERVER_H_ |
| 6 #define SANDBOX_MAC_MACH_MESSAGE_SERVER_H_ | 6 #define SANDBOX_MAC_MACH_MESSAGE_SERVER_H_ |
| 7 | 7 |
| 8 #include <mach/mach.h> | 8 #include <mach/mach.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // take ownership of the port and it will be used to receive messages. | 27 // take ownership of the port and it will be used to receive messages. |
| 28 // Otherwise the server will create a new receive right. | 28 // Otherwise the server will create a new receive right. |
| 29 // The maximum size of messages is specified by |buffer_size|. | 29 // The maximum size of messages is specified by |buffer_size|. |
| 30 MachMessageServer(MessageDemuxer* demuxer, | 30 MachMessageServer(MessageDemuxer* demuxer, |
| 31 mach_port_t server_receive_right, | 31 mach_port_t server_receive_right, |
| 32 mach_msg_size_t buffer_size); | 32 mach_msg_size_t buffer_size); |
| 33 ~MachMessageServer() override; | 33 ~MachMessageServer() override; |
| 34 | 34 |
| 35 // MessageServer: | 35 // MessageServer: |
| 36 bool Initialize() override; | 36 bool Initialize() override; |
| 37 void Shutdown() override; |
| 37 pid_t GetMessageSenderPID(IPCMessage request) override; | 38 pid_t GetMessageSenderPID(IPCMessage request) override; |
| 38 IPCMessage CreateReply(IPCMessage request) override; | 39 IPCMessage CreateReply(IPCMessage request) override; |
| 39 bool SendReply(IPCMessage reply) override; | 40 bool SendReply(IPCMessage reply) override; |
| 40 void ForwardMessage(IPCMessage request, mach_port_t destination) override; | 41 void ForwardMessage(IPCMessage request, mach_port_t destination) override; |
| 41 // Replies to the message with the specified |error_code| as a MIG | 42 // Replies to the message with the specified |error_code| as a MIG |
| 42 // error_reply RetCode. | 43 // error_reply RetCode. |
| 43 void RejectMessage(IPCMessage request, int error_code) override; | 44 void RejectMessage(IPCMessage request, int error_code) override; |
| 44 mach_port_t GetServerPort() const override; | 45 mach_port_t GetServerPort() const override; |
| 45 | 46 |
| 46 private: | 47 private: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 64 // MACH_RECV dispatch source that handles the |server_port_|. | 65 // MACH_RECV dispatch source that handles the |server_port_|. |
| 65 scoped_ptr<base::DispatchSourceMach> dispatch_source_; | 66 scoped_ptr<base::DispatchSourceMach> dispatch_source_; |
| 66 | 67 |
| 67 // Whether or not ForwardMessage() was called during ReceiveMessage(). | 68 // Whether or not ForwardMessage() was called during ReceiveMessage(). |
| 68 bool did_forward_message_; | 69 bool did_forward_message_; |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 } // namespace sandbox | 72 } // namespace sandbox |
| 72 | 73 |
| 73 #endif // SANDBOX_MAC_MACH_MESSAGE_SERVER_H_ | 74 #endif // SANDBOX_MAC_MACH_MESSAGE_SERVER_H_ |
| OLD | NEW |