mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-31 01:43:03 +08:00
49f170e633
MachMessageServer was wasteful with allocations for request and reply messages. It allocated new memory for each request receive and for each reply send, and if it needed to resize an allocation for a request, it would maintain two request allocations simultaneously. The new behavior allocates memory for a new request only if it needs a different size than for the previous request, and it never maintains two request allocations simultaneously. Memory for a reply is allocated once per method invocation and maintained, since this never needs to be resized. One pass of the loop is now guaranteed, even if a caller specifies a very small timeout that expires before attempting to receive a message. An infinite looping bug that could occur when ignoring large messages has also been fixed. TEST=util_test MachMessageServer.* R=rsesek@chromium.org Review URL: https://codereview.chromium.org/759023004