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

Issue 609593004: Add an explicit bool conversion to scoped_refptr<T>. (Closed)

Created:
6 years, 2 months ago by dcheng
Modified:
6 years, 2 months ago
Reviewers:
jamesr, Nico, awong
CC:
chromium-reviews, danakj, erikwright+watch_chromium.org, gavinp+memory_chromium.org, piman, Ryan Sleevi, viettrungluu
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Add an explicit bool conversion to scoped_refptr<T>. This wasn't feasible with the Testable trick, because that resulted in an ambiguous overload. Enabling this explicit conversion now will result in a lot less churn when converting Android, iOS, and Windows. BUG=110610

Patch Set 1 #

Patch Set 2 : Constify #

Patch Set 3 : Fix WMI? #

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

Messages

Total messages: 5 (1 generated)
dcheng
Assuming this actually passes the trybots and really is an unambiguous conversion... I know explicit ...
6 years, 2 months ago (2014-09-26 00:09:03 UTC) #2
jamesr
e:\b\build\slave\win\build\src\chrome\installer\util\wmi.cc(72) :error C2666: 'operator ==' : 2 overloads have similar conversions e:\b\depot_tools\win_toolchain\vs2013_files\win8sdk\include\shared\guiddef.h(192): could be 'bool ...
6 years, 2 months ago (2014-09-26 05:36:43 UTC) #3
jamesr
Ah, ScopedComPtr inherits from scoped_refptr. Maybe there's a way to patch up that subclass specifically?
6 years, 2 months ago (2014-09-26 05:37:27 UTC) #4
dcheng
6 years, 2 months ago (2014-09-26 07:21:32 UTC) #5
The good news is the ambiguous comparison overloads for scoped_refptr are all
comparisons to NULL (as far as I can tell).

The bad news is I think this means the explicit conversion operator might be
busted for the Windows toolchain?!
http://stackoverflow.com/questions/24311437/msvc-2013-explicit-operator-bool and
http://stackoverflow.com/questions/20498142/visual-studio-2013-explicit-keywo...
support this theory.

Powered by Google App Engine
This is Rietveld 408576698