| 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_XPC_MESSAGE_SERVER_H_ | 5 #ifndef SANDBOX_MAC_XPC_MESSAGE_SERVER_H_ |
| 6 #define SANDBOX_MAC_XPC_MESSAGE_SERVER_H_ | 6 #define SANDBOX_MAC_XPC_MESSAGE_SERVER_H_ |
| 7 | 7 |
| 8 #include <AvailabilityMacros.h> | 8 #include <AvailabilityMacros.h> |
| 9 | 9 |
| 10 #include "base/mac/dispatch_source_mach.h" | 10 #include "base/mac/dispatch_source_mach.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Creates a new XPC message server that will send messages to |demuxer| | 24 // Creates a new XPC message server that will send messages to |demuxer| |
| 25 // for handling. If the |server_receive_right| is non-NULL, this class will | 25 // for handling. If the |server_receive_right| is non-NULL, this class will |
| 26 // take ownership of the port and it will be used to receive messages. | 26 // take ownership of the port and it will be used to receive messages. |
| 27 // Otherwise the server will create a new receive right on which to listen. | 27 // Otherwise the server will create a new receive right on which to listen. |
| 28 XPCMessageServer(MessageDemuxer* demuxer, | 28 XPCMessageServer(MessageDemuxer* demuxer, |
| 29 mach_port_t server_receive_right); | 29 mach_port_t server_receive_right); |
| 30 ~XPCMessageServer() override; | 30 ~XPCMessageServer() override; |
| 31 | 31 |
| 32 // MessageServer: | 32 // MessageServer: |
| 33 bool Initialize() override; | 33 bool Initialize() override; |
| 34 void Shutdown() override; |
| 34 pid_t GetMessageSenderPID(IPCMessage request) override; | 35 pid_t GetMessageSenderPID(IPCMessage request) override; |
| 35 IPCMessage CreateReply(IPCMessage request) override; | 36 IPCMessage CreateReply(IPCMessage request) override; |
| 36 bool SendReply(IPCMessage reply) override; | 37 bool SendReply(IPCMessage reply) override; |
| 37 void ForwardMessage(IPCMessage request, mach_port_t destination) override; | 38 void ForwardMessage(IPCMessage request, mach_port_t destination) override; |
| 38 // Creates an error reply message with a field "error" set to |error_code|. | 39 // Creates an error reply message with a field "error" set to |error_code|. |
| 39 void RejectMessage(IPCMessage request, int error_code) override; | 40 void RejectMessage(IPCMessage request, int error_code) override; |
| 40 mach_port_t GetServerPort() const override; | 41 mach_port_t GetServerPort() const override; |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 // Reads a message from the XPC pipe. | 44 // Reads a message from the XPC pipe. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 54 | 55 |
| 55 // The reply message, if one has been created. | 56 // The reply message, if one has been created. |
| 56 xpc_object_t reply_message_; | 57 xpc_object_t reply_message_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(XPCMessageServer); | 59 DISALLOW_COPY_AND_ASSIGN(XPCMessageServer); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 } // namespace sandbox | 62 } // namespace sandbox |
| 62 | 63 |
| 63 #endif // SANDBOX_MAC_XPC_MESSAGE_SERVER_H_ | 64 #endif // SANDBOX_MAC_XPC_MESSAGE_SERVER_H_ |
| OLD | NEW |