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

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

Issue 654933002: Use exactly one of final, override, and virtual (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: git grep -E '^ {3,}.*override[ Created 6 years, 2 months 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/exception_ports_test.cc ('k') | util/mach/scoped_task_suspend_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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 reply->Head.msgh_remote_port = request->header.msgh_remote_port; 264 reply->Head.msgh_remote_port = request->header.msgh_remote_port;
265 reply->Head.msgh_local_port = MACH_PORT_NULL; 265 reply->Head.msgh_local_port = MACH_PORT_NULL;
266 reply->Head.msgh_id = kReplyMessageId; 266 reply->Head.msgh_id = kReplyMessageId;
267 reply->NDR = NDR_record; 267 reply->NDR = NDR_record;
268 reply->RetCode = options_.server_mig_retcode; 268 reply->RetCode = options_.server_mig_retcode;
269 reply->number = replies_++; 269 reply->number = replies_++;
270 270
271 return true; 271 return true;
272 } 272 }
273 273
274 virtual mach_msg_size_t MachMessageServerRequestSize() override { 274 mach_msg_size_t MachMessageServerRequestSize() override {
275 return sizeof(RequestMessage); 275 return sizeof(RequestMessage);
276 } 276 }
277 277
278 virtual mach_msg_size_t MachMessageServerReplySize() override { 278 mach_msg_size_t MachMessageServerReplySize() override {
279 return sizeof(ReplyMessage); 279 return sizeof(ReplyMessage);
280 } 280 }
281 281
282 private: 282 private:
283 struct RequestMessage : public mach_msg_base_t { 283 struct RequestMessage : public mach_msg_base_t {
284 // If body.msgh_descriptor_count is 0, port_descriptor will still be 284 // If body.msgh_descriptor_count is 0, port_descriptor will still be
285 // present, but it will be zeroed out. It wouldn’t normally be present in a 285 // present, but it will be zeroed out. It wouldn’t normally be present in a
286 // message froma MIG-generated interface, but it’s harmless and simpler to 286 // message froma MIG-generated interface, but it’s harmless and simpler to
287 // leave it here and just treat it as more data. 287 // leave it here and just treat it as more data.
288 mach_msg_port_descriptor_t port_descriptor; 288 mach_msg_port_descriptor_t port_descriptor;
289 289
290 NDR_record_t ndr; 290 NDR_record_t ndr;
291 uint32_t number; 291 uint32_t number;
292 }; 292 };
293 293
294 // LargeRequestMessage is larger enough than a regular RequestMessage to 294 // LargeRequestMessage is larger enough than a regular RequestMessage to
295 // ensure that whatever buffer was allocated to receive a RequestMessage is 295 // ensure that whatever buffer was allocated to receive a RequestMessage is
296 // not large enough to receive a LargeRequestMessage. 296 // not large enough to receive a LargeRequestMessage.
297 struct LargeRequestMessage : public RequestMessage { 297 struct LargeRequestMessage : public RequestMessage {
298 uint8_t data[4 * PAGE_SIZE]; 298 uint8_t data[4 * PAGE_SIZE];
299 }; 299 };
300 300
301 struct ReplyMessage : public mig_reply_error_t { 301 struct ReplyMessage : public mig_reply_error_t {
302 uint32_t number; 302 uint32_t number;
303 }; 303 };
304 304
305 // MachMultiprocess: 305 // MachMultiprocess:
306 306
307 virtual void MachMultiprocessParent() override { 307 void MachMultiprocessParent() override {
308 mach_port_t local_port = LocalPort(); 308 mach_port_t local_port = LocalPort();
309 309
310 kern_return_t kr; 310 kern_return_t kr;
311 if (options_.child_send_all_requests_before_receiving_any_replies) { 311 if (options_.child_send_all_requests_before_receiving_any_replies) {
312 // On Mac OS X 10.10, the queue limit of a new Mach port seems to be 2 312 // On Mac OS X 10.10, the queue limit of a new Mach port seems to be 2
313 // by default, which is below the value of MACH_PORT_QLIMIT_DEFAULT. Set 313 // by default, which is below the value of MACH_PORT_QLIMIT_DEFAULT. Set
314 // the port’s queue limit explicitly here. 314 // the port’s queue limit explicitly here.
315 mach_port_limits limits = {}; 315 mach_port_limits limits = {};
316 limits.mpl_qlimit = MACH_PORT_QLIMIT_DEFAULT; 316 limits.mpl_qlimit = MACH_PORT_QLIMIT_DEFAULT;
317 kr = mach_port_set_attributes(mach_task_self(), 317 kr = mach_port_set_attributes(mach_task_self(),
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 << MachErrorMessage(kr, "mach_port_type"); 374 << MachErrorMessage(kr, "mach_port_type");
375 } 375 }
376 376
377 if (options_.child_wait_for_parent_pipe_late) { 377 if (options_.child_wait_for_parent_pipe_late) {
378 // Let the child know it’s safe to exit. 378 // Let the child know it’s safe to exit.
379 char c = '\0'; 379 char c = '\0';
380 CheckedWriteFD(WritePipeFD(), &c, 1); 380 CheckedWriteFD(WritePipeFD(), &c, 1);
381 } 381 }
382 } 382 }
383 383
384 virtual void MachMultiprocessChild() override { 384 void MachMultiprocessChild() override {
385 if (options_.child_wait_for_parent_pipe_early) { 385 if (options_.child_wait_for_parent_pipe_early) {
386 // Wait until the parent is done setting things up on its end. 386 // Wait until the parent is done setting things up on its end.
387 char c; 387 char c;
388 CheckedReadFD(ReadPipeFD(), &c, 1); 388 CheckedReadFD(ReadPipeFD(), &c, 1);
389 EXPECT_EQ('\0', c); 389 EXPECT_EQ('\0', c);
390 } 390 }
391 391
392 for (size_t index = 0; 392 for (size_t index = 0;
393 index < options_.client_send_request_count; 393 index < options_.client_send_request_count;
394 ++index) { 394 ++index) {
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 TestMachMessageServer::Options options; 824 TestMachMessageServer::Options options;
825 options.server_options = MACH_RCV_LARGE; 825 options.server_options = MACH_RCV_LARGE;
826 options.client_send_large = true; 826 options.client_send_large = true;
827 TestMachMessageServer test_mach_message_server(options); 827 TestMachMessageServer test_mach_message_server(options);
828 test_mach_message_server.Test(); 828 test_mach_message_server.Test();
829 } 829 }
830 830
831 } // namespace 831 } // namespace
832 } // namespace test 832 } // namespace test
833 } // namespace crashpad 833 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/mach/exception_ports_test.cc ('k') | util/mach/scoped_task_suspend_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698