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

Unified Diff: util/mach/mach_message_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/mach/exception_ports_test.cc ('k') | util/mach/mach_message_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mach/mach_message_server.cc
diff --git a/util/mach/mach_message_server.cc b/util/mach/mach_message_server.cc
index c0f848daa9a627ee04d9fef9ea763c3052f7be2c..08760fc6cfe78aa1469ace8b7b645757b1d6fde9 100644
--- a/util/mach/mach_message_server.cc
+++ b/util/mach/mach_message_server.cc
@@ -111,7 +111,8 @@ mach_msg_return_t MachMessageServer::Run(Interface* interface,
mach_msg_size_t trailer_alloc = REQUESTED_TRAILER_SIZE(options);
mach_msg_size_t max_request_size = interface->MachMessageServerRequestSize();
- mach_msg_size_t request_alloc = round_page(max_request_size + trailer_alloc);
+ mach_msg_size_t request_alloc =
+ round_page(round_msg(max_request_size) + trailer_alloc);
// mach_msg_server() and mach_msg_server_once() invert this condition, but
// their interpretation is incorrect. When it is desirable to retry a receive
@@ -120,9 +121,10 @@ mach_msg_return_t MachMessageServer::Run(Interface* interface,
// the initial receive attempt. On the other hand, when this behavior is not
// requested, there is no reason to attempt receiving messages any larger than
// expected.
- mach_msg_size_t request_size = (receive_large == kReceiveLargeResize)
- ? max_request_size + trailer_alloc
- : request_alloc;
+ mach_msg_size_t request_size =
+ (receive_large == kReceiveLargeResize)
+ ? round_msg(max_request_size) + trailer_alloc
+ : request_alloc;
mach_msg_size_t max_reply_size = interface->MachMessageServerReplySize();
@@ -186,7 +188,7 @@ mach_msg_return_t MachMessageServer::Run(Interface* interface,
} else if (kr == MACH_RCV_TOO_LARGE &&
receive_large == kReceiveLargeResize) {
this_request_size =
- round_page(request_header->msgh_size + trailer_alloc);
+ round_page(round_msg(request_header->msgh_size) + trailer_alloc);
this_request_alloc = this_request_size;
} else {
return kr;
« no previous file with comments | « util/mach/exception_ports_test.cc ('k') | util/mach/mach_message_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698