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

Issue 7015064: Support binding WeakPtr<> to methods with void return types. (Closed)

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

Description

Support binding WeakPtr<> to methods with void return types. This should give functionality similar to ScopedRunnableMethodFactory. Note that binding a WeakPtr only make sense with methods with void return types. If the return type is not void, then it is unclear what the function should return when the pointer is invalidated. This code adds a compile time assert to check the return type. BUG=35223 TEST=unittests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=85549

Patch Set 1 #

Patch Set 2 : fix copyright #

Total comments: 7

Patch Set 3 : fix will's comments #

Patch Set 4 : fix a few comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+676 lines, -76 lines) Patch
M base/bind_helpers.h View 1 2 3 chunks +8 lines, -1 line 0 comments Download
M base/bind_internal.h View 1 2 78 chunks +506 lines, -63 lines 0 comments Download
M base/bind_internal.h.pump View 1 2 10 chunks +58 lines, -5 lines 0 comments Download
M base/bind_internal_win.h View 14 chunks +40 lines, -0 lines 0 comments Download
M base/bind_internal_win.h.pump View 2 chunks +4 lines, -0 lines 0 comments Download
M base/bind_unittest.cc View 4 chunks +51 lines, -1 line 0 comments Download
M base/callback.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M base/callback.h.pump View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download
M base/template_util.h View 1 2 chunks +4 lines, -1 line 0 comments Download

Messages

Total messages: 7 (0 generated)
awong
Here we go. I haven't proof read the comments, but this should make things work.
9 years, 7 months ago (2011-05-14 01:18:22 UTC) #1
willchan no longer on Chromium
LGTM mod nits. http://codereview.chromium.org/7015064/diff/1001/base/bind_helpers.h File base/bind_helpers.h (right): http://codereview.chromium.org/7015064/diff/1001/base/bind_helpers.h#newcode56 base/bind_helpers.h:56: #include "base/memory/weak_ptr.h" sort alphabetically :) http://codereview.chromium.org/7015064/diff/1001/base/bind_internal.h ...
9 years, 7 months ago (2011-05-14 01:25:09 UTC) #2
darin (slow to review)
I don't have any additional feedback. This looks solid. I wish there were a way ...
9 years, 7 months ago (2011-05-16 04:28:25 UTC) #3
darin (slow to review)
On 2011/05/16 04:28:25, darin wrote: > I don't have any additional feedback. This looks solid. ...
9 years, 7 months ago (2011-05-16 04:28:44 UTC) #4
awong
http://codereview.chromium.org/7015064/diff/1001/base/bind_helpers.h File base/bind_helpers.h (right): http://codereview.chromium.org/7015064/diff/1001/base/bind_helpers.h#newcode56 base/bind_helpers.h:56: #include "base/memory/weak_ptr.h" On 2011/05/14 01:25:10, willchan wrote: > sort ...
9 years, 7 months ago (2011-05-16 20:01:27 UTC) #5
willchan no longer on Chromium
http://codereview.chromium.org/7015064/diff/1001/base/bind_internal.h File base/bind_internal.h (right): http://codereview.chromium.org/7015064/diff/1001/base/bind_internal.h#newcode556 base/bind_internal.h:556: if (!invoker->p1_.get()) { On 2011/05/16 20:01:27, awong wrote: > ...
9 years, 7 months ago (2011-05-16 22:01:26 UTC) #6
awong
9 years, 7 months ago (2011-05-16 22:35:55 UTC) #7
On 2011/05/16 04:28:25, darin wrote:
> I don't have any additional feedback.  This looks solid.  I wish there were a
> way to write unit tests that should fail to compile ;-)

BTW, inside Google, there *is* actually a way to write unittests that assert
failure of compilation. :)

We could probably make something like that work for Chrome as well if you wanted
to devote a person to it. :P

Powered by Google App Engine
This is Rietveld 408576698