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

Issue 6109007: Unified callback system. (Closed)

Created:
9 years, 11 months ago by awong
Modified:
9 years, 7 months ago
CC:
chromium-reviews, brettw-cc_chromium.org, Paweł Hajdan Jr., piman+watch_chromium.org, darin-cc_chromium.org, pam+watch_chromium.org, scherkus (not reviewing), darin (slow to review), brettw
Visibility:
Public.

Description

Unified callback system based on tr1::function/tr1::bind and Google's internal callback code. This callback system allows for creation of functors for normal functions, methods, and const methods. It is a superset of the functionality of NewRunnableMethod, NewRunnableFunction, NewCallback, and CreateFunctor. We support partial binding of function arguments, and also specification of refcounting semantics by wrapping a target object in a wrapper object. BUG=35223 TEST=none

Patch Set 1 #

Patch Set 2 : Illustrates the basic structure of classes. #

Total comments: 13

Patch Set 3 : Differnet style implementation #

Patch Set 4 : address will's comments. #

Patch Set 5 : Cleaner invoker/prebind/storage setup. #

Patch Set 6 : Ready for another structural review. (not optimized) #

Total comments: 18

Patch Set 7 : pumped version of callback.h #

Patch Set 8 : pumped up #

Total comments: 6

Patch Set 9 : Move the non-pumped functions into a helpers header file. #

Patch Set 10 : silly style fix #

Patch Set 11 : Unitests Start! #

Patch Set 12 : more unittests #

Patch Set 13 : |_|n1+ T3$st$!!!@~!~!~!~~~~~ #

Patch Set 14 : cleaned up. Unittests are a thing of beauty. #

Patch Set 15 : Fixing up some comments. #

Total comments: 2

Patch Set 16 : comments beefed up. #

Patch Set 17 : Fix MSVS and gcc-4.2 compat" #

Patch Set 18 : mroe compat fixes #

Patch Set 19 : rebased #

Patch Set 20 : more compat #

Patch Set 21 : SFINAE inherited method fix. #

Patch Set 22 : holy 3@$@#...this might actually work... #

Patch Set 23 : more bits of cleanup #

Total comments: 39

Patch Set 24 : Addrss Will's comments #

Patch Set 25 : rebased correctly #

Patch Set 26 : did some of the renaming #

Patch Set 27 : rename callback.h to callback_old.h #

Patch Set 28 : ScopedRefptr checks for arguments. #

Patch Set 29 : Split out the implementation files. #

Patch Set 30 : spellchecked #

Patch Set 31 : 80-chars #

Patch Set 32 : forgot to add bind.h #

Total comments: 8

Patch Set 33 : address Brett and Darin's comments #

Patch Set 34 : fix comment. #

Total comments: 2

Patch Set 35 : Fixup argument checking to correctly ignore class types. #

Patch Set 36 : just inherit #

Patch Set 37 : Add template_util.h unittests. #

Total comments: 12

Patch Set 38 : Address Will's comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4103 lines, -214 lines) Patch
M base/base.gyp 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 30 31 32 33 34 35 2 chunks +2 lines, -0 lines 0 comments Download
M base/base.gypi 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 +5 lines, -0 lines 0 comments Download
A 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 30 31 1 chunk +99 lines, -0 lines 0 comments Download
A base/bind.h.pump 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 +71 lines, -0 lines 0 comments Download
A base/bind_helpers.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 30 31 32 33 34 35 36 37 1 chunk +287 lines, -0 lines 0 comments Download
A 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 1 chunk +1670 lines, -0 lines 0 comments Download
A base/bind_internal.h.pump 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 +237 lines, -0 lines 0 comments Download
A 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 30 31 32 33 34 35 36 37 1 chunk +597 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 30 31 32 33 2 chunks +434 lines, -206 lines 0 comments Download
A base/callback.h.pump 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 30 31 32 33 1 chunk +291 lines, -0 lines 0 comments Download
A base/callback_helpers.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 30 1 chunk +55 lines, -0 lines 0 comments Download
A base/callback_old.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 1 chunk +254 lines, -0 lines 0 comments Download
M base/template_util.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 30 31 32 33 34 35 4 chunks +35 lines, -8 lines 0 comments Download
A base/template_util_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 30 31 32 33 34 35 36 37 1 chunk +66 lines, -0 lines 0 comments Download

Messages

