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

Issue 2042223002: Introduce OnceClosure and BindOnce (Closed)

Created:
4 years, 6 months ago by tzik
Modified:
4 years, 3 months ago
CC:
chromium-reviews, danakj, Nico
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce OnceClosure and BindOnce This CL adds another flag, RepeatMode, to base::Callback to make a Callback variant that can be run only once, and exposes it as OnceCallback. This also adds a base:::Bind variant to create an OneOnce, and adds provides conversions and constraints between Callbacks. BUG=554299 Committed: https://crrev.com/27d1e313968955f1a120b65b31e316263365b1b3 Cr-Commit-Position: refs/heads/master@{#418177}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : fix #

Patch Set 4 : #

Patch Set 5 : fix death test #

Patch Set 6 : fix #

Patch Set 7 : y #

Patch Set 8 : rebase #

Total comments: 3

Patch Set 9 : +extract comment on callback.h into docs/callback.md #

Patch Set 10 : update #

Patch Set 11 : fix #

Patch Set 12 : move new variants into internal namespace #

Patch Set 13 : doc #

Patch Set 14 : rebase #

Patch Set 15 : rebase #

Total comments: 24

Patch Set 16 : update docs #

Total comments: 9

Patch Set 17 : attempt to clean up IsCallbackConvertible #

Patch Set 18 : +comment #

Patch Set 19 : rebase #

Patch Set 20 : rebase #

Patch Set 21 : update callback.md for Passed and movable types #

Total comments: 19

Patch Set 22 : s/OneShot/Once/g #

Patch Set 23 : s/EXPECT_{TRUE,FALSE}/static_assert/. +comments. simplify IsConvertibleCallbacks #

Total comments: 4

Patch Set 24 : split docs changes to a separate CL #

Patch Set 25 : rebase #

Patch Set 26 : fix indentation #

Patch Set 27 : split non-OnceCallback part to a separate CL #

Patch Set 28 : fix comment #

Patch Set 29 : rebase #

Total comments: 4

Patch Set 30 : swap Once & Repeating positions #

