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

Issue 3443002: [Mac] Replace the existing browser-child mach ipc with a long-lived listener ... (Closed)

Created:
10 years, 3 months ago by rohitrao (ping after 24h)
Modified:
9 years, 7 months ago
Reviewers:
Mark Mentovai, Nico
CC:
chromium-reviews, Paweł Hajdan Jr., ben+cc_chromium.org, pam+watch_chromium.org, brettw-cc_chromium.org
Visibility:
Public.

Description

[Mac] Replace the existing browser-child mach ipc with a long-lived listener on a well-known port. Before this CL: Before fork()ing a child, the browser process creates a mach receive port with a random name. After the fork() but before exec(), the child uses mach ipc to transmit send rights to its task port. The child has access to the random name because it inherits it from the browser process. Unfortunately, some of the library functions involved in sending a mach message are not safe to call after fork(). After this CL: Before forking the first child, the browser spins off a new thread that listens on a well-known port for mach ipc from any process. This well-known port is "com.google.Chrome.<browserpid>". When a child process starts up, it sends a mach message to its parent browser's well-known port. On the browser side, we listen for said message, extract the pid of the sending process, and ignore any messages from processes we did not personally fork(). This check is necessary because any arbitrary process on the system could send mach ipc to that port. BUG=35374 TEST=Browser should still start up. The task manager should still show correct cpu/memory data. There should be no perf regressions. TEST=Mac ui_tests and browser_tests should be less flaky. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=59782

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 37

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Total comments: 30

Patch Set 10 : '' #

Patch Set 11 : '' #

Total comments: 18

Patch Set 12 : '' #

Patch Set 13 : '' #

Total comments: 8

Patch Set 14 : '' #

Patch Set 15 : '' #

Patch Set 16 : '' #

Patch Set 17 : '' #

Total comments: 2

Patch Set 18 : '' #

Patch Set 19 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+296 lines, -168 lines) Patch
M base/mach_ipc_mac.h View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 9 chunks +17 lines, -16 lines 0 comments Download
M base/mach_ipc_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +11 lines, -2 lines 0 comments Download
M base/process_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +0 lines, -12 lines 0 comments Download
M base/process_util_posix.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 5 chunks +0 lines, -101 lines 0 comments Download
M chrome/app/chrome_dll_main.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +27 lines, -1 line 0 comments Download
M chrome/browser/child_process_launcher.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +23 lines, -13 lines 0 comments Download
M chrome/browser/mach_broker_mac.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 5 chunks +31 lines, -6 lines 0 comments Download
M chrome/browser/mach_broker_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 5 chunks +146 lines, -12 lines 0 comments Download
M chrome/browser/mach_broker_mac_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +41 lines, -5 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
rohitrao (ping after 24h)
Ok, I think this is ready for a real look. We're most likely leaking map ...
10 years, 3 months ago (2010-09-14 22:39:17 UTC) #1
Nico
couple nits. didn't look closely yet, but looks good from a distance http://codereview.chromium.org/3443002/diff/25001/23006 File chrome/app/chrome_dll_main.cc ...
10 years, 3 months ago (2010-09-15 00:00:38 UTC) #2
Mark Mentovai
http://codereview.chromium.org/3443002/diff/25001/23003 File base/mach_ipc_mac.mm (right): http://codereview.chromium.org/3443002/diff/25001/23003#newcode206 base/mach_ipc_mac.mm:206: options:NSMachPortDeallocateNone]; Align your colons. http://codereview.chromium.org/3443002/diff/25001/23005 File base/process_util_posix.cc (left): http://codereview.chromium.org/3443002/diff/25001/23005#oldcode303 ...
10 years, 3 months ago (2010-09-15 17:02:17 UTC) #3
rohitrao (ping after 24h)
New diffs up. The comments below include a few questions here and there. http://codereview.chromium.org/3443002/diff/25001/23003 File ...
10 years, 3 months ago (2010-09-15 19:23:08 UTC) #4
Mark Mentovai
Allays I been reviewd http://codereview.chromium.org/3443002/diff/25001/23007 File chrome/browser/child_process_launcher.cc (right): http://codereview.chromium.org/3443002/diff/25001/23007#newcode174 chrome/browser/child_process_launcher.cc:174: MachBroker::instance()->AcquireLock(); rohitrao wrote: > Your ...
10 years, 3 months ago (2010-09-16 16:56:36 UTC) #5
rohitrao (ping after 24h)
http://codereview.chromium.org/3443002/diff/25001/23007 File chrome/browser/child_process_launcher.cc (right): http://codereview.chromium.org/3443002/diff/25001/23007#newcode174 chrome/browser/child_process_launcher.cc:174: MachBroker::instance()->AcquireLock(); On 2010/09/16 16:56:36, Mark Mentovai wrote: > Sure, ...
10 years, 3 months ago (2010-09-16 18:35:06 UTC) #6
Mark Mentovai
The race sucks. The rest is just anal polish. http://codereview.chromium.org/3443002/diff/4003/42007 File chrome/browser/child_process_launcher.cc (right): http://codereview.chromium.org/3443002/diff/4003/42007#newcode180 chrome/browser/child_process_launcher.cc:180: ...
10 years, 3 months ago (2010-09-16 18:56:28 UTC) #7
rohitrao (ping after 24h)
http://codereview.chromium.org/3443002/diff/4003/42007 File chrome/browser/child_process_launcher.cc (right): http://codereview.chromium.org/3443002/diff/4003/42007#newcode180 chrome/browser/child_process_launcher.cc:180: launched = base::LaunchApp(cmd_line->argv(), env, fds_to_map, On 2010/09/16 18:56:28, Mark ...
10 years, 3 months ago (2010-09-16 19:28:47 UTC) #8
Mark Mentovai
Stop asking me to review this, because I’ll just keep finding stupid things to ask ...
10 years, 3 months ago (2010-09-16 19:40:28 UTC) #9
rohitrao (ping after 24h)
http://codereview.chromium.org/3443002/diff/45002/66006 File chrome/browser/child_process_launcher.cc (right): http://codereview.chromium.org/3443002/diff/45002/66006#newcode181 chrome/browser/child_process_launcher.cc:181: /* wait= */false, &handle); On 2010/09/16 19:40:29, Mark Mentovai ...
10 years, 3 months ago (2010-09-16 20:57:30 UTC) #10
Mark Mentovai
LGTM http://codereview.chromium.org/3443002/diff/51003/18019 File chrome/browser/mach_broker_mac.cc (right): http://codereview.chromium.org/3443002/diff/51003/18019#newcode25 chrome/browser/mach_broker_mac.cc:25: } // end namespace } // namespace http://codereview.chromium.org/3443002/diff/51003/18020 ...
10 years, 3 months ago (2010-09-16 21:57:35 UTC) #11
Mark Mentovai
10 years, 3 months ago (2010-09-16 21:57:57 UTC) #12
unsubscribe

Powered by Google App Engine
This is Rietveld 408576698