Total messages: 40 (0 generated)
awong
Okay, here's the next draft. This should be closer to a real implementation. Please ignore ...
9 years, 11 months ago (2011-01-19 04:52:35 UTC) #1
awong
To be clear, right now, I'm looking mainly for feedback about the basic structure of ...
9 years, 11 months ago (2011-01-19 04:59:36 UTC) #2
willchan no longer on Chromium
Resisted the urge to nit everything. Here are just the high level comments. I spent ...
9 years, 11 months ago (2011-01-19 16:57:43 UTC) #3
awong
Thanks for the restraint on nitpicking. :) I'll try to get a new version out ...
9 years, 11 months ago (2011-01-20 20:27:31 UTC) #4
willchan no longer on Chromium
http://codereview.chromium.org/6109007/diff/2001/base/callback.h File base/callback.h (right): http://codereview.chromium.org/6109007/diff/2001/base/callback.h#newcode301 base/callback.h:301: virtual ~InvokerBase() {} On 2011/01/20 20:27:35, awong wrote: > ...
9 years, 11 months ago (2011-01-21 02:30:12 UTC) #5
awong
I made another attempt at it. Two goals here: 1) Reduce the number of specializations ...
9 years, 11 months ago (2011-01-21 12:00:36 UTC) #6
awong
Here's a 90% working system including: - Refcounts the first object - Unwrapped and ConstRef ...
9 years, 11 months ago (2011-01-29 08:20:30 UTC) #7
awong
Here's a 90% working system including: - Refcounts the first object - Unwrapped and ConstRef ...
9 years, 11 months ago (2011-01-29 08:20:33 UTC) #8
darin (slow to review)
it would be good to see more samples in the unit tests... i think this ...
9 years, 10 months ago (2011-02-01 00:35:56 UTC) #9
scherkus (not reviewing)
http://codereview.chromium.org/6109007/diff/22001/base/callback_unittest.cc File base/callback_unittest.cc (right): http://codereview.chromium.org/6109007/diff/22001/base/callback_unittest.cc#newcode8 base/callback_unittest.cc:8: #include "base/logging.h" include order http://codereview.chromium.org/6109007/diff/22001/base/callback_unittest.cc#newcode72 base/callback_unittest.cc:72: int n; move ...
9 years, 10 months ago (2011-02-01 01:00:09 UTC) #10
awong
Seems like people are generally happy with the structure. I'm currently porting the code and ...
9 years, 10 months ago (2011-02-01 01:21:37 UTC) #11
akalin
Finally had some time to play with this! I like it. :) FWIW, I think ...
9 years, 10 months ago (2011-02-01 11:29:26 UTC) #12
awong
Responses to Fred's comments. On the current TODO list: 1) fix unittests 2) scrub the ...
9 years, 10 months ago (2011-02-01 23:20:45 UTC) #13
akalin
On 2011/02/01 23:20:45, awong wrote: > Also, full currying is currently not implemented. Didn't seem ...
9 years, 10 months ago (2011-02-03 04:32:48 UTC) #14
awong
On Wed, Feb 2, 2011 at 8:32 PM, <akalin@chromium.org> wrote: > On 2011/02/01 23:20:45, awong ...
9 years, 10 months ago (2011-02-03 04:40:45 UTC) #15
akalin
On 2011/02/03 04:40:45, awong wrote: > No...that case works. We just can't keep currying easily. ...
9 years, 10 months ago (2011-02-03 04:49:26 UTC) #16
awong
On Wed, Feb 2, 2011 at 8:49 PM, <akalin@chromium.org> wrote: > On 2011/02/03 04:40:45, awong ...
9 years, 10 months ago (2011-02-03 04:59:53 UTC) #17
awong
Updated with a slew of unittests. Found 4 actual issues that I need to fix. ...
9 years, 10 months ago (2011-02-03 05:04:18 UTC) #18
willchan no longer on Chromium
I apologize for not looking at the changelist yet. I will look tomorrow. On Wed, ...
9 years, 10 months ago (2011-02-03 05:18:07 UTC) #19
awong
I think it's ready for a real review now...comments, indentation, and all. I'm still working ...
9 years, 10 months ago (2011-02-04 04:33:16 UTC) #20
awong
Compiler compat fixed. I <3 stackoverflow. Ready for review. On 2011/02/04 04:33:16, awong wrote: > ...
9 years, 10 months ago (2011-02-05 04:53:07 UTC) #21
willchan no longer on Chromium
Sorry, not done yet. Still need to keep looking, but I'm going to bed. http://codereview.chromium.org/6109007/diff/27010/base/uber_callback.h.pump ...
9 years, 10 months ago (2011-02-06 10:26:49 UTC) #22
willchan no longer on Chromium
Almost done now. But now it's time for lunch. http://codereview.chromium.org/6109007/diff/11035/base/prebind.h File base/prebind.h (right): http://codereview.chromium.org/6109007/diff/11035/base/prebind.h#newcode35 base/prebind.h:35: ...
9 years, 10 months ago (2011-02-07 20:51:48 UTC) #23
willchan no longer on Chromium
http://codereview.chromium.org/6109007/diff/11035/base/prebind.h File base/prebind.h (right): http://codereview.chromium.org/6109007/diff/11035/base/prebind.h#newcode1276 base/prebind.h:1276: class InvokerStorage6 : public internal::InvokerStorageBase { You shouldn't need ...
9 years, 10 months ago (2011-02-07 23:25:15 UTC) #24
willchan no longer on Chromium
Also, other general comments: I have a preference for Bind() over Prebind(). I believe it ...
9 years, 10 months ago (2011-02-07 23:30:10 UTC) #25
willchan no longer on Chromium
http://codereview.chromium.org/6109007/diff/11035/base/uber_callback.h File base/uber_callback.h (right): http://codereview.chromium.org/6109007/diff/11035/base/uber_callback.h#newcode34 base/uber_callback.h:34: // class Ref : public RefCountedThreadSafe<Ref> { Add a ...
9 years, 10 months ago (2011-02-07 23:50:02 UTC) #26
awong
Addressed most comments. I'm saving renames for the next pass. Renames that are queued up: ...
9 years, 10 months ago (2011-02-08 18:52:26 UTC) #27
willchan no longer on Chromium
I talked to Albert about this. Last major comment is to shrink the public headers ...
9 years, 10 months ago (2011-02-08 22:24:29 UTC) #28
awong
Thanks Wiil for wading through all of that with me. I did two of the ...
9 years, 10 months ago (2011-02-09 00:02:08 UTC) #29
awong
Thanks Wiil for wading through all of that with me. I did two of the ...
9 years, 10 months ago (2011-02-09 00:02:10 UTC) #30
willchan no longer on Chromium
On Tue, Feb 8, 2011 at 4:02 PM, <ajwong@chromium.org> wrote: > Thanks Wiil for wading ...
9 years, 10 months ago (2011-02-09 01:15:32 UTC) #31
brettw
I looked over this briefly (finally). It looks pretty nice and I'm going to try ...
9 years, 10 months ago (2011-02-10 17:41:24 UTC) #32
darin (slow to review)
OK, I'm happy to stick with Unretained and ConstRef. Thanks for making the change from ...
9 years, 10 months ago (2011-02-10 19:09:14 UTC) #33
darin (slow to review)
looks great overall. i defer final LGTM to will.... here's a few thoughts: http://codereview.chromium.org/6109007/diff/46016/base/bind_helpers.h File ...
9 years, 10 months ago (2011-02-12 00:36:07 UTC) #34
awong
Addressed all comments. Will, would you be willing to do the honors of the final ...
9 years, 10 months ago (2011-02-12 09:44:45 UTC) #35
akalin
Looks pretty solid! http://codereview.chromium.org/6109007/diff/54001/base/bind_unittest.cc File base/bind_unittest.cc (right): http://codereview.chromium.org/6109007/diff/54001/base/bind_unittest.cc#newcode232 base/bind_unittest.cc:232: Callback<int(int)> c1= Bind(&Sum, 32, 16, 8, ...
9 years, 10 months ago (2011-02-12 21:33:21 UTC) #36
awong
Fixed Fred's comments. Also found a bug in the argument type checking for the AddRef/Release ...
9 years, 10 months ago (2011-02-13 03:55:01 UTC) #37
awong
Crap...I broke windows. Will fix monday. Grr...
9 years, 10 months ago (2011-02-13 03:58:46 UTC) #38
awong
Apparently today is "monday". Fixed! Ready for another look. On 2011/02/13 03:58:46, awong wrote: > ...
9 years, 10 months ago (2011-02-13 07:10:26 UTC) #39
willchan no longer on Chromium
9 years, 10 months ago (2011-02-15 01:17:14 UTC) #40
LGTM! Ship it.

