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

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

Issue 755313004: Pass Mach message trailers to server handler functions (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
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 | « util/mach/child_port_server.h ('k') | util/mach/child_port_server_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with 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 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 : MachMessageServer::Interface(), 65 : MachMessageServer::Interface(),
66 interface_(interface) { 66 interface_(interface) {
67 } 67 }
68 68
69 bool ChildPortServer::MachMessageServerFunction( 69 bool ChildPortServer::MachMessageServerFunction(
70 const mach_msg_header_t* in_header, 70 const mach_msg_header_t* in_header,
71 mach_msg_header_t* out_header, 71 mach_msg_header_t* out_header,
72 bool* destroy_complex_request) { 72 bool* destroy_complex_request) {
73 PrepareMIGReplyFromRequest(in_header, out_header); 73 PrepareMIGReplyFromRequest(in_header, out_header);
74 74
75 const mach_msg_trailer_t* in_trailer =
76 MachMessageTrailerFromHeader(in_header);
77
75 switch (in_header->msgh_id) { 78 switch (in_header->msgh_id) {
76 case kMachMessageIDChildPortCheckIn: { 79 case kMachMessageIDChildPortCheckIn: {
77 // child_port_check_in(), handle_child_port_check_in(). 80 // child_port_check_in(), handle_child_port_check_in().
78 using Request = __Request__child_port_check_in_t; 81 using Request = __Request__child_port_check_in_t;
79 const Request* in_request = reinterpret_cast<const Request*>(in_header); 82 const Request* in_request = reinterpret_cast<const Request*>(in_header);
80 kern_return_t kr = MIGCheckRequestChildPortCheckIn(in_request); 83 kern_return_t kr = MIGCheckRequestChildPortCheckIn(in_request);
81 if (kr != MACH_MSG_SUCCESS) { 84 if (kr != MACH_MSG_SUCCESS) {
82 SetMIGReplyError(out_header, kr); 85 SetMIGReplyError(out_header, kr);
83 return true; 86 return true;
84 } 87 }
85 88
86 using Reply = __Reply__child_port_check_in_t; 89 using Reply = __Reply__child_port_check_in_t;
87 Reply* out_reply = reinterpret_cast<Reply*>(out_header); 90 Reply* out_reply = reinterpret_cast<Reply*>(out_header);
88 out_reply->RetCode = 91 out_reply->RetCode =
89 interface_->HandleChildPortCheckIn(in_header->msgh_local_port, 92 interface_->HandleChildPortCheckIn(in_header->msgh_local_port,
90 in_request->token, 93 in_request->token,
91 in_request->port.name, 94 in_request->port.name,
92 in_request->port.disposition, 95 in_request->port.disposition,
96 in_trailer,
93 destroy_complex_request); 97 destroy_complex_request);
94 return true; 98 return true;
95 } 99 }
96 } 100 }
97 101
98 SetMIGReplyError(out_header, MIG_BAD_ID); 102 SetMIGReplyError(out_header, MIG_BAD_ID);
99 return false; 103 return false;
100 } 104 }
101 105
102 mach_msg_size_t ChildPortServer::MachMessageServerRequestSize() { 106 mach_msg_size_t ChildPortServer::MachMessageServerRequestSize() {
103 return sizeof(__RequestUnion__handle_child_port_subsystem); 107 return sizeof(__RequestUnion__handle_child_port_subsystem);
104 } 108 }
105 109
106 mach_msg_size_t ChildPortServer::MachMessageServerReplySize() { 110 mach_msg_size_t ChildPortServer::MachMessageServerReplySize() {
107 return sizeof(__ReplyUnion__handle_child_port_subsystem); 111 return sizeof(__ReplyUnion__handle_child_port_subsystem);
108 } 112 }
109 113
110 } // namespace crashpad 114 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/mach/child_port_server.h ('k') | util/mach/child_port_server_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698