Unified diffs Side-by-side diffs Delta from patch set Stats (+267 lines, -32 lines) Patch
M base/bind.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 2 chunks +39 lines, -4 lines 0 comments Download
M base/bind_internal.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 2 chunks +16 lines, -2 lines 0 comments Download
M base/bind_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +90 lines, -0 lines 0 comments Download
M base/callback.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 2 chunks +85 lines, -23 lines 0 comments Download
M base/callback_forward.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +23 lines, -2 lines 0 comments Download
M base/callback_internal.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +3 lines, -0 lines 0 comments Download
M base/callback_internal.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +10 lines, -0 lines 0 comments Download
M base/callback_unittest.nc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 67 (45 generated)
tzik
PTAL
4 years, 5 months ago (2016-07-04 08:56:21 UTC) #4
hiroshige
https://codereview.chromium.org/2042223002/diff/140001/base/bind.h File base/bind.h (right): https://codereview.chromium.org/2042223002/diff/140001/base/bind.h#newcode29 base/bind.h:29: inline base::Callback<MakeUnboundRunType<Functor, Args...>> It might be unclear for developers ...
4 years, 5 months ago (2016-07-04 10:04:22 UTC) #5
tzik
https://codereview.chromium.org/2042223002/diff/140001/base/bind.h File base/bind.h (right): https://codereview.chromium.org/2042223002/diff/140001/base/bind.h#newcode29 base/bind.h:29: inline base::Callback<MakeUnboundRunType<Functor, Args...>> On 2016/07/04 10:04:22, hiroshige wrote: > ...
4 years, 5 months ago (2016-07-06 07:36:13 UTC) #6
hiroshige
https://codereview.chromium.org/2042223002/diff/140001/base/bind.h File base/bind.h (right): https://codereview.chromium.org/2042223002/diff/140001/base/bind.h#newcode29 base/bind.h:29: inline base::Callback<MakeUnboundRunType<Functor, Args...>> On 2016/07/06 07:36:13, tzik wrote: > ...
4 years, 4 months ago (2016-08-12 06:00:47 UTC) #11
tzik
On 2016/08/12 06:00:47, hiroshige wrote: > https://codereview.chromium.org/2042223002/diff/140001/base/bind.h > File base/bind.h (right): > > https://codereview.chromium.org/2042223002/diff/140001/base/bind.h#newcode29 > ...
4 years, 4 months ago (2016-08-15 14:12:03 UTC) #12
Yuta Kitamura
Just looked through the documentation. Generally it's pretty well written. I'll look into the code ...
4 years, 4 months ago (2016-08-16 03:02:56 UTC) #13
tzik
https://codereview.chromium.org/2042223002/diff/280001/docs/callback.md File docs/callback.md (right): https://codereview.chromium.org/2042223002/diff/280001/docs/callback.md#newcode27 docs/callback.md:27: clearer lifetime. Thus, it's recommented to use for a ...
4 years, 4 months ago (2016-08-16 06:53:37 UTC) #16
Yuta Kitamura
LGTM, didn't find anything bad in the change. More eyes would be necessary, though. https://codereview.chromium.org/2042223002/diff/300001/base/bind.h ...
4 years, 4 months ago (2016-08-16 07:44:13 UTC) #17
tzik
https://codereview.chromium.org/2042223002/diff/300001/base/bind.h File base/bind.h (right): https://codereview.chromium.org/2042223002/diff/300001/base/bind.h#newcode58 base/bind.h:58: // Unannotated Bind. On 2016/08/16 07:44:12, Yuta Kitamura wrote: ...
4 years, 4 months ago (2016-08-16 15:19:00 UTC) #23
Yuta Kitamura
(still LGTM++) https://codereview.chromium.org/2042223002/diff/300001/base/callback.h File base/callback.h (right): https://codereview.chromium.org/2042223002/diff/300001/base/callback.h#newcode82 base/callback.h:82: (static_cast<int>(repeat_mode) <= static_cast<int>(other_repeat_mode))>; On 2016/08/16 15:19:00, tzik ...
4 years, 4 months ago (2016-08-17 05:18:07 UTC) #27
tzik
https://codereview.chromium.org/2042223002/diff/300001/base/callback.h File base/callback.h (right): https://codereview.chromium.org/2042223002/diff/300001/base/callback.h#newcode82 base/callback.h:82: (static_cast<int>(repeat_mode) <= static_cast<int>(other_repeat_mode))>; On 2016/08/17 05:18:07, Yuta Kitamura wrote: ...
4 years, 4 months ago (2016-08-18 05:15:17 UTC) #28
vabr (Chromium)
LGTM (although I mostly just believed the template magic I saw :)). Cheers, Vaclav https://codereview.chromium.org/2042223002/diff/400001/docs/callback.md ...
4 years, 4 months ago (2016-08-24 11:44:06 UTC) #34
dcheng
Overall, looks reasonable. Just a few small thoughts to try to help me understand. Also, ...
4 years, 3 months ago (2016-08-26 07:37:57 UTC) #35
tzik
https://codereview.chromium.org/2042223002/diff/400001/base/bind_unittest.cc File base/bind_unittest.cc (right): https://codereview.chromium.org/2042223002/diff/400001/base/bind_unittest.cc#newcode1081 base/bind_unittest.cc:1081: EXPECT_TRUE((std::is_constructible< On 2016/08/26 07:37:56, dcheng wrote: > Maybe these ...
4 years, 3 months ago (2016-08-30 11:31:41 UTC) #37
dcheng
https://codereview.chromium.org/2042223002/diff/400001/base/callback_internal.cc File base/callback_internal.cc (right): https://codereview.chromium.org/2042223002/diff/400001/base/callback_internal.cc#newcode28 base/callback_internal.cc:28: : bind_state_(c.bind_state_), polymorphic_invoke_(c.polymorphic_invoke_) {} On 2016/08/26 07:37:57, dcheng wrote: ...
4 years, 3 months ago (2016-08-31 06:20:53 UTC) #42
tzik
https://codereview.chromium.org/2042223002/diff/400001/base/callback_internal.cc File base/callback_internal.cc (right): https://codereview.chromium.org/2042223002/diff/400001/base/callback_internal.cc#newcode28 base/callback_internal.cc:28: : bind_state_(c.bind_state_), polymorphic_invoke_(c.polymorphic_invoke_) {} On 2016/08/31 06:20:53, dcheng wrote: ...
4 years, 3 months ago (2016-08-31 08:14:10 UTC) #46
dcheng
LGTM https://codereview.chromium.org/2042223002/diff/560001/base/callback.h File base/callback.h (right): https://codereview.chromium.org/2042223002/diff/560001/base/callback.h#newcode24 base/callback.h:24: // RunMixin provides different variant of `Run()` function ...
4 years, 3 months ago (2016-09-08 04:09:01 UTC) #54
tzik
https://codereview.chromium.org/2042223002/diff/560001/base/callback.h File base/callback.h (right): https://codereview.chromium.org/2042223002/diff/560001/base/callback.h#newcode24 base/callback.h:24: // RunMixin provides different variant of `Run()` function to ...
4 years, 3 months ago (2016-09-12 11:00:34 UTC) #55
tzik
Let me update the documentation in docs/callback.md as a separate CL before moving new callbacks ...
4 years, 3 months ago (2016-09-12 11:02:13 UTC) #58
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2042223002/580001
4 years, 3 months ago (2016-09-13 05:25:32 UTC) #63
commit-bot: I haz the power
Committed patchset #30 (id:580001)
4 years, 3 months ago (2016-09-13 05:29:19 UTC) #65
commit-bot: I haz the power
4 years, 3 months ago (2016-09-13 05:31:03 UTC) #67
Message was sent while issue was closed.
Patchset 30 (id:??) landed as
https://crrev.com/27d1e313968955f1a120b65b31e316263365b1b3
Cr-Commit-Position: refs/heads/master@{#418177}

Powered by Google App Engine
This is Rietveld 408576698