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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 // Send the port that this process is listening on to the server. | 473 // Send the port that this process is listening on to the server. |
474 IPC::SendMachPort( | 474 IPC::SendMachPort( |
475 server_port.get(), client_port.get(), MACH_MSG_TYPE_MAKE_SEND); | 475 server_port.get(), client_port.get(), MACH_MSG_TYPE_MAKE_SEND); |
476 | 476 |
477 // Receive the task port of the server process. | 477 // Receive the task port of the server process. |
478 base::mac::ScopedMachSendRight server_task_port( | 478 base::mac::ScopedMachSendRight server_task_port( |
479 IPC::ReceiveMachPort(client_port.get())); | 479 IPC::ReceiveMachPort(client_port.get())); |
480 | 480 |
481 scoped_ptr<ChildProcessGlobals> globals(new ChildProcessGlobals); | 481 scoped_ptr<ChildProcessGlobals> globals(new ChildProcessGlobals); |
482 globals->port_provider.InsertEntry(getppid(), server_task_port.get()); | 482 globals->port_provider.InsertEntry(getppid(), server_task_port.get()); |
483 globals->broker.SetPortProvider(&globals->port_provider); | 483 globals->broker.set_port_provider(&globals->port_provider); |
484 globals->server_task_port.reset(server_task_port.release()); | 484 globals->server_task_port.reset(server_task_port.release()); |
485 return globals; | 485 return globals; |
486 } | 486 } |
487 | 487 |
488 int CommonPrivilegedProcessMain(OnMessageReceivedCallback callback, | 488 int CommonPrivilegedProcessMain(OnMessageReceivedCallback callback, |
489 const char* channel_name) { | 489 const char* channel_name) { |
490 LOG(INFO) << "Privileged process start."; | 490 LOG(INFO) << "Privileged process start."; |
491 scoped_ptr<ChildProcessGlobals> globals(CommonChildProcessSetUp()); | 491 scoped_ptr<ChildProcessGlobals> globals(CommonChildProcessSetUp()); |
492 | 492 |
493 mach_msg_type_number_t active_names_at_start = IPC::GetActiveNameCount(); | 493 mach_msg_type_number_t active_names_at_start = IPC::GetActiveNameCount(); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 // Do nothing special. The default behavior already runs the | 831 // Do nothing special. The default behavior already runs the |
832 // AttachmentBrokerPrivilegedMac. | 832 // AttachmentBrokerPrivilegedMac. |
833 } | 833 } |
834 | 834 |
835 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendSharedMemoryHandleToSelf) { | 835 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendSharedMemoryHandleToSelf) { |
836 return CommonPrivilegedProcessMain(&SendSharedMemoryHandleToSelfCallback, | 836 return CommonPrivilegedProcessMain(&SendSharedMemoryHandleToSelfCallback, |
837 "SendSharedMemoryHandleToSelf"); | 837 "SendSharedMemoryHandleToSelf"); |
838 } | 838 } |
839 | 839 |
840 } // namespace | 840 } // namespace |
OLD | NEW |