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

Issue 8673008: base::Bind: Implement CancelableCallback to replace CancelableTaske. (Closed)

Created:
9 years, 1 month ago by James Hawkins
Modified:
9 years, 1 month ago
CC:
chromium-reviews, Paweł Hajdan Jr., brettw-cc_chromium.org
Visibility:
Public.

Description

base::Bind: Implement CancelableCallback to replace CancelableTask. Designed by groby,binji,csilv,jhawkins. BUG=96749 TEST=CancelableCallbackTest.* R=ajwong@chromium.org,darin@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=111493

Patch Set 1 #

Total comments: 24

Patch Set 2 : Review fixes. #

Patch Set 3 : AppCacheGroup conversion. #

Patch Set 4 : Out-of-line destructor. #

Patch Set 5 : Test build fix. #

Total comments: 29

Patch Set 6 : More reviewer fixes. #

Total comments: 20

Patch Set 7 : More fixes. #

Patch Set 8 : Moar. #

Total comments: 13

Patch Set 9 : Moardor. #

Patch Set 10 : Test build fix. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+353 lines, -22 lines) Patch
M base/base.gyp View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M base/base.gypi View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M base/callback_unittest.cc View 1 chunk +0 lines, -1 line 0 comments Download
A base/cancelable_callback.h View 1 2 3 4 5 6 7 8 1 chunk +89 lines, -0 lines 0 comments Download
A base/cancelable_callback.cc View 1 2 3 4 5 6 7 8 1 chunk +60 lines, -0 lines 0 comments Download
A base/cancelable_callback_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +182 lines, -0 lines 0 comments Download
M webkit/appcache/appcache_group.h View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M webkit/appcache/appcache_group.cc View 1 2 3 4 5 6 7 6 chunks +13 lines, -16 lines 0 comments Download
M webkit/appcache/appcache_group_unittest.cc View 1 2 3 4 5 6 7 8 9 2 chunks +3 lines, -3 lines 0 comments Download
M webkit/appcache/appcache_update_job_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 26 (0 generated)
James Hawkins
9 years, 1 month ago (2011-11-23 01:56:26 UTC) #1
groby-ooo-7-16
http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.cc File base/cancelable_callback.cc (right): http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.cc#newcode28 base/cancelable_callback.cc:28: } nit: } // namespace base http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.h File base/cancelable_callback.h ...
9 years, 1 month ago (2011-11-23 02:14:12 UTC) #2
binji
http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.cc File base/cancelable_callback.cc (right): http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.cc#newcode13 base/cancelable_callback.cc:13: callback_(callback) { check for !callback.is_null? http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.h File base/cancelable_callback.h (right): ...
9 years, 1 month ago (2011-11-23 02:21:44 UTC) #3
awong
[ +willchan, akalin ] Thanks for taking a shot at this! Added some high level ...
9 years, 1 month ago (2011-11-23 02:30:20 UTC) #4
awong
Another thing that would be helpful is to link to some examples of where this ...
9 years, 1 month ago (2011-11-23 02:37:39 UTC) #5
James Hawkins
http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.cc File base/cancelable_callback.cc (right): http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.cc#newcode13 base/cancelable_callback.cc:13: callback_(callback) { On 2011/11/23 02:21:44, binji wrote: > check ...
9 years, 1 month ago (2011-11-23 03:59:07 UTC) #6
James Hawkins
On 2011/11/23 02:37:39, awong wrote: > Another thing that would be helpful is to link ...
9 years, 1 month ago (2011-11-23 04:17:03 UTC) #7
groby-ooo-7-16
LGTM http://codereview.chromium.org/8673008/diff/8001/base/cancelable_callback_unittest.cc File base/cancelable_callback_unittest.cc (right): http://codereview.chromium.org/8673008/diff/8001/base/cancelable_callback_unittest.cc#newcode50 base/cancelable_callback_unittest.cc:50: cancelable.Cancel(); I suspect it would be interesting for ...
9 years, 1 month ago (2011-11-23 19:18:57 UTC) #8
James Hawkins
http://codereview.chromium.org/8673008/diff/8001/base/cancelable_callback_unittest.cc File base/cancelable_callback_unittest.cc (right): http://codereview.chromium.org/8673008/diff/8001/base/cancelable_callback_unittest.cc#newcode50 base/cancelable_callback_unittest.cc:50: cancelable.Cancel(); On 2011/11/23 19:18:57, groby wrote: > I suspect ...
9 years, 1 month ago (2011-11-23 19:37:09 UTC) #9
csilv
http://codereview.chromium.org/8673008/diff/8001/base/cancelable_callback.cc File base/cancelable_callback.cc (right): http://codereview.chromium.org/8673008/diff/8001/base/cancelable_callback.cc#newcode5 base/cancelable_callback.cc:5: #include "base/cancelable_callback.h" add includes for base/bind.h and base/compiler_specific.h. http://codereview.chromium.org/8673008/diff/8001/base/cancelable_callback.h ...
9 years, 1 month ago (2011-11-23 19:37:30 UTC) #10
groby-ooo-7-16
http://codereview.chromium.org/8673008/diff/8001/base/cancelable_callback_unittest.cc File base/cancelable_callback_unittest.cc (right): http://codereview.chromium.org/8673008/diff/8001/base/cancelable_callback_unittest.cc#newcode50 base/cancelable_callback_unittest.cc:50: cancelable.Cancel(); Will callback2/3 be running without it? (It won't, ...
9 years, 1 month ago (2011-11-23 19:43:14 UTC) #11
awong
http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.h File base/cancelable_callback.h (right): http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.h#newcode6 base/cancelable_callback.h:6: #define BASE_CANCELABLE_CALLBACK_H_ On 2011/11/23 03:59:08, James Hawkins wrote: > ...
9 years, 1 month ago (2011-11-23 19:58:23 UTC) #12
James Hawkins
http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.h File base/cancelable_callback.h (right): http://codereview.chromium.org/8673008/diff/1/base/cancelable_callback.h#newcode19 base/cancelable_callback.h:19: class CancelableCallback { On 2011/11/23 19:58:23, awong wrote: > ...
9 years, 1 month ago (2011-11-23 22:12:51 UTC) #13
csilv
lgtm
9 years, 1 month ago (2011-11-23 22:37:34 UTC) #14
awong
commit nits. http://codereview.chromium.org/8673008/diff/15001/base/cancelable_callback.cc File base/cancelable_callback.cc (right): http://codereview.chromium.org/8673008/diff/15001/base/cancelable_callback.cc#newcode60 base/cancelable_callback.cc:60: } // namespace bind http://codereview.chromium.org/8673008/diff/15001/base/cancelable_callback.h File base/cancelable_callback.h ...
9 years, 1 month ago (2011-11-23 23:41:07 UTC) #15
awong
Will, Darin, This is going to need a base OWNERS review. I think it's pretty ...
9 years, 1 month ago (2011-11-23 23:41:38 UTC) #16
willchan no longer on Chromium
I was going to let you do it first :) Do you think it's ready? ...
9 years, 1 month ago (2011-11-23 23:42:26 UTC) #17
awong
Wow...fast response. Just wanted it on the radar for today. :) All that's left are ...
9 years, 1 month ago (2011-11-23 23:45:41 UTC) #18
James Hawkins
http://codereview.chromium.org/8673008/diff/15001/base/cancelable_callback.cc File base/cancelable_callback.cc (right): http://codereview.chromium.org/8673008/diff/15001/base/cancelable_callback.cc#newcode60 base/cancelable_callback.cc:60: } On 2011/11/23 23:41:07, awong wrote: > // namespace ...
9 years, 1 month ago (2011-11-24 00:11:15 UTC) #19
James Hawkins
http://codereview.chromium.org/8673008/diff/15001/base/cancelable_callback.h File base/cancelable_callback.h (right): http://codereview.chromium.org/8673008/diff/15001/base/cancelable_callback.h#newcode37 base/cancelable_callback.h:37: // }; On 2011/11/23 23:41:07, awong wrote: > This ...
9 years, 1 month ago (2011-11-24 00:33:45 UTC) #20
awong
LGTM Will: this.Pass();
9 years, 1 month ago (2011-11-24 00:43:56 UTC) #21
willchan no longer on Chromium
If awong is fine with this, I am too. http://codereview.chromium.org/8673008/diff/14005/base/cancelable_callback.cc File base/cancelable_callback.cc (right): http://codereview.chromium.org/8673008/diff/14005/base/cancelable_callback.cc#newcode20 base/cancelable_callback.cc:20: ...
9 years, 1 month ago (2011-11-24 00:44:29 UTC) #22
willchan no longer on Chromium
LGTM
9 years, 1 month ago (2011-11-24 00:45:05 UTC) #23
awong
http://codereview.chromium.org/8673008/diff/14005/base/cancelable_callback_unittest.cc File base/cancelable_callback_unittest.cc (right): http://codereview.chromium.org/8673008/diff/14005/base/cancelable_callback_unittest.cc#newcode50 base/cancelable_callback_unittest.cc:50: base::Bind(Increment, base::Unretained(&count))); On 2011/11/24 00:44:30, willchan wrote: > I ...
9 years, 1 month ago (2011-11-24 01:00:02 UTC) #24
James Hawkins
http://codereview.chromium.org/8673008/diff/14005/base/cancelable_callback.cc File base/cancelable_callback.cc (right): http://codereview.chromium.org/8673008/diff/14005/base/cancelable_callback.cc#newcode20 base/cancelable_callback.cc:20: DCHECK_EQ(false, callback.is_null()); On 2011/11/24 00:44:30, willchan wrote: > Nit: ...
9 years, 1 month ago (2011-11-24 02:47:48 UTC) #25
awong
9 years, 1 month ago (2011-11-24 02:56:53 UTC) #26
http://codereview.chromium.org/8673008/diff/14005/base/cancelable_callback_un...
File base/cancelable_callback_unittest.cc (right):

