| 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 <memory> |
| 11 |
| 10 #include "base/mac/dispatch_source_mach.h" | 12 #include "base/mac/dispatch_source_mach.h" |
| 11 #include "base/mac/scoped_mach_port.h" | 13 #include "base/mac/scoped_mach_port.h" |
| 12 #include "base/macros.h" | 14 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "sandbox/mac/message_server.h" | 15 #include "sandbox/mac/message_server.h" |
| 15 #include "sandbox/mac/xpc.h" | 16 #include "sandbox/mac/xpc.h" |
| 16 #include "sandbox/sandbox_export.h" | 17 #include "sandbox/sandbox_export.h" |
| 17 | 18 |
| 18 namespace sandbox { | 19 namespace sandbox { |
| 19 | 20 |
| 20 // An implementation of MessageServer that uses XPC pipes to read and write XPC | 21 // An implementation of MessageServer that uses XPC pipes to read and write XPC |
| 21 // messages from a Mach port. | 22 // messages from a Mach port. |
| 22 class SANDBOX_EXPORT XPCMessageServer : public MessageServer { | 23 class SANDBOX_EXPORT XPCMessageServer : public MessageServer { |
| 23 public: | 24 public: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 // Reads a message from the XPC pipe. | 45 // Reads a message from the XPC pipe. |
| 45 void ReceiveMessage(); | 46 void ReceiveMessage(); |
| 46 | 47 |
| 47 // The demuxer delegate. Weak. | 48 // The demuxer delegate. Weak. |
| 48 MessageDemuxer* demuxer_; | 49 MessageDemuxer* demuxer_; |
| 49 | 50 |
| 50 // The Mach port on which the server is receiving requests. | 51 // The Mach port on which the server is receiving requests. |
| 51 base::mac::ScopedMachReceiveRight server_port_; | 52 base::mac::ScopedMachReceiveRight server_port_; |
| 52 | 53 |
| 53 // MACH_RECV dispatch source that handles the |server_port_|. | 54 // MACH_RECV dispatch source that handles the |server_port_|. |
| 54 scoped_ptr<base::DispatchSourceMach> dispatch_source_; | 55 std::unique_ptr<base::DispatchSourceMach> dispatch_source_; |
| 55 | 56 |
| 56 // The reply message, if one has been created. | 57 // The reply message, if one has been created. |
| 57 xpc_object_t reply_message_; | 58 xpc_object_t reply_message_; |
| 58 | 59 |
| 59 DISALLOW_COPY_AND_ASSIGN(XPCMessageServer); | 60 DISALLOW_COPY_AND_ASSIGN(XPCMessageServer); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 } // namespace sandbox | 63 } // namespace sandbox |
| 63 | 64 |
| 64 #endif // SANDBOX_MAC_XPC_MESSAGE_SERVER_H_ | 65 #endif // SANDBOX_MAC_XPC_MESSAGE_SERVER_H_ |
| OLD | NEW |