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

Issue 8073012: Callback API Change: Allow Bind() to take a Callback<> and bind all its free parameters. (Closed)

Created:
9 years, 2 months ago by awong
Modified:
9 years, 2 months ago
CC:
chromium-reviews, Paweł Hajdan Jr., brettw-cc_chromium.org, akalin
Visibility:
Public.

Description

Allow Bind() to take a Callback<> and bind all its free parameters. Basically, turns base::Callback<void(...)> to base::Closure. It turns out there are a number of use caess where an API takes a callback, and then wants to invoke the Callback on another thread. This piece of syntactic sugar removes the need for custom helper functions. This isn't quite full currying, however it is much simpler to implement. BUG=87287 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=103446

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+159 lines, -0 lines) Patch
M base/bind.h View 2 chunks +46 lines, -0 lines 0 comments Download
M base/bind.h.pump View 1 chunk +20 lines, -0 lines 0 comments Download
M base/bind_internal.h View 1 chunk +41 lines, -0 lines 0 comments Download
M base/bind_internal.h.pump View 1 chunk +17 lines, -0 lines 0 comments Download
M base/bind_unittest.cc View 2 chunks +35 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
awong
9 years, 2 months ago (2011-09-29 00:44:59 UTC) #1
awong
Changing subject to mark this is an API extension. As for concrete use cases, media ...
9 years, 2 months ago (2011-09-29 00:58:52 UTC) #2
darin (slow to review)
To make sure I understand, this does not allow you to translate a Callback<void(a,b)> into ...
9 years, 2 months ago (2011-09-29 05:48:33 UTC) #3
awong
Exactly. You can only bind to a closure. Doing the full implementation of currying would ...
9 years, 2 months ago (2011-09-29 07:05:43 UTC) #4
awong
Are there concerns about this usage? I know it's last day of perf, but if ...
9 years, 2 months ago (2011-09-29 17:55:33 UTC) #5
darin (slow to review)
LGTM Yeah, perf got the best of me today. This looks great! On Thu, Sep ...
9 years, 2 months ago (2011-09-30 06:39:00 UTC) #6
commit-bot: I haz the power
CQ is trying tha patch. Follow status at https://chromium-status.appspot.com/cq/ajwong@chromium.org/8073012/1
9 years, 2 months ago (2011-09-30 07:34:28 UTC) #7
awong
Yeah...I'm still doing some of my perf :( Thanks for the review! committing. On 2011/09/30 ...
9 years, 2 months ago (2011-09-30 07:35:08 UTC) #8
commit-bot: I haz the power
9 years, 2 months ago (2011-09-30 09:09:36 UTC) #9
Change committed as 103446

Powered by Google App Engine
This is Rietveld 408576698