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

Issue 8209001: Callback API Change: Add in an Owned() wrapper to base::Bind(). (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, Joao da Silva
Visibility:
Public.

Description

Add in an Owned() wrapper to base::Bind(). This allows expression of ownership of a pointer by a callback. It's basically a "scoped_ptr<>" for Callback where the scope tied to the callback object. BUG=96118 TEST=new unittests. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=105622

Patch Set 1 #

Patch Set 2 : Fixed unittests. #

Patch Set 3 : Simple Owned() implementaiton. #

Patch Set 4 : fix comment #

Total comments: 2

Patch Set 5 : fix comment. #

Total comments: 4

Patch Set 6 : fixed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -18 lines) Patch
M base/bind_helpers.h View 1 2 3 4 5 8 chunks +75 lines, -13 lines 0 comments Download
M base/bind_unittest.cc View 1 2 3 chunks +41 lines, -5 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
awong
Here's a proposal for Owned(). Please look at the unittest mainly and tell me what ...
9 years, 2 months ago (2011-10-08 19:10:57 UTC) #1
awong
The thing I'm struggling the most with this design is that MaybeCapturePtr feels a lot ...
9 years, 2 months ago (2011-10-08 20:48:07 UTC) #2
awong
One last possibility, we could just make this a simple Owned() concept, and only pass ...
9 years, 2 months ago (2011-10-09 06:36:14 UTC) #3
willchan no longer on Chromium
Can we make it so base::Owned() creates a scoped_ptr<T> in the InvokerStorage? And then, have ...
9 years, 2 months ago (2011-10-09 06:40:54 UTC) #4
willchan no longer on Chromium
Actually, sorry, not a scoped_ptr<T> because that's noncopyable. But a base::internal type, like OwnPtr<T> or ...
9 years, 2 months ago (2011-10-09 06:42:31 UTC) #5
awong
The main thing that I worry about is multiple runs of a callback. For instance, ...
9 years, 2 months ago (2011-10-09 06:47:43 UTC) #6
awong
On Sat, Oct 8, 2011 at 11:51 PM, William Chan (陈智昌) <willchan@chromium.org>wrote: > Isn't that ...
9 years, 2 months ago (2011-10-09 06:58:05 UTC) #7
willchan no longer on Chromium
On Sat, Oct 8, 2011 at 11:57 PM, Albert J. Wong (王重傑) <ajwong@chromium.org>wrote: > On ...
9 years, 2 months ago (2011-10-09 07:16:50 UTC) #8
awong
On Sun, Oct 9, 2011 at 12:16 AM, William Chan (陈智昌) <willchan@chromium.org>wrote: > On Sat, ...
9 years, 2 months ago (2011-10-09 07:23:42 UTC) #9
willchan no longer on Chromium
On Sun, Oct 9, 2011 at 12:23 AM, Albert J. Wong (王重傑) <ajwong@chromium.org>wrote: > On ...
9 years, 2 months ago (2011-10-09 07:38:39 UTC) #10
awong
On Sun, Oct 9, 2011 at 12:38 AM, William Chan (陈智昌) <willchan@chromium.org>wrote: > On Sun, ...
9 years, 2 months ago (2011-10-09 07:45:03 UTC) #11
willchan no longer on Chromium
On Sun, Oct 9, 2011 at 12:44 AM, Albert J. Wong (王重傑) <ajwong@chromium.org>wrote: > > ...
9 years, 2 months ago (2011-10-09 18:09:12 UTC) #12
awong
9 years, 2 months ago (2011-10-11 00:20:52 UTC) #13
darin (slow to review)
http://codereview.chromium.org/8209001/diff/8002/base/bind_helpers.h File base/bind_helpers.h (right): http://codereview.chromium.org/8209001/diff/8002/base/bind_helpers.h#newcode335 base/bind_helpers.h:335: inline internal::OwnedWrapper<T> Owned(T* o) { how about some documentation? ...
9 years, 2 months ago (2011-10-11 05:13:49 UTC) #14
awong
PTAL http://codereview.chromium.org/8209001/diff/8002/base/bind_helpers.h File base/bind_helpers.h (right): http://codereview.chromium.org/8209001/diff/8002/base/bind_helpers.h#newcode335 base/bind_helpers.h:335: inline internal::OwnedWrapper<T> Owned(T* o) { On 2011/10/11 05:13:50, ...
9 years, 2 months ago (2011-10-11 17:24:27 UTC) #15
awong
ping-a-ling On 2011/10/11 17:24:27, awong wrote: > PTAL > > http://codereview.chromium.org/8209001/diff/8002/base/bind_helpers.h > File base/bind_helpers.h (right): ...
9 years, 2 months ago (2011-10-12 08:31:05 UTC) #16
darin (slow to review)
LGTM http://codereview.chromium.org/8209001/diff/11001/base/bind_helpers.h File base/bind_helpers.h (right): http://codereview.chromium.org/8209001/diff/11001/base/bind_helpers.h#newcode40 base/bind_helpers.h:40: // EXAMPLE OF Owned(): nit: new line below ...
9 years, 2 months ago (2011-10-14 21:53:07 UTC) #17
awong
9 years, 2 months ago (2011-10-15 00:19:16 UTC) #18
http://codereview.chromium.org/8209001/diff/11001/base/bind_helpers.h
File base/bind_helpers.h (right):

http://codereview.chromium.org/8209001/diff/11001/base/bind_helpers.h#newcode40
base/bind_helpers.h:40: // EXAMPLE OF Owned():
On 2011/10/14 21:53:07, darin wrote:
> nit: new line below this line as you did for Unretained(), or kill the new
line
> for the Unretained case.

Done.  Also fixed ConstRef and IgnoreReturn.

http://codereview.chromium.org/8209001/diff/11001/base/bind_helpers.h#newcode242
base/bind_helpers.h:242: // This has the benefit though of leaving ParamTrais<>
fully in
On 2011/10/14 21:53:07, darin wrote:
> nit: ParamTrais -> ParamTraits

Done.

Powered by Google App Engine
This is Rietveld 408576698