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

Issue 2616973002: Fix String16's move constructor (Closed)

Created:
3 years, 11 months ago by Devlin
Modified:
3 years, 11 months ago
CC:
devtools-reviews_chromium.org, v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Fix String16's move constructor String16 had a pseudo move constructor that took a const String16&&. The problem with this is that the point of moving objects is the ability to clobber the underlying data. If we look at this particular case, the move ctor tried to then std::move the underlying std::basic_string<>; this results in passing a const std::basic_string<>&& to the basic_string ctor. This resolves to the const std::basic_string<>& *copy* ctor. So in the end, we haven't moved anything. Fix this by taking a mutable rvalue reference that allows the moving to work as expected. BUG=None Review-Url: https://codereview.chromium.org/2616973002 Cr-Commit-Position: refs/heads/master@{#42147} Committed: https://chromium.googlesource.com/v8/v8/+/e6e968d0e693be75cf68c499a1388ec8c68ccb40

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M src/inspector/string-16.h View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 15 (9 generated)
Devlin
jochen@, mind taking a look? (for reference, I've also started a thread at https://groups.google.com/a/chromium.org/forum/#!topic/cxx/JbDBw98aeE4 to ...
3 years, 11 months ago (2017-01-05 17:53:08 UTC) #6
dgozman
Thanks for the fix! lgtm @clemensh - any objections?
3 years, 11 months ago (2017-01-07 00:05:03 UTC) #8
Clemens Hammacher
Lgtm, thanks!
3 years, 11 months ago (2017-01-07 08:43:31 UTC) #9
jochen (gone - plz use gerrit)
lgtm
3 years, 11 months ago (2017-01-09 08:36:39 UTC) #10
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/2616973002/1
3 years, 11 months ago (2017-01-09 15:50:17 UTC) #12
commit-bot: I haz the power
3 years, 11 months ago (2017-01-09 16:15:57 UTC) #15
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://chromium.googlesource.com/v8/v8/+/e6e968d0e693be75cf68c499a1388ec8c68...

Powered by Google App Engine
This is Rietveld 408576698