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

Issue 10796020: Upgrade AlignedMemory to support dynamic allocations. (Closed)

Created:
8 years, 5 months ago by DaleCurtis
Modified:
8 years, 5 months ago
CC:
chromium-reviews, scherkus (not reviewing), jvoung (off chromium), dmichael (off chromium)
Visibility:
Public.

Description

Upgrade AlignedMemory to support dynamic allocations. Adds two new methods: AlignedAlloc and AlignedFree for creating and destroying dynamic aligned allocations respectively. Also adds a helper class, ScopedPtrAlignedFree, for use with scoped_ptr_malloc. AlignedAlloc uses posix_memalign for OS X (now that we're targeting 10.6), Linux and _aligned_alloc() on Windows. Android and NaCl use memalign() since they do not expose posix_memalign() and memalign() is safe to use with free() on those platforms. Also hacks around a bug in Visual C++ where __alignof will sometimes return zero: http://connect.microsoft.com/VisualStudio/feedback/details/682695/c-alignof-fails-to-properly-evalute-alignment-of-dependent-types BUG=none TEST=base_unittests + new test, trybots. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=147988 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=148483

Patch Set 1 : Documentation. #

Total comments: 18

Patch Set 2 : Comments. Remove unused imports. #

Total comments: 30

Patch Set 3 : Remove templates. #

Total comments: 16

Patch Set 4 : Comments. #

Patch Set 5 : Fix headers. #

Total comments: 14

Patch Set 6 : More comments! #

Total comments: 6

Patch Set 7 : Final Fixes! #

Total comments: 1

Patch Set 8 : Use shortened URL to keep CQ happy. #

Patch Set 9 : Change AlignedMemory back to POD. Retry now that NaCl fixed. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+130 lines, -8 lines) Patch
M base/base.gypi View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M base/compiler_specific.h View 1 7 1 chunk +4 lines, -2 lines 0 comments Download
M base/memory/aligned_memory.h View 1 2 3 4 5 6 7 8 3 chunks +44 lines, -6 lines 0 comments Download
A base/memory/aligned_memory.cc View 1 2 3 4 5 6 1 chunk +47 lines, -0 lines 0 comments Download
M base/memory/aligned_memory_unittest.cc View 1 2 3 4 5 1 chunk +29 lines, -0 lines 0 comments Download
M chrome/browser/history/android/android_urls_sql_handler.cc View 1 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/ui/find_bar/find_bar_controller.cc View 1 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/extensions/permissions/permissions_info.cc View 1 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 39 (0 generated)
DaleCurtis
jbates: PTAL. This is different than what we discussed because overriding the new/delete operators in ...
8 years, 5 months ago (2012-07-19 02:12:26 UTC) #1
jbates
LGTM considering the challenges and constraints. I like that this also works as a member ...
8 years, 5 months ago (2012-07-19 03:45:37 UTC) #2
scherkus (not reviewing)
drive-by fyi but otherwise looking fine! https://chromiumcodereview.appspot.com/10796020/diff/28002/base/compiler_specific.h File base/compiler_specific.h (right): https://chromiumcodereview.appspot.com/10796020/diff/28002/base/compiler_specific.h#newcode119 base/compiler_specific.h:119: // http://goo.gl/isH0C FYI ...
8 years, 5 months ago (2012-07-19 21:49:39 UTC) #3
DaleCurtis
+willchan: You reviewed the original AlignedMemory CL please OWNERS review base/ changes here. +sky: Please ...
8 years, 5 months ago (2012-07-20 02:38:56 UTC) #4
willchan no longer on Chromium
+jyasskin, can you do a first pass here for me? Thanks.
8 years, 5 months ago (2012-07-20 07:25:56 UTC) #5
sky
LGTM
8 years, 5 months ago (2012-07-20 16:16:18 UTC) #6
Jeffrey Yasskin
https://chromiumcodereview.appspot.com/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): https://chromiumcodereview.appspot.com/10796020/diff/5018/base/memory/aligned_memory.h#newcode35 base/memory/aligned_memory.h:35: #define _XOPEN_SOURCE 600 // for posix_memalign If _XOPEN_SOURCE was ...
8 years, 5 months ago (2012-07-20 16:41:42 UTC) #7
DaleCurtis
http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h#newcode35 base/memory/aligned_memory.h:35: #define _XOPEN_SOURCE 600 // for posix_memalign On 2012/07/20 16:41:42, ...
8 years, 5 months ago (2012-07-20 18:25:28 UTC) #8
DaleCurtis
http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h#newcode55 base/memory/aligned_memory.h:55: ptr = memalign(align, size) On 2012/07/20 18:25:28, DaleCurtis wrote: ...
8 years, 5 months ago (2012-07-20 20:33:36 UTC) #9
Jeffrey Yasskin
http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h#newcode35 base/memory/aligned_memory.h:35: #define _XOPEN_SOURCE 600 // for posix_memalign On 2012/07/20 18:25:28, ...
8 years, 5 months ago (2012-07-20 23:36:56 UTC) #10
DaleCurtis
+jvoung: Re, http://code.google.com/p/nativeclient/issues/detail?id=2505 we seem to be hitting that issue here. Is adding the extern ...
8 years, 5 months ago (2012-07-21 03:04:39 UTC) #11
jvoung (off chromium)
https://chromiumcodereview.appspot.com/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): https://chromiumcodereview.appspot.com/10796020/diff/5018/base/memory/aligned_memory.h#newcode58 base/memory/aligned_memory.h:58: // Buildbots can find the posix_memalign definition. Everything builds ...
8 years, 5 months ago (2012-07-21 04:45:26 UTC) #12
DaleCurtis
http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h#newcode58 base/memory/aligned_memory.h:58: // Buildbots can find the posix_memalign definition. Everything builds ...
8 years, 5 months ago (2012-07-21 18:30:32 UTC) #13
Jeffrey Yasskin
https://chromiumcodereview.appspot.com/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): https://chromiumcodereview.appspot.com/10796020/diff/5018/base/memory/aligned_memory.h#newcode58 base/memory/aligned_memory.h:58: // Buildbots can find the posix_memalign definition. Everything builds ...
8 years, 5 months ago (2012-07-21 20:38:48 UTC) #14
DaleCurtis
http://codereview.chromium.org/10796020/diff/34002/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): http://codereview.chromium.org/10796020/diff/34002/base/memory/aligned_memory.h#newcode50 base/memory/aligned_memory.h:50: template <size_t Size, size_t ByteAlignment> On 2012/07/21 20:38:49, Jeffrey ...
8 years, 5 months ago (2012-07-21 22:18:41 UTC) #15
Jeffrey Yasskin
http://codereview.chromium.org/10796020/diff/34002/base/memory/aligned_memory.cc File base/memory/aligned_memory.cc (right): http://codereview.chromium.org/10796020/diff/34002/base/memory/aligned_memory.cc#newcode19 base/memory/aligned_memory.cc:19: DCHECK_GT(size, static_cast<size_t>(0)); FWIW, "0U" usually works instead of static_cast<size_t>, ...
8 years, 5 months ago (2012-07-21 22:42:06 UTC) #16
DaleCurtis
http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h#newcode58 base/memory/aligned_memory.h:58: // Buildbots can find the posix_memalign definition. Everything builds ...
8 years, 5 months ago (2012-07-22 00:45:40 UTC) #17
DaleCurtis
http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h#newcode58 base/memory/aligned_memory.h:58: // Buildbots can find the posix_memalign definition. Everything builds ...
8 years, 5 months ago (2012-07-22 01:16:13 UTC) #18
jvoung (off chromium)
http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h#newcode58 base/memory/aligned_memory.h:58: // Buildbots can find the posix_memalign definition. Everything builds ...
8 years, 5 months ago (2012-07-23 17:06:36 UTC) #19
dmichael (off chromium)
http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h#newcode58 base/memory/aligned_memory.h:58: // Buildbots can find the posix_memalign definition. Everything builds ...
8 years, 5 months ago (2012-07-23 17:19:28 UTC) #20
jvoung - send to chromium...
http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h File base/memory/aligned_memory.h (right): http://codereview.chromium.org/10796020/diff/5018/base/memory/aligned_memory.h#newcode58 base/memory/aligned_memory.h:58: // Buildbots can find the posix_memalign definition. Everything builds ...
8 years, 5 months ago (2012-07-23 17:25:23 UTC) #21
Jeffrey Yasskin
LGTM aside from the reinterpret_cast<T*>s and hopefully the bug filing. Thanks for bearing with me! ...
8 years, 5 months ago (2012-07-23 18:34:40 UTC) #22
willchan no longer on Chromium
Where's the hack around the MSVC __alignof() issue referenced in the description? Is that still ...
8 years, 5 months ago (2012-07-23 18:48:44 UTC) #23
DaleCurtis
http://codereview.chromium.org/10796020/diff/7037/base/memory/aligned_memory.cc File base/memory/aligned_memory.cc (right): http://codereview.chromium.org/10796020/diff/7037/base/memory/aligned_memory.cc#newcode7 base/memory/aligned_memory.cc:7: #if defined(OS_ANDROID) || defined(OS_NACL) On 2012/07/23 18:48:45, willchan wrote: ...
8 years, 5 months ago (2012-07-23 19:04:26 UTC) #24
willchan no longer on Chromium
http://codereview.chromium.org/10796020/diff/7037/base/memory/aligned_memory.cc File base/memory/aligned_memory.cc (right): http://codereview.chromium.org/10796020/diff/7037/base/memory/aligned_memory.cc#newcode24 base/memory/aligned_memory.cc:24: // memalign() on both platforms returns pointers which can ...
8 years, 5 months ago (2012-07-23 19:15:44 UTC) #25
DaleCurtis
http://codereview.chromium.org/10796020/diff/7037/base/memory/aligned_memory.cc File base/memory/aligned_memory.cc (right): http://codereview.chromium.org/10796020/diff/7037/base/memory/aligned_memory.cc#newcode24 base/memory/aligned_memory.cc:24: // memalign() on both platforms returns pointers which can ...
8 years, 5 months ago (2012-07-23 19:32:21 UTC) #26
willchan no longer on Chromium
LGTM, thanks for the change. Thanks Jeffrey for doing the primary review. http://codereview.chromium.org/10796020/diff/10043/base/compiler_specific.h File base/compiler_specific.h ...
8 years, 5 months ago (2012-07-23 20:37:17 UTC) #27
DaleCurtis
Thanks for the reviews everyone. I've added links to the bugs for more documentation on ...
8 years, 5 months ago (2012-07-23 21:15:04 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/10796020/7040
8 years, 5 months ago (2012-07-23 21:17:49 UTC) #29
commit-bot: I haz the power
Presubmit check for 10796020-7040 failed and returned exit status 1. Running presubmit commit checks ...
8 years, 5 months ago (2012-07-23 21:17:53 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/10796020/11029
8 years, 5 months ago (2012-07-23 21:50:07 UTC) #31
commit-bot: I haz the power
Change committed as 147988
8 years, 5 months ago (2012-07-23 23:26:55 UTC) #32
jbates
one comment on the final changes. might be worth a followup patch? https://chromiumcodereview.appspot.com/10796020/diff/7040/base/memory/aligned_memory.h File base/memory/aligned_memory.h ...
8 years, 5 months ago (2012-07-24 01:30:23 UTC) #33
DaleCurtis
On 2012/07/24 01:30:23, jbates wrote: > one comment on the final changes. might be worth ...
8 years, 5 months ago (2012-07-24 01:32:48 UTC) #34
M-A Ruel
On 2012/07/23 21:17:53, I haz the power (commit-bot) wrote: > Presubmit check for 10796020-7040 failed ...
8 years, 5 months ago (2012-07-24 10:15:37 UTC) #35
willchan no longer on Chromium
Thx for the explanation.
8 years, 5 months ago (2012-07-24 14:48:28 UTC) #36
DaleCurtis
Relanding now that https://src.chromium.org/viewvc/chrome?view=rev&revision=148373 is fixed. This version include the revert of AlignedMemory to a ...
8 years, 5 months ago (2012-07-26 00:25:55 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/10796020/36001
8 years, 5 months ago (2012-07-26 00:26:45 UTC) #38
commit-bot: I haz the power
8 years, 5 months ago (2012-07-26 02:22:45 UTC) #39
Change committed as 148483

Powered by Google App Engine
This is Rietveld 408576698