diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-02 15:33:39 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-02 15:33:39 +0000 |
commit | e3ef18d3b88e805535c09a8f7cf7d69e0ef4c391 (patch) | |
tree | 7ab29c1dfca8349d20b412ec0512d03877d046e6 /base | |
parent | 7495a49d7d422c8d34a642201b33eb21f34ea44c (diff) | |
download | chromium_src-e3ef18d3b88e805535c09a8f7cf7d69e0ef4c391.zip chromium_src-e3ef18d3b88e805535c09a8f7cf7d69e0ef4c391.tar.gz chromium_src-e3ef18d3b88e805535c09a8f7cf7d69e0ef4c391.tar.bz2 |
[Mac] Add comment explaining why we create the mach receive port when we do.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/3217010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/process_util_posix.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc index 33b89d2..d50ff9f 100644 --- a/base/process_util_posix.cc +++ b/base/process_util_posix.cc @@ -308,6 +308,10 @@ static pid_t fork_and_get_task(task_t* child_task) { std::string mach_connection_name = StringPrintf( "com.google.Chrome.samplingfork.%p.%d", child_task, base::RandInt(0, std::numeric_limits<int>::max())); + + // Create the mach receive port before forking to ensure that it exists when + // the child tries to connect. Mach ports are not duped into the child, so + // this is safe to set up here. ReceivePort parent_recv_port(mach_connection_name.c_str()); // Error handling philosophy: If Mach IPC fails, don't touch |child_task| but |