OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 | |
15 #ifndef CRASHPAD_UTIL_MACH_CHILD_PORT_SERVER_H_ | |
16 #define CRASHPAD_UTIL_MACH_CHILD_PORT_SERVER_H_ | |
17 | |
18 #include <mach/mach.h> | |
19 | |
20 #include "base/basictypes.h" | |
21 #include "util/mach/child_port_types.h" | |
22 #include "util/mach/mach_message_server.h" | |
23 | |
24 namespace crashpad { | |
25 | |
26 //! \brief A server interface for the `child_port` Mach subsystem. | |
27 class ChildPortServer : public MachMessageServer::Interface { | |
28 public: | |
29 //! \brief An interface that the request message that is a part of the | |
30 //! `child_port` Mach subsystem can be dispatched to. | |
31 class Interface { | |
32 public: | |
33 //! \brief Handles check-ins sent by `child_port_check_in()`. | |
34 //! | |
35 //! This behaves equivalently to a `handle_child_port_check_in()` function | |
36 //! used with `child_port_server()`. | |
37 //! | |
38 //! \param[out] destroy_request `true` if the request message is to be | |
39 //! destroyed even when this method returns success. See | |
40 //! MachMessageServer::Interface. | |
41 virtual kern_return_t HandleChildPortCheckIn( | |
42 child_port_server_t server, | |
43 const child_port_token_t token, | |
44 mach_port_t port, | |
45 mach_msg_type_name_t right_type, | |
46 bool* destroy_complex_request) = 0; | |
47 | |
48 protected: | |
49 ~Interface() {} | |
50 }; | |
51 | |
52 explicit ChildPortServer(Interface* interface); | |
Robert Sesek
2014/11/25 14:48:25
Document the parameter ownership.
| |
53 | |
54 // MachMessageServer::Interface: | |
55 | |
56 bool MachMessageServerFunction(const mach_msg_header_t* in_header, | |
57 mach_msg_header_t* out_header, | |
58 bool* destroy_complex_request) override; | |
59 | |
60 mach_msg_size_t MachMessageServerRequestSize() override; | |
61 mach_msg_size_t MachMessageServerReplySize() override; | |
62 | |
63 private: | |
64 Interface* interface_; // weak | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(ChildPortServer); | |
67 }; | |
68 | |
69 } // namespace crashpad | |
70 | |
71 #endif // CRASHPAD_UTIL_MACH_CHILD_PORT_SERVER_H_ | |
OLD | NEW |