http://codereview.chromium.org/6109007/diff/58002/base/bind_helpers.h
File base/bind_helpers.h (right):

http://codereview.chromium.org/6109007/diff/58002/base/bind_helpers.h#newcode71
base/bind_helpers.h:71: // For SFINAE to work with inherited methods, we need to
pull some extra ticks
ticks=>tricks

http://codereview.chromium.org/6109007/diff/58002/base/bind_unittest.cc
File base/bind_unittest.cc (right):

http://codereview.chromium.org/6109007/diff/58002/base/bind_unittest.cc#newco...
base/bind_unittest.cc:10: #error "base/bind.h should avoid pulling in callack.h
by default."
callback.h

http://codereview.chromium.org/6109007/diff/58002/base/bind_unittest.cc#newco...
base/bind_unittest.cc:269: &has_ref_);
Indentation is off here, probably from the rename from Prebind to Bind.

http://codereview.chromium.org/6109007/diff/58002/base/bind_unittest.cc#newco...
base/bind_unittest.cc:271: const_has_ref_ptr_);
Indentation is off here, probably from the rename from Prebind to Bind.

http://codereview.chromium.org/6109007/diff/58002/base/template_util_unittest.cc
File base/template_util_unittest.cc (right):

http://codereview.chromium.org/6109007/diff/58002/base/template_util_unittest...
base/template_util_unittest.cc:41: // TODO(ajwong): Why is is_convertible
disabled on windows?
I couldn't ever get it to compile in Windows :P You seem to be better (or at
least more diligent!) about getting this to work on all compilers, so maybe you
could fix this too :P

http://codereview.chromium.org/6109007/diff/58002/base/template_util_unittest...
base/template_util_unittest.cc:42: TEST(TemplateUtilTest, IsConvertable) {
IsConvertable=>IsConvertible

Powered by Google App Engine
This is Rietveld 408576698