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

Issue 354023003: Add move constructor and assignment operator to RefPtr class (Closed)

Created:
6 years, 6 months ago by Inactive
Modified:
6 years, 5 months ago
Reviewers:
tkent, Nico, Chris Evans, Mikhail
CC:
blink-reviews, blink-reviews-wtf_chromium.org, Mikhail, abarth-chromium
Project:
blink
Visibility:
Public.

Description

Add move constructor and assignment operator to RefPtr class Add move constructor and assignment operator to RefPtr class. As a result, we can now use the implicitly defined move constructor and assignment operator for Atomic String. Also, other classes with RefPtr data members like CString now get a better default move constructor and assignment operator. The release binary is ~21Kb smaller, there is no diff on the generated asm for CString and AtomicString. However, there is a small diff for WTFString.o: http://pastebin.com/RTzX23JV The generated assembly for "CString WTF::String::latin1() const" and "CString WTF::String::ascii() const" is slightly smaller, likely due to CString's improved move copy constructor as these methods return CStrings. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=177066

Patch Set 1 #

Total comments: 1

Patch Set 2 : Take Nico's feedback into consideration #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -11 lines) Patch
M Source/wtf/RefPtr.h View 2 chunks +13 lines, -0 lines 1 comment Download
M Source/wtf/text/AtomicString.h View 1 chunk +0 lines, -11 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
Inactive
https://codereview.chromium.org/354023003/diff/1/Source/wtf/text/AtomicString.h File Source/wtf/text/AtomicString.h (left): https://codereview.chromium.org/354023003/diff/1/Source/wtf/text/AtomicString.h#oldcode77 Source/wtf/text/AtomicString.h:77: AtomicString(const AtomicString& other) : m_string(other.m_string) { } Let me ...
6 years, 6 months ago (2014-06-26 15:08:28 UTC) #1
tkent
lgtm
6 years, 5 months ago (2014-06-26 23:20:17 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/354023003/1
6 years, 5 months ago (2014-06-26 23:21:01 UTC) #3
Nico
Sorry about forgetting to reply for this. We don't do C++11 yet. We shouldn't add ...
6 years, 5 months ago (2014-06-26 23:36:09 UTC) #4
Nico
The CQ bit was unchecked by thakis@chromium.org
6 years, 5 months ago (2014-06-26 23:36:11 UTC) #5
Inactive
On 2014/06/26 23:36:09, Nico (away) wrote: > Sorry about forgetting to reply for this. > ...
6 years, 5 months ago (2014-06-27 00:17:16 UTC) #6
Nico
On 2014/06/27 00:17:16, Chris Dumez wrote: > On 2014/06/26 23:36:09, Nico (away) wrote: > > ...
6 years, 5 months ago (2014-06-27 01:52:37 UTC) #7
Nico
On 2014/06/27 00:17:16, Chris Dumez wrote: > On 2014/06/26 23:36:09, Nico (away) wrote: > > ...
6 years, 5 months ago (2014-06-27 01:56:20 UTC) #8
Inactive
> > Also, you just enabled it by default for gcc 4.8 (and thus Android), ...
6 years, 5 months ago (2014-06-27 02:04:31 UTC) #9
Inactive
On 2014/06/27 02:04:31, Chris Dumez wrote: > > > Also, you just enabled it by ...
6 years, 5 months ago (2014-06-27 02:05:54 UTC) #10
Inactive
I updated the patch as per my counter-proposal. Please take another look.
6 years, 5 months ago (2014-06-27 03:21:31 UTC) #11
Nico
lgtm, thanks!
6 years, 5 months ago (2014-06-27 03:32:57 UTC) #12
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 5 months ago (2014-06-27 03:48:51 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/354023003/20001
6 years, 5 months ago (2014-06-27 03:51:25 UTC) #14
commit-bot: I haz the power
Change committed as 177066
6 years, 5 months ago (2014-06-27 04:54:13 UTC) #15
Mikhail
https://codereview.chromium.org/354023003/diff/20001/Source/wtf/RefPtr.h File Source/wtf/RefPtr.h (right): https://codereview.chromium.org/354023003/diff/20001/Source/wtf/RefPtr.h#newcode114 Source/wtf/RefPtr.h:114: swap(o); This does not look correct, look { RefPtr<A> ...
6 years, 5 months ago (2014-06-27 07:48:44 UTC) #16
Inactive
6 years, 5 months ago (2014-06-27 13:02:13 UTC) #17
Message was sent while issue was closed.
On 2014/06/27 07:48:44, mikhail.pozdnyakov wrote:
> https://codereview.chromium.org/354023003/diff/20001/Source/wtf/RefPtr.h
> File Source/wtf/RefPtr.h (right):
> 
>
https://codereview.chromium.org/354023003/diff/20001/Source/wtf/RefPtr.h#newc...
> Source/wtf/RefPtr.h:114: swap(o);
> This does not look correct, look
> {
> RefPtr<A> a = adoptRef(new A); // First object.
> RefPtr<A> b = adoptRef(new A); // Second object.
> a = std::move(b);
> // We anticipate that the first object has gone but it's not the case
> }
> 
> We need to have a temporary here.
> Pls have a look at https://codereview.chromium.org/14031031

Thanks Mikhail. This is indeed unexpected behavior. I will take a look at this
today.

Powered by Google App Engine
This is Rietveld 408576698