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

Issue 2555483002: Add POSIX shared memory support for Mac (Closed)

Created:
4 years ago by lawrencewu
Modified:
3 years, 7 months ago
CC:
chromium-reviews, qsr+mojo_chromium.org, vmpstr+watch_chromium.org, viettrungluu+watch_chromium.org, jam, gavinp+memory_chromium.org, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin-cc_chromium.org, mac-reviews_chromium.org, darin (slow to review)
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add POSIX shared memory support for Mac This re-adds POSIX shared memory support on Mac. This is for use in the sharing of field trials using shared memory. You can see the design doc for this project at: https://docs.google.com/document/d/1mTjD99PchmCGYtLvpxaXFObVnid1zmXIsWBI7GjuJgo/ and the motivation for this change under "Port to other platforms". NOTE: turning on NOPRESUBMIT because this re-adds some banned calls to AllowIO. BUG=671228 NOPRESUBMIT=true Committed: https://crrev.com/2fc6cf8d316d1f452dd27dbd0d886aef15b69659 Cr-Commit-Position: refs/heads/master@{#437709}

Patch Set 1 #

Patch Set 2 : Remove unsupported check. #

Patch Set 3 : Fix SharedMemoryCreateOptions and make default mach. #

Patch Set 4 : Use std::unique_ptr instead of scoped_ptr #

Patch Set 5 : Fix compile error on NaCl. #

Patch Set 6 : Check that we never pass POSIX shm over Mojo. #

Total comments: 8

Patch Set 7 : Remove unnecessary functionality. #

Patch Set 8 : Remove ifdef change in nacl_ipc_adapter.cc #

Patch Set 9 : Fully remove IPC POSIX checks. #

Total comments: 6

Patch Set 10 : Remove GetType(). #

Total comments: 13

Patch Set 11 : Remove some more public functions. #

Patch Set 12 : Create shared_memory_helper.h and move functions. #

Patch Set 13 : Fix posix includes. #

Patch Set 14 : Fix some compile issues. #

Patch Set 15 : Remove ScopedTracker and fix includes. #

Patch Set 16 : Fix ifdef. #

Patch Set 17 : Fix compile issues and remove more ScopedTrackers #

Patch Set 18 : Readd Android ifdef. #

Total comments: 8

Patch Set 19 : Fix base_unittests. #

Patch Set 20 : Ignore shared_memory_helper on Windows. #

Total comments: 22

Patch Set 21 : erikchen@ comments. #

Total comments: 2

Patch Set 22 : Address erikchen@ nits #

Total comments: 11

Patch Set 23 : Address @asvitkine nits #

Total comments: 29

Patch Set 24 : Address mark@ comments. #

