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

Issue 1909263002: Replace safe-bool idiom with explicit WeakPtr::operator bool() (Closed)

Created:
4 years, 8 months ago by Wez
Modified:
4 years, 6 months ago
CC:
blink-worker-reviews_chromium.org, cbentzel+watch_chromium.org, chromium-reviews, darin-cc_chromium.org, feature-media-reviews_chromium.org, gavinp+memory_chromium.org, gcasto+watchlist_chromium.org, horo+watch_chromium.org, jam, jsbell+serviceworker_chromium.org, kinuko+serviceworker, kinuko+watch, mcasas+watch+vc_chromium.org, michaeln, miu+watch_chromium.org, mkwst+moarreviews-renderer_chromium.org, mkwst+watchlist-passwords_chromium.org, mlamouri+watch-content_chromium.org, nhiroki, ortuno+watch_chromium.org, posciak+watch_chromium.org, scheib+watch_chromium.org, serviceworker-reviews, James Su, sync-reviews_chromium.org, tfarina, tzik, vabr+watchlistpasswordmanager_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Replace safe-bool idiom with explicit operator bool() in base::WeakPtr. Also fixes various call-sites which were using WeakPtr as a bool return-value, or comparing to NULL to test as a bool. BUG=605794 Committed: https://crrev.com/b9820d493c42b7e3a4aebcd7956b016232600a1d Cr-Commit-Position: refs/heads/master@{#401464}

Patch Set 1 #

Patch Set 2 : git cl format net #

Patch Set 3 : Use rabbit-in-the-snow for bool conversion #

Patch Set 4 : Rebase #

Total comments: 7

Patch Set 5 : Provide WeakPtr::is_valid() for clarity #

Patch Set 6 : Allow direct WeakPtr != nullptr checks #

Patch Set 7 : Add comments to operators #

Patch Set 8 : Move operators to top-level #

Patch Set 9 : Add unit-test for comparison operators #

Unified diffs Side-by-side diffs Delta from patch set Stats (+64 lines, -64 lines) Patch
M base/memory/weak_ptr.h View 1 2 3 4 5 6 7 2 chunks +20 lines, -28 lines 0 comments Download
M base/memory/weak_ptr_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +13 lines, -0 lines 0 comments Download
M chrome/browser/ui/sync/one_click_signin_sync_starter.cc View 1 2 3 4 5 6 7 8 7 chunks +7 lines, -7 lines 0 comments Download
M chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc View 1 2 3 4 5 6 7 8 7 chunks +8 lines, -8 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M content/browser/service_worker/service_worker_provider_host.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/media/pepper_to_video_track_adapter.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M device/bluetooth/bluetooth_adapter_factory.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M net/dns/host_resolver_impl.cc View 1 2 3 4 5 6 7 8 chunks +12 lines, -17 lines 0 comments Download

Messages

Total messages: 43 (14 generated)
Wez
Hey Nico, I tried switching WeakPtr to use explicit operator bool() - as you can ...
4 years, 8 months ago (2016-04-24 02:37:39 UTC) #2
miu
Drive-by comment (this CL triggered a watchlist e-mail to me). How about: bool IsFoo() { ...
4 years, 8 months ago (2016-04-25 21:02:21 UTC) #3
Nico
see discussion in https://codereview.chromium.org/1878253003/ for why not !!. for the change, i'd like to wait ...
4 years, 8 months ago (2016-04-25 21:36:55 UTC) #4
Wez
Thanks for the pointer to the CL, Nico. I've CC'd that bug & will hold-off ...
4 years, 8 months ago (2016-04-25 21:47:04 UTC) #5
miu
On 2016/04/25 21:36:55, Nico wrote: > see discussion in https://codereview.chromium.org/1878253003/ for why not !!. I'm ...
4 years, 8 months ago (2016-04-25 22:29:53 UTC) #6
Nico
You understand !! if you've seen it before. It doesn't look like a conversion unless ...
4 years, 8 months ago (2016-04-25 22:33:27 UTC) #7
miu
On 2016/04/25 22:33:27, Nico wrote: > You understand !! if you've seen it before. It ...
4 years, 8 months ago (2016-04-25 23:08:19 UTC) #8
Wez
On 2016/04/25 23:08:19, miu wrote: > On 2016/04/25 22:33:27, Nico wrote: > > You understand ...
4 years, 7 months ago (2016-04-27 16:17:53 UTC) #9
mmenke
On 2016/04/27 16:17:53, Wez wrote: > On 2016/04/25 23:08:19, miu wrote: > > On 2016/04/25 ...
4 years, 7 months ago (2016-04-27 16:28:22 UTC) #10
Wez
IIUC the bool{subject} syntax would have the same properties w/ respect to correctness vs static_cast ...
4 years, 7 months ago (2016-04-27 16:44:17 UTC) #11
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1909263002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1909263002/20001
4 years, 6 months ago (2016-05-27 02:20:21 UTC) #13
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-05-27 04:38:02 UTC) #15
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1909263002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1909263002/40001
4 years, 6 months ago (2016-05-28 01:32:33 UTC) #17
Wez
John, PTAL :)
4 years, 6 months ago (2016-05-28 01:33:02 UTC) #19
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-05-28 04:02:13 UTC) #21
Wez
jam -> thakis again :)
4 years, 6 months ago (2016-06-02 20:31:25 UTC) #23
Nico
https://bugs.chromium.org/p/chromium/issues/detail?id=607208 isn't resolved yet afaict
4 years, 6 months ago (2016-06-02 21:03:30 UTC) #24
Wez
crbug.com/607208 is, according to jbroman@'s investigation, due to some peculiarity in the inlining decisions under ...
4 years, 6 months ago (2016-06-02 21:19:34 UTC) #25
Nico
ok, lgtm with comments addressed based on jbroman's reply on the bug https://codereview.chromium.org/1909263002/diff/60001/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc File chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc ...
4 years, 6 months ago (2016-06-02 21:31:02 UTC) #26
Wez
https://codereview.chromium.org/1909263002/diff/60001/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc File chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc (right): https://codereview.chromium.org/1909263002/diff/60001/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc#newcode149 chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc:149: return !!popup_; On 2016/06/02 21:31:02, Nico wrote: > no ...
4 years, 6 months ago (2016-06-02 21:48:06 UTC) #27
Wez
PTAL I've added two patches, one which adds an is_valid() getter to allow expicit weak_ptr.is_valid(), ...
4 years, 6 months ago (2016-06-04 01:00:15 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1909263002/140001
4 years, 6 months ago (2016-06-22 00:37:29 UTC) #31
Wez
Adding OWNERS: +rsleevi: PTAL net/ +creis: PTAL content/ +rockot: PTAL device/
4 years, 6 months ago (2016-06-22 00:45:20 UTC) #34
Ryan Sleevi
//net LGTM
4 years, 6 months ago (2016-06-22 00:50:14 UTC) #35
Ken Rockot(use gerrit already)
lgtm
4 years, 6 months ago (2016-06-22 03:16:15 UTC) #36
Charlie Reis
content/ LGTM
4 years, 6 months ago (2016-06-22 18:53:48 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1909263002/160001
4 years, 6 months ago (2016-06-22 19:38:54 UTC) #40
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 6 months ago (2016-06-22 23:41:23 UTC) #41
commit-bot: I haz the power
4 years, 6 months ago (2016-06-22 23:43:39 UTC) #43
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/b9820d493c42b7e3a4aebcd7956b016232600a1d
Cr-Commit-Position: refs/heads/master@{#401464}

Powered by Google App Engine
This is Rietveld 408576698