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

Issue 2090013004: Adds base::WrapFunction to wrap lambdas as base::Callbacks (Closed)

Created:
4 years, 6 months ago by Ken Rockot(use gerrit already)
Modified:
4 years, 5 months ago
Reviewers:
yzshen1, dcheng
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, chromium-reviews, darin (slow to review), qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, tzik, danakj
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Adds base::WrapFunction to wrap lambdas as base::Callbacks BUG=

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+75 lines, -27 lines) Patch
M base/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M base/base.gypi View 1 chunk +1 line, -0 lines 0 comments Download
A base/function_util.h View 1 chunk +67 lines, -0 lines 2 comments Download
M mojo/public/cpp/bindings/tests/sync_method_unittest.cc View 2 chunks +6 lines, -27 lines 0 comments Download

Messages

Total messages: 11 (4 generated)
Ken Rockot(use gerrit already)
So I don't really anticipate style or base OWNERS being OK with this. However, lambdas ...
4 years, 6 months ago (2016-06-22 22:58:12 UTC) #2
yzshen1
I like this because it really makes our tests much easier to read! If the ...
4 years, 6 months ago (2016-06-22 23:05:54 UTC) #3
Ken Rockot(use gerrit already)
Providing this as a test-only utility could be a decent compromise. https://codereview.chromium.org/2090013004/diff/1/base/function_util.h File base/function_util.h (right): ...
4 years, 6 months ago (2016-06-22 23:14:43 UTC) #4
dcheng
I think I'd be a lot more comfortable with this if we disabled this wholly ...
4 years, 6 months ago (2016-06-23 19:23:01 UTC) #6
Ken Rockot(use gerrit already)
On 2016/06/23 at 19:23:01, dcheng wrote: > I think I'd be a lot more comfortable ...
4 years, 6 months ago (2016-06-23 19:35:36 UTC) #9
dcheng
On 2016/06/23 19:35:36, Ken Rockot wrote: > On 2016/06/23 at 19:23:01, dcheng wrote: > > ...
4 years, 6 months ago (2016-06-23 19:37:57 UTC) #10
Ken Rockot(use gerrit already)
4 years, 6 months ago (2016-06-23 19:46:39 UTC) #11
On 2016/06/23 at 19:37:57, dcheng wrote:
> On 2016/06/23 19:35:36, Ken Rockot wrote:
> > On 2016/06/23 at 19:23:01, dcheng wrote:
> > > I think I'd be a lot more comfortable with this if we disabled this wholly
on
> > capturing lambdas. In theory, we wouldn't need a wrapping helper then, since
> > non-capturing lambdas can be converted to function pointers, right?
> > 
> > Unfortunately the usefulness of this goes down quite a bit if we completely
> > disallow capturing. I don't think it would be worth adding at all with that
> > restriction. In the tests updated by this CL for example, every use of the
> > wrapper requires a capture in order to be useful.
> > 
> > Having said that, I can understand why we wouldn't want to add something
like
> > this, it's just kind of a shame.
> 
> If the code wants to:
> - capture things
> - use lambdas
> - emit a callback type
> 
> It'd still work with a non-capturing lambda, you'd just have to use
base::Bind() to capture the arguments. That doesn't seem so bad to me?

Ah, good point. I'll see what that looks like.

Powered by Google App Engine
This is Rietveld 408576698