Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: util/mach/child_port_server.h

Issue 754123002: Add ChildPortServer, a MachMessageServer::Interface implementation for the child_port subsystem (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@child_port_defs
Patch Set: Address review feedback Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | util/mach/child_port_server.cc » ('j') | util/mach/child_port_server_test.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 //! \brief Constructs an object of this class.
53 //!
54 //! \param[in] interface The interface to dispatch requests to. Weak.
55 explicit ChildPortServer(Interface* interface);
56
57 // MachMessageServer::Interface:
58
59 bool MachMessageServerFunction(const mach_msg_header_t* in_header,
60 mach_msg_header_t* out_header,
61 bool* destroy_complex_request) override;
62
63 mach_msg_size_t MachMessageServerRequestSize() override;
64 mach_msg_size_t MachMessageServerReplySize() override;
65
66 private:
67 Interface* interface_; // weak
68
69 DISALLOW_COPY_AND_ASSIGN(ChildPortServer);
70 };
71
72 } // namespace crashpad
73
74 #endif // CRASHPAD_UTIL_MACH_CHILD_PORT_SERVER_H_
OLDNEW
« no previous file with comments | « no previous file | util/mach/child_port_server.cc » ('j') | util/mach/child_port_server_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698