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

Issue 1771303002: WTF: Fix Vector<T> memcpy'ing incorrectly for some T. (Closed)

Created:
4 years, 9 months ago by Yuta Kitamura
Modified:
4 years, 2 months ago
Reviewers:
*haraken, Nico, yzshen1, *tzik
CC:
chromium-reviews, blink-reviews, blink-reviews-wtf_chromium.org, Mikhail
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

WTF: Fix Vector<T> memcpy'ing incorrectly for some T. The core issue here is the implementation of IsTriviallyCopyAssignable and IsTriviallyMoveAssignable was incorrect. They both use a compiler builtin __has_trivial_assign(T), but it returns true if T's copy assignment operator is declared as deleted. To workaround that, a new type trait IsAssignable<T, From> is implemented in the same way as std::is_assignable (as it's not available at this time), and the assignability is used to limit the scope of IsTrivially{Copy,Move}Assignable. IsMoveAssignable isn't really right even with my patch for the reason stated in the comments in the patch. I think it's impossible to workaround that, though. A bunch of static_asserts are added to test some invariants related to this change. BUG=592767 Committed: https://crrev.com/d7225e41c5557ef72e5ca439fcf8287be37e7c0f Cr-Commit-Position: refs/heads/master@{#380329}

Patch Set 1 #

Total comments: 11

Patch Set 2 : Fix comments. #

Patch Set 3 : Blind SFINAE juggling for MSVC errors. #

Patch Set 4 : Try 2. #

Patch Set 5 : Final MSVC workaround. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+139 lines, -1 line) Patch
M third_party/WebKit/Source/wtf/TypeTraits.h View 1 2 3 4 1 chunk +53 lines, -1 line 1 comment Download
M third_party/WebKit/Source/wtf/TypeTraitsTest.cpp View 1 2 3 4 1 chunk +61 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/VectorTest.cpp View 1 chunk +25 lines, -0 lines 0 comments Download

Messages

Total messages: 31 (12 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1771303002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1771303002/1
4 years, 9 months ago (2016-03-08 11:11:21 UTC) #2
Yuta Kitamura
PTAL. In short: C++ is hard.
4 years, 9 months ago (2016-03-08 11:12:25 UTC) #5
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_chromium_compile_dbg_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_compile_dbg_ng/builds/156471)
4 years, 9 months ago (2016-03-08 11:40:27 UTC) #7
tzik
https://codereview.chromium.org/1771303002/diff/1/third_party/WebKit/Source/wtf/TypeTraits.h File third_party/WebKit/Source/wtf/TypeTraits.h (right): https://codereview.chromium.org/1771303002/diff/1/third_party/WebKit/Source/wtf/TypeTraits.h#newcode58 third_party/WebKit/Source/wtf/TypeTraits.h:58: template <typename T2, typename From2, typename = decltype(std::declval<T2>() = ...
4 years, 9 months ago (2016-03-08 11:52:49 UTC) #8
yzshen1
Thanks for working on this! https://codereview.chromium.org/1771303002/diff/1/third_party/WebKit/Source/wtf/TypeTraits.h File third_party/WebKit/Source/wtf/TypeTraits.h (right): https://codereview.chromium.org/1771303002/diff/1/third_party/WebKit/Source/wtf/TypeTraits.h#newcode84 third_party/WebKit/Source/wtf/TypeTraits.h:84: // TODO(yutak): This isn't ...
4 years, 9 months ago (2016-03-08 21:30:38 UTC) #9
Yuta Kitamura
https://codereview.chromium.org/1771303002/diff/1/third_party/WebKit/Source/wtf/TypeTraits.h File third_party/WebKit/Source/wtf/TypeTraits.h (right): https://codereview.chromium.org/1771303002/diff/1/third_party/WebKit/Source/wtf/TypeTraits.h#newcode58 third_party/WebKit/Source/wtf/TypeTraits.h:58: template <typename T2, typename From2, typename = decltype(std::declval<T2>() = ...
4 years, 9 months ago (2016-03-09 05:14:27 UTC) #10
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1771303002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1771303002/40001
4 years, 9 months ago (2016-03-09 05:32:53 UTC) #12
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1771303002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1771303002/60001
4 years, 9 months ago (2016-03-09 05:57:53 UTC) #14
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_chromium_compile_dbg_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_compile_dbg_ng/builds/157049)
4 years, 9 months ago (2016-03-09 06:44:01 UTC) #16
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1771303002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1771303002/80001
4 years, 9 months ago (2016-03-09 09:12:04 UTC) #18
Yuta Kitamura
I *think* I managed to workaround MSVC errors; PTAL again?
4 years, 9 months ago (2016-03-09 09:24:17 UTC) #19
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 9 months ago (2016-03-09 10:41:01 UTC) #21
tzik
lgtm
4 years, 9 months ago (2016-03-09 11:17:33 UTC) #22
haraken
owner LGTM (relying on tzik's LG).
4 years, 9 months ago (2016-03-09 11:40:39 UTC) #23
yzshen1
On 2016/03/09 11:40:39, haraken wrote: > owner LGTM (relying on tzik's LG). LGTM
4 years, 9 months ago (2016-03-09 17:15:37 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1771303002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1771303002/80001
4 years, 9 months ago (2016-03-10 03:59:07 UTC) #26
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 9 months ago (2016-03-10 04:05:10 UTC) #27
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/d7225e41c5557ef72e5ca439fcf8287be37e7c0f Cr-Commit-Position: refs/heads/master@{#380329}
4 years, 9 months ago (2016-03-10 04:09:30 UTC) #29
Nico
4 years, 2 months ago (2016-10-01 19:34:46 UTC) #31
Message was sent while issue was closed.
https://codereview.chromium.org/1771303002/diff/80001/third_party/WebKit/Sour...
File third_party/WebKit/Source/wtf/TypeTraits.h (right):

https://codereview.chromium.org/1771303002/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/wtf/TypeTraits.h:56: // To workaround that, here we
have IsAssignable<T, From> class template, but unfortunately, MSVC 2013 cannot
compile
is this still needed now that we're on 2015?

Powered by Google App Engine
This is Rietveld 408576698