Patch Set 25 : Restructure CreateAnonymousSharedMemory #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+445 lines, -194 lines) Patch
M base/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +6 lines, -0 lines 0 comments Download
M base/memory/shared_memory.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 5 chunks +16 lines, -4 lines 0 comments Download
M base/memory/shared_memory_handle.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 5 chunks +44 lines, -14 lines 0 comments Download
M base/memory/shared_memory_handle_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 7 chunks +87 lines, -26 lines 0 comments Download
A base/memory/shared_memory_helper.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +33 lines, -0 lines 0 comments Download
A base/memory/shared_memory_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +98 lines, -0 lines 2 comments Download
M base/memory/shared_memory_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 8 chunks +137 lines, -28 lines 0 comments Download
M base/memory/shared_memory_posix.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 6 chunks +6 lines, -117 lines 0 comments Download
M base/memory/shared_memory_unittest.cc View 8 chunks +18 lines, -5 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 140 (97 generated)
lawrencewu
4 years ago (2016-12-06 18:15:48 UTC) #23
erikchen
On 2016/12/06 18:15:48, lawrencewu wrote: I'm sorry, but I don't think we should land your ...
4 years ago (2016-12-06 18:23:15 UTC) #27
erikchen
Overall comments: Please only add the functionality that you need. - You don't need IPC ...
4 years ago (2016-12-06 19:00:41 UTC) #28
lawrencewu
I removed the IPC code, and made GetType() private, since while we don't need GetType() ...
4 years ago (2016-12-06 21:04:41 UTC) #33
lawrencewu
On 2016/12/06 21:04:41, lawrencewu wrote: > I removed the IPC code, and made GetType() private, ...
4 years ago (2016-12-06 21:10:19 UTC) #34
erikchen
On 2016/12/06 21:10:19, lawrencewu wrote: > On 2016/12/06 21:04:41, lawrencewu wrote: > > I removed ...
4 years ago (2016-12-06 21:14:29 UTC) #37
erikchen
much better. https://codereview.chromium.org/2555483002/diff/160001/base/memory/shared_memory_handle.h File base/memory/shared_memory_handle.h (right): https://codereview.chromium.org/2555483002/diff/160001/base/memory/shared_memory_handle.h#newcode140 base/memory/shared_memory_handle.h:140: void SetFileHandle(int fd, bool auto_close); Is this ...
4 years ago (2016-12-06 21:14:50 UTC) #38
Robert Sesek
https://codereview.chromium.org/2555483002/diff/180001/base/memory/shared_memory_handle.h File base/memory/shared_memory_handle.h (right): https://codereview.chromium.org/2555483002/diff/180001/base/memory/shared_memory_handle.h#newcode88 base/memory/shared_memory_handle.h:88: // The values of these enums must not change, ...
4 years ago (2016-12-06 21:45:55 UTC) #41
lawrencewu
Address comments and create shared_memory_helper.{cc, h} in base/memory/. I still have to move SharedMemory::ShareToProcessCommon() there ...
4 years ago (2016-12-06 22:33:24 UTC) #44
erikchen
> https://codereview.chromium.org/2555483002/diff/180001/base/memory/shared_memory_mac.cc#newcode87 > base/memory/shared_memory_mac.cc:87: tracked_objects::ScopedTracker > tracking_profile( > On 2016/12/06 21:45:55, Robert Sesek wrote: > ...
4 years ago (2016-12-06 23:08:32 UTC) #51
Robert Sesek
https://codereview.chromium.org/2555483002/diff/340001/base/memory/shared_memory_handle_mac.cc File base/memory/shared_memory_handle_mac.cc (right): https://codereview.chromium.org/2555483002/diff/340001/base/memory/shared_memory_handle_mac.cc#newcode70 base/memory/shared_memory_handle_mac.cc:70: SharedMemoryHandle SharedMemoryHandle::Duplicate() const { Does this need an implementation ...
4 years ago (2016-12-07 16:39:42 UTC) #66
lawrencewu
On 2016/12/06 23:08:32, erikchen wrote: > > > https://codereview.chromium.org/2555483002/diff/180001/base/memory/shared_memory_mac.cc#newcode87 > > base/memory/shared_memory_mac.cc:87: tracked_objects::ScopedTracker > > ...
4 years ago (2016-12-07 19:41:06 UTC) #71
lawrencewu
Address comments and fix failing unittests. mark@, thakis@: I'm trying to land this CL before ...
4 years ago (2016-12-07 19:44:26 UTC) #73
Mark Mentovai
We just got rid of this. What, exactly, do you need to resurrect it for? ...
4 years ago (2016-12-07 19:56:05 UTC) #74
lawrencewu
On 2016/12/07 19:56:05, Mark Mentovai wrote: > We just got rid of this. What, exactly, ...
4 years ago (2016-12-07 20:04:44 UTC) #77
lawrencewu
On 2016/12/07 20:04:44, lawrencewu wrote: > On 2016/12/07 19:56:05, Mark Mentovai wrote: > > We ...
4 years ago (2016-12-08 20:29:36 UTC) #78
Mark Mentovai
Is the dependent code in good shape that’s ready to land?
4 years ago (2016-12-08 20:58:07 UTC) #79
lawrencewu
On 2016/12/08 20:58:07, Mark Mentovai wrote: > Is the dependent code in good shape that’s ...
4 years ago (2016-12-08 20:58:54 UTC) #80
Mark Mentovai
OK. Erik, do you want to take another look?
4 years ago (2016-12-08 21:02:50 UTC) #81
erikchen
Please update your CL title/description. As noted earlier, this CL review is commencing in parallel ...
4 years ago (2016-12-08 21:33:34 UTC) #86
Mark Mentovai
I don’t think that it’s the worst thing to hold this until the design review ...
4 years ago (2016-12-08 21:35:44 UTC) #87
Alexei Svitkine (slow)
I don't think there are any pending concerns on the design review. Justin looked at ...
4 years ago (2016-12-08 22:13:01 UTC) #88
lawrencewu
Address comments. https://codereview.chromium.org/2555483002/diff/380001/base/memory/shared_memory.h File base/memory/shared_memory.h (right): https://codereview.chromium.org/2555483002/diff/380001/base/memory/shared_memory.h#newcode260 base/memory/shared_memory.h:260: #if !(defined(OS_MACOSX) && !defined(OS_IOS)) On 2016/12/08 21:33:33, ...
4 years ago (2016-12-08 23:06:30 UTC) #91
erikchen
Okay. This CL looks fine. The shm_open changes do not have to be a part ...
4 years ago (2016-12-09 00:30:38 UTC) #94
erikchen
Oh, please update your CL description/title. This CL is not just a revert - it ...
4 years ago (2016-12-09 00:31:13 UTC) #95
lawrencewu
On 2016/12/09 00:31:13, erikchen wrote: > Oh, please update your CL description/title. This CL is ...
4 years ago (2016-12-09 14:48:44 UTC) #98
lawrencewu
Address nits. https://codereview.chromium.org/2555483002/diff/380001/base/memory/shared_memory_helper.cc File base/memory/shared_memory_helper.cc (right): https://codereview.chromium.org/2555483002/diff/380001/base/memory/shared_memory_helper.cc#newcode21 base/memory/shared_memory_helper.cc:21: // A: Because they're limited to 4mb ...
4 years ago (2016-12-09 15:21:39 UTC) #101
Alexei Svitkine (slow)
lgtm % comments Please add a blank line in your CL description after the first ...
4 years ago (2016-12-09 18:04:16 UTC) #104
lawrencewu
Address nits. https://codereview.chromium.org/2555483002/diff/420001/base/memory/shared_memory_handle_mac.cc File base/memory/shared_memory_handle_mac.cc (right): https://codereview.chromium.org/2555483002/diff/420001/base/memory/shared_memory_handle_mac.cc#newcode77 base/memory/shared_memory_handle_mac.cc:77: On 2016/12/09 18:04:15, Alexei Svitkine (slow) wrote: ...
4 years ago (2016-12-09 18:33:57 UTC) #107
lawrencewu
mark@: Mind taking a look?
4 years ago (2016-12-09 19:14:38 UTC) #112
Mark Mentovai
https://codereview.chromium.org/2555483002/diff/440001/base/BUILD.gn File base/BUILD.gn (right): https://codereview.chromium.org/2555483002/diff/440001/base/BUILD.gn#newcode1 base/BUILD.gn:1: # Copyright (c) 2013 The Chromium Authors. All rights ...
4 years ago (2016-12-09 19:53:53 UTC) #113
lawrencewu
Address mark@ comments. https://codereview.chromium.org/2555483002/diff/440001/base/BUILD.gn File base/BUILD.gn (right): https://codereview.chromium.org/2555483002/diff/440001/base/BUILD.gn#newcode1 base/BUILD.gn:1: # Copyright (c) 2013 The Chromium ...
4 years ago (2016-12-09 20:32:13 UTC) #119
Mark Mentovai
https://codereview.chromium.org/2555483002/diff/440001/base/memory/shared_memory_helper.cc File base/memory/shared_memory_helper.cc (right): https://codereview.chromium.org/2555483002/diff/440001/base/memory/shared_memory_helper.cc#newcode36 base/memory/shared_memory_helper.cc:36: readonly_fd->reset(HANDLE_EINTR(open(path->value().c_str(), O_RDONLY))); lawrencewu wrote: > On 2016/12/09 19:53:52, Mark ...
4 years ago (2016-12-09 20:54:14 UTC) #121
lawrencewu
https://codereview.chromium.org/2555483002/diff/440001/base/memory/shared_memory_helper.cc File base/memory/shared_memory_helper.cc (right): https://codereview.chromium.org/2555483002/diff/440001/base/memory/shared_memory_helper.cc#newcode36 base/memory/shared_memory_helper.cc:36: readonly_fd->reset(HANDLE_EINTR(open(path->value().c_str(), O_RDONLY))); On 2016/12/09 20:54:13, Mark Mentovai wrote: > ...
4 years ago (2016-12-09 21:14:31 UTC) #122
lawrencewu
On 2016/12/09 21:14:31, lawrencewu wrote: > https://codereview.chromium.org/2555483002/diff/440001/base/memory/shared_memory_helper.cc > File base/memory/shared_memory_helper.cc (right): > > https://codereview.chromium.org/2555483002/diff/440001/base/memory/shared_memory_helper.cc#newcode36 > ...
4 years ago (2016-12-09 21:16:55 UTC) #125
Mark Mentovai
https://codereview.chromium.org/2555483002/diff/440001/base/memory/shared_memory_helper.cc File base/memory/shared_memory_helper.cc (right): https://codereview.chromium.org/2555483002/diff/440001/base/memory/shared_memory_helper.cc#newcode34 base/memory/shared_memory_helper.cc:34: if (*fp && options.share_read_only) { OK, I see. A ...
4 years ago (2016-12-09 21:21:30 UTC) #126
lawrencewu
Address mark@ comments. https://codereview.chromium.org/2555483002/diff/440001/base/memory/shared_memory_helper.cc File base/memory/shared_memory_helper.cc (right): https://codereview.chromium.org/2555483002/diff/440001/base/memory/shared_memory_helper.cc#newcode34 base/memory/shared_memory_helper.cc:34: if (*fp && options.share_read_only) { On ...
4 years ago (2016-12-09 22:08:22 UTC) #127
Mark Mentovai
LGTM
4 years ago (2016-12-09 22:11:55 UTC) #128
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2555483002/480001
4 years ago (2016-12-09 22:14:34 UTC) #132
commit-bot: I haz the power
Committed patchset #25 (id:480001)
4 years ago (2016-12-10 01:28:13 UTC) #135
commit-bot: I haz the power
Patchset 25 (id:??) landed as https://crrev.com/2fc6cf8d316d1f452dd27dbd0d886aef15b69659 Cr-Commit-Position: refs/heads/master@{#437709}
4 years ago (2016-12-12 14:59:10 UTC) #137
Nico
https://codereview.chromium.org/2555483002/diff/480001/base/memory/shared_memory_helper.cc File base/memory/shared_memory_helper.cc (right): https://codereview.chromium.org/2555483002/diff/480001/base/memory/shared_memory_helper.cc#newcode75 base/memory/shared_memory_helper.cc:75: struct stat st = {}; This file is posix-only; ...
3 years, 7 months ago (2017-05-12 15:11:52 UTC) #139
Alexei Svitkine (slow)
3 years, 7 months ago (2017-05-12 15:22:15 UTC) #140
Message was sent while issue was closed.
https://codereview.chromium.org/2555483002/diff/480001/base/memory/shared_mem...
File base/memory/shared_memory_helper.cc (right):

https://codereview.chromium.org/2555483002/diff/480001/base/memory/shared_mem...
base/memory/shared_memory_helper.cc:75: struct stat st = {};
On 2017/05/12 15:11:52, Nico wrote:
> This file is posix-only; why was it not named shared_memory_helper_posix.cc?
> (I'm currently unbreaking gn bootstrap on Win, and one of the reasons it's
> broken is because this file isn't in the posix-block in
> tools/gn/bootstrap/bootstrap.py but in the common block, probably because of
its
> name)

Renaming SGTM. (Lawrence was an intern so someone else would have to make this
change.)

Powered by Google App Engine
This is Rietveld 408576698