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

Issue 23440024: OwnPtr, OwnArrayPtr: Use copy/move-and-swap for assignment operators

Created:
7 years, 3 months ago by Mikhail
Modified:
7 years, 3 months ago
Reviewers:
Nico
CC:
blink-reviews, loislo+blink_chromium.org, eae+blinkwatch, yurys+blink_chromium.org, abarth-chromium, dglazkov+blink, adamk+blink_chromium.org, jeez, Nico, tkent, Chris Evans, eseidel
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

OwnPtr, OwnArrayPtr: Use copy/move-and-swap for assignment operators Rationals: - decrease of repeated code - consistency with RefPtr

Patch Set 1 #

Patch Set 2 : Fixed the change in the *existing* C++11 code. #

Total comments: 1

Patch Set 3 : Do not modify code inside "#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)" #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -16 lines) Patch
M Source/wtf/OwnArrayPtr.h View 1 chunk +6 lines, -8 lines 0 comments Download
M Source/wtf/OwnPtr.h View 1 2 1 chunk +6 lines, -8 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Mikhail
Could you please have a look?
7 years, 3 months ago (2013-09-11 11:08:27 UTC) #1
cevans
On 2013/09/11 11:08:27, mikhail.pozdnyakov wrote: > Could you please have a look? Does this do ...
7 years, 3 months ago (2013-09-11 17:50:05 UTC) #2
Nico
https://codereview.chromium.org/23440024/diff/5001/Source/wtf/OwnPtr.h File Source/wtf/OwnPtr.h (right): https://codereview.chromium.org/23440024/diff/5001/Source/wtf/OwnPtr.h#newcode168 Source/wtf/OwnPtr.h:168: OwnPtr ptr = std::move(o); As mentioned several times, we ...
7 years, 3 months ago (2013-09-11 18:00:36 UTC) #3
Mikhail
On 2013/09/11 18:00:36, Nico wrote: > https://codereview.chromium.org/23440024/diff/5001/Source/wtf/OwnPtr.h > File Source/wtf/OwnPtr.h (right): > > https://codereview.chromium.org/23440024/diff/5001/Source/wtf/OwnPtr.h#newcode168 > ...
7 years, 3 months ago (2013-09-12 08:15:28 UTC) #4
Mikhail
7 years, 3 months ago (2013-09-12 15:07:27 UTC) #5
On 2013/09/11 17:50:05, cevans wrote:
> On 2013/09/11 11:08:27, mikhail.pozdnyakov wrote:
> > Could you please have a look?
> 
> Does this do anything to binary size? I find that gcc is most sensitive to
> binary size, but clang binary sizes are also useful as if they change, you
might
> have crossed some inlining threshold.

Good point, thank you for mentioning this! 
I had believed that compiler would optimize it out but the change indeed
slightly increases libwebkit.so size: from to 41804392 to 41804520 bytes (used
gcc 4.6).

I would still vote for consistence: either we use copy/move-and-swap for
assignment operators in all the WTF smart pointer classes (1), or we do not use
it at all and revert also r156871(https://codereview.chromium.org/23666004/)
(2).

To my mind variant #1 is preferable as it makes code more compact and readable
even though it affects binary size a bit.

What do you think?

Powered by Google App Engine
This is Rietveld 408576698