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

Issue 510323002: Disable scoped_refptr operator T* on Linux. (Closed)

Created:
6 years, 3 months ago by dcheng
Modified:
6 years, 3 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org, gavinp+memory_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Disable scoped_refptr operator T* on Linux builds. The implicit conversion operator is being removed, because of the surprises it can cause. For example, one might write: scoped_refptr<Foo> CreateFoo(); to ensure that callers hold the result in a scoped_refptr. But the implicit conversion to T* means that a caller can accidentally hold the result in a Foo* and the compiler won't catch it. Since there are a large number of dependencies on this implicit conversion, the cleanup is being conducted by a combination of automated tooling and manual cleanup. It is also being staged on a platform by platform basis. All known dependencies on the implicit conversion on Linux (but not ChromeOS) have been removed, so this patch disables the conversion operator on Linux builds to prevent new dependencies on the implicit conversion. Finally, to help facilitate this transition, temporary operator overloads for comparison have been added. These will eventually be removed. BUG=110610 R=jyasskin@chromium.org, rsleevi@chromium.org, willchan@chromium.org Committed: https://chromium.googlesource.com/chromium/src/+/664a17fefa8bc4b50763765281039afaf0db7b0d

Patch Set 1 #

Patch Set 2 : . #

Total comments: 17

Patch Set 3 : Remove bool coercion #

Patch Set 4 : Address comments #

Total comments: 6

Patch Set 5 : Address comments #

Patch Set 6 : Exclude OS_CHROMEOS #

Unified diffs Side-by-side diffs Delta from patch set Stats (+53 lines, -22 lines) Patch
M base/memory/ref_counted.h View 1 2 3 4 5 5 chunks +53 lines, -0 lines 0 comments Download
M base/memory/ref_counted_unittest.cc View 1 2 3 4 1 chunk +0 lines, -22 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
dcheng
dcheng@chromium.org changed reviewers: + jamesr@chromium.org, jyasskin@chromium.org, rsleevi@chromium.org, willchan@chromium.org
6 years, 3 months ago (2014-08-28 17:24:48 UTC) #1
dcheng
Sending this out for an initial request for comments. I think it'd make things simpler ...
6 years, 3 months ago (2014-08-28 17:24:48 UTC) #2
Ryan Sleevi
seems reasonable, albiet shared_ptr in C++11 land only allows comparisons between shared<U> and shared<T>, and ...
6 years, 3 months ago (2014-08-28 17:32:20 UTC) #3
dcheng
https://codereview.chromium.org/510323002/diff/20001/base/memory/ref_counted.h File base/memory/ref_counted.h (right): https://codereview.chromium.org/510323002/diff/20001/base/memory/ref_counted.h#newcode393 base/memory/ref_counted.h:393: } On 2014/08/28 17:32:20, Ryan Sleevi wrote: > For ...
6 years, 3 months ago (2014-08-28 17:37:15 UTC) #4
jamesr
https://codereview.chromium.org/510323002/diff/20001/base/memory/ref_counted.h File base/memory/ref_counted.h (right): https://codereview.chromium.org/510323002/diff/20001/base/memory/ref_counted.h#newcode344 base/memory/ref_counted.h:344: #if defined(DISABLE_SCOPED_REFPTR_CONVERSION_OPERATOR) c++11 have these operators defined for shared_ptr<> ...
6 years, 3 months ago (2014-08-28 18:19:43 UTC) #5
dcheng
https://codereview.chromium.org/510323002/diff/20001/base/memory/ref_counted.h File base/memory/ref_counted.h (right): https://codereview.chromium.org/510323002/diff/20001/base/memory/ref_counted.h#newcode344 base/memory/ref_counted.h:344: #if defined(DISABLE_SCOPED_REFPTR_CONVERSION_OPERATOR) On 2014/08/28 18:19:42, jamesr wrote: > c++11 ...
6 years, 3 months ago (2014-08-28 18:28:40 UTC) #6
Ryan Sleevi
With respect to "bloaty IO stream includes" - as evidenced, we've already got them in ...
6 years, 3 months ago (2014-08-28 18:42:51 UTC) #7
willchan no longer on Chromium
I'm planning on letting y'all argue this out and mostly rubberstamping the decision, unless somehow ...
6 years, 3 months ago (2014-08-28 18:53:56 UTC) #8
dcheng
Patchset #5 (id:80001) has been deleted
6 years, 3 months ago (2014-08-29 07:53:56 UTC) #9
dcheng
OK, so I ran a pass this morning to see how many instances failed without ...
6 years, 3 months ago (2014-09-04 21:15:01 UTC) #10
jamesr
I'm ok with that plan. https://codereview.chromium.org/510323002/diff/60001/base/memory/ref_counted_unittest.cc File base/memory/ref_counted_unittest.cc (right): https://codereview.chromium.org/510323002/diff/60001/base/memory/ref_counted_unittest.cc#newcode64 base/memory/ref_counted_unittest.cc:64: // Temporarily disabled while ...
6 years, 3 months ago (2014-09-04 21:28:02 UTC) #11
Ryan Sleevi
I'm OK with this approach. I'm gonna punt to jyasskin, as I'm not as smart ...
6 years, 3 months ago (2014-09-04 21:29:04 UTC) #12
dcheng
I'm honestly not sure about the OS_CHROMEOS vs OS_LINUX thing. I know I would be ...
6 years, 3 months ago (2014-09-04 21:36:18 UTC) #13
jamesr
On 2014/09/04 21:36:18, dcheng (OOO) wrote: > I'm honestly not sure about the OS_CHROMEOS vs ...
6 years, 3 months ago (2014-09-04 21:44:40 UTC) #14
Jeffrey Yasskin
lgtm, but I don't mean that to override any of the other reviewers.
6 years, 3 months ago (2014-09-04 22:01:39 UTC) #15
dcheng
OK, I've fixed this to exclude ChromeOS. Thanks for the pointers.
6 years, 3 months ago (2014-09-04 22:31:04 UTC) #16
Ryan Sleevi
In case it's not clear, I don't own base, but lgtm
6 years, 3 months ago (2014-09-04 22:35:07 UTC) #17
willchan no longer on Chromium
Can you update the CL description to explain why this is getting disabled only on ...
6 years, 3 months ago (2014-09-04 23:17:36 UTC) #18
dcheng
On 2014/09/04 at 23:17:36, willchan wrote: > Can you update the CL description to explain ...
6 years, 3 months ago (2014-09-04 23:27:32 UTC) #19
willchan no longer on Chromium
Perfect, thanks.
6 years, 3 months ago (2014-09-04 23:28:44 UTC) #20
dcheng
Committed patchset #6 (id:120001) manually as 664a17f (tree was closed).
6 years, 3 months ago (2014-09-05 07:23:38 UTC) #21
commit-bot: I haz the power
6 years, 3 months ago (2014-09-10 03:37:28 UTC) #22
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/664a17fefa8bc4b50763765281039afaf0db7b0d
Cr-Commit-Position: refs/heads/master@{#293459}

Powered by Google App Engine
This is Rietveld 408576698