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 |
| 11 #include <memory> |
| 12 |
11 #include "base/mac/dispatch_source_mach.h" | 13 #include "base/mac/dispatch_source_mach.h" |
12 #include "base/mac/scoped_mach_port.h" | 14 #include "base/mac/scoped_mach_port.h" |
13 #include "base/mac/scoped_mach_vm.h" | 15 #include "base/mac/scoped_mach_vm.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "sandbox/mac/message_server.h" | 16 #include "sandbox/mac/message_server.h" |
16 | 17 |
17 namespace sandbox { | 18 namespace sandbox { |
18 | 19 |
19 // A Mach message server that operates a receive port. Messages are received | 20 // A Mach message server that operates a receive port. Messages are received |
20 // and then passed to the MessageDemuxer for handling. The Demuxer | 21 // and then passed to the MessageDemuxer for handling. The Demuxer |
21 // can use the server class to send a reply, forward the message to a | 22 // can use the server class to send a reply, forward the message to a |
22 // different port, or reply to the message with a MIG error. | 23 // different port, or reply to the message with a MIG error. |
23 class MachMessageServer : public MessageServer { | 24 class MachMessageServer : public MessageServer { |
24 public: | 25 public: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 base::mac::ScopedMachReceiveRight server_port_; | 57 base::mac::ScopedMachReceiveRight server_port_; |
57 | 58 |
58 // The size of the two message buffers below. | 59 // The size of the two message buffers below. |
59 const mach_msg_size_t buffer_size_; | 60 const mach_msg_size_t buffer_size_; |
60 | 61 |
61 // Request and reply buffers used in ReceiveMessage. | 62 // Request and reply buffers used in ReceiveMessage. |
62 base::mac::ScopedMachVM request_buffer_; | 63 base::mac::ScopedMachVM request_buffer_; |
63 base::mac::ScopedMachVM reply_buffer_; | 64 base::mac::ScopedMachVM reply_buffer_; |
64 | 65 |
65 // MACH_RECV dispatch source that handles the |server_port_|. | 66 // MACH_RECV dispatch source that handles the |server_port_|. |
66 scoped_ptr<base::DispatchSourceMach> dispatch_source_; | 67 std::unique_ptr<base::DispatchSourceMach> dispatch_source_; |
67 | 68 |
68 // Whether or not ForwardMessage() was called during ReceiveMessage(). | 69 // Whether or not ForwardMessage() was called during ReceiveMessage(). |
69 bool did_forward_message_; | 70 bool did_forward_message_; |
70 }; | 71 }; |
71 | 72 |
72 } // namespace sandbox | 73 } // namespace sandbox |
73 | 74 |
74 #endif // SANDBOX_MAC_MACH_MESSAGE_SERVER_H_ | 75 #endif // SANDBOX_MAC_MACH_MESSAGE_SERVER_H_ |
OLD | NEW |