http://codereview.chromium.org/8673008/diff/14005/base/cancelable_callback_un...
base/cancelable_callback_unittest.cc:7: #include "base/cancelable_callback.h"
On 2011/11/24 02:47:48, James Hawkins wrote:
> On 2011/11/24 00:44:30, willchan wrote:
> > goes first
> 
> I read (on either c-style or chromium-dev) that this only applies if there is
> not a corresponding implementation file for myclass.h.  Same thing as my
> previous reply though: I'll just make the change.

Will has caught me on this previously, but it doesn't stick in my head. :-/ 
Style guide got modified somewhere in the last year or two. It used to be as you
had it originally.

http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Names_...

http://codereview.chromium.org/8673008/diff/14005/base/cancelable_callback_un...
base/cancelable_callback_unittest.cc:50: base::Bind(Increment,
base::Unretained(&count)));
On 2011/11/24 02:47:48, James Hawkins wrote:
> On 2011/11/24 01:00:03, awong wrote:
> > On 2011/11/24 00:44:30, willchan wrote:
> > > I always forget, doesn't Increment need & before it?
> > 
> > I had thought it did, but I have again learned that I don't understand the
> type
> > promotion rules from functions to function pointers.
> > 
> > Let's add it in for good measure though.
> 
> Hmm, I was really sure I've seen this fail to compile before...though I
suppose
> I don't understand the circumstances either.  This change works for me on
Linux,
> so we'll see if it sticks.

I *know* I went through and fixed a bunch that failed to compile.  But jam found
a case of the auto-promotion happening.  Function type and array type
auto-promotion.  The bane of my life.

Powered by Google App Engine
This is Rietveld 408576698