OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 471 |
472 // Send the port that this process is listening on to the server. | 472 // Send the port that this process is listening on to the server. |
473 IPC::SendMachPort(server_port, client_port, MACH_MSG_TYPE_MAKE_SEND); | 473 IPC::SendMachPort(server_port, client_port, MACH_MSG_TYPE_MAKE_SEND); |
474 | 474 |
475 // Receive the task port of the server process. | 475 // Receive the task port of the server process. |
476 base::mac::ScopedMachSendRight server_task_port( | 476 base::mac::ScopedMachSendRight server_task_port( |
477 IPC::ReceiveMachPort(client_port)); | 477 IPC::ReceiveMachPort(client_port)); |
478 | 478 |
479 scoped_ptr<ChildProcessGlobals> globals(new ChildProcessGlobals); | 479 scoped_ptr<ChildProcessGlobals> globals(new ChildProcessGlobals); |
480 globals->port_provider.InsertEntry(getppid(), server_task_port); | 480 globals->port_provider.InsertEntry(getppid(), server_task_port); |
481 globals->broker.SetPortProvider(&globals->port_provider); | 481 globals->broker.set_port_provider(&globals->port_provider); |
482 globals->server_task_port.reset(server_task_port.release()); | 482 globals->server_task_port.reset(server_task_port.release()); |
483 return globals; | 483 return globals; |
484 } | 484 } |
485 | 485 |
486 int CommonPrivilegedProcessMain(OnMessageReceivedCallback callback, | 486 int CommonPrivilegedProcessMain(OnMessageReceivedCallback callback, |
487 const char* channel_name) { | 487 const char* channel_name) { |
488 LOG(INFO) << "Privileged process start."; | 488 LOG(INFO) << "Privileged process start."; |
489 scoped_ptr<ChildProcessGlobals> globals(CommonChildProcessSetUp()); | 489 scoped_ptr<ChildProcessGlobals> globals(CommonChildProcessSetUp()); |
490 | 490 |
491 mach_msg_type_number_t active_names_at_start = IPC::GetActiveNameCount(); | 491 mach_msg_type_number_t active_names_at_start = IPC::GetActiveNameCount(); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 // Do nothing special. The default behavior already runs the | 829 // Do nothing special. The default behavior already runs the |
830 // AttachmentBrokerPrivilegedMac. | 830 // AttachmentBrokerPrivilegedMac. |
831 } | 831 } |
832 | 832 |
833 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendSharedMemoryHandleToSelf) { | 833 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendSharedMemoryHandleToSelf) { |
834 return CommonPrivilegedProcessMain(&SendSharedMemoryHandleToSelfCallback, | 834 return CommonPrivilegedProcessMain(&SendSharedMemoryHandleToSelfCallback, |
835 "SendSharedMemoryHandleToSelf"); | 835 "SendSharedMemoryHandleToSelf"); |
836 } | 836 } |
837 | 837 |
838 } // namespace | 838 } // namespace |
OLD | NEW |