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

Issue 8483003: Callback API Change: Reimplement Bind(); support IgnoreResult, full currying, and use less types (Closed)

Created:
9 years, 1 month ago by awong
Modified:
9 years, 1 month ago
CC:
chromium-reviews, brettw-cc_chromium.org, akalin, darin (slow to review), brettw, Satish
Visibility:
Public.

Description

Callback API Change: Reimplement Bind(); support IgnoreResult, full currying, and use less types. The main API change IgnoreResult() and fully currying. See unittest for what the new API looks like. The rest of the changes are done to support that. Previously, IgnoreReturn could not be used with WeakPtr<> Bind()s as it was applied after the fact to the Callback object. Now, IgnoreResult() wraps the function like Unretained(). As an incidental benefit, the new implementation gave us fully currying for free. Also, the new implementation scales better when supporting higher arities of functions. The new type growth is: (n^2 + 20n) / 2 as opposed to (3n^2 + 17n) / 2 where n == arity. For n = 6 and n=10, the new implementation has 81 and 155 templates respectively. The old implementation had 105 and 235 templates respectively. BUG=35233, 98919, 98542 TEST=existing unittests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=110975

Patch Set 1 #

Patch Set 2 : Reimplementation. #

Patch Set 3 : Fix windows #

Patch Set 4 : Add compile asserts back in. #

Patch Set 5 : Move COMPILE_ASSERTs into bind.h #

Patch Set 6 : They're function *pointers* danggit! #

Patch Set 7 : More functions that need to be pointers. #

Patch Set 8 : Fix windows builds. silly msvc. #

Total comments: 6

Patch Set 9 : Address initial comments. #

Total comments: 18

Patch Set 10 : Comments addressed #

Patch Set 11 : rebased #

Total comments: 2

Patch Set 12 : rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3286 lines, -2702 lines) Patch
M base/at_exit_unittest.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M base/bind.h View 1 2 3 4 5 6 7 8 9 2 chunks +356 lines, -86 lines 0 comments Download
M base/bind.h.pump View 1 2 3 4 5 6 7 8 9 2 chunks +73 lines, -42 lines 0 comments Download
M base/bind_helpers.h View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +98 lines, -25 lines 0 comments Download
M base/bind_internal.h View 1 2 3 4 5 6 7 8 9 2 chunks +1769 lines, -1816 lines 0 comments Download
M base/bind_internal.h.pump View 1 2 3 4 5 6 7 8 9 2 chunks +365 lines, -266 lines 0 comments Download
M base/bind_internal_win.h View 1 2 4 2 chunks +239 lines, -149 lines 0 comments Download
M base/bind_internal_win.h.pump View 1 2 4 3 chunks +27 lines, -29 lines 0 comments Download
M base/bind_unittest.cc View 1 2 3 4 5 6 4 chunks +60 lines, -34 lines 0 comments Download
M base/bind_unittest.nc View 1 2 3 4 chunks +6 lines, -5 lines 0 comments Download
M base/callback.h View 1 10 chunks +154 lines, -126 lines 0 comments Download
M base/callback.h.pump View 1 4 chunks +25 lines, -21 lines 0 comments Download
M base/callback_internal.h View 1 5 chunks +19 lines, -19 lines 0 comments Download
M base/callback_internal.cc View 1 1 chunk +6 lines, -6 lines 0 comments Download
M base/callback_unittest.cc View 1 3 chunks +9 lines, -9 lines 0 comments Download
M base/file_util_proxy.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M base/task_unittest.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M base/template_util.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M base/template_util_unittest.cc View 1 2 3 4 1 chunk +6 lines, -0 lines 0 comments Download
M build/nocompile.gypi View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/chrome_browser_main_x11.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_service.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_updater.cc View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/net/net_pref_observer.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/net/predictor.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/password_manager/password_store_x.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/profiling.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/cancelable_request.h View 1 2 3 6 chunks +48 lines, -42 lines 0 comments Download
M content/browser/debugger/worker_devtools_manager.cc View 1 2 3 4 5 6 7 6 chunks +5 lines, -6 lines 0 comments Download
M content/browser/plugin_service_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -2 lines 0 comments Download
M content/renderer/render_widget_fullscreen_pepper.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M media/tools/player_x11/player_x11.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M remoting/protocol/jingle_session_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 12 (0 generated)
awong
Ready for first pass review. I still need to fix windows, and probably proofread, but ...
9 years, 1 month ago (2011-11-08 02:58:09 UTC) #1
awong
FYI, I haven't run these through the no-compile tests yet. Also, there is one API ...
9 years, 1 month ago (2011-11-08 03:01:49 UTC) #2
awong
Actually, if you haven't started reviewing, hold off for a bit. Realized there are 2 ...
9 years, 1 month ago (2011-11-08 20:47:51 UTC) #3
awong
Okay, ready for review. All the files that aren't directly Bind() related just have 1-line ...
9 years, 1 month ago (2011-11-09 21:59:27 UTC) #4
willchan no longer on Chromium
Started to look, but Comcast just finished, so I'm headed into the office in a ...
9 years, 1 month ago (2011-11-10 19:33:39 UTC) #5
willchan no longer on Chromium
http://codereview.chromium.org/8483003/diff/16002/base/bind.h.pump File base/bind.h.pump (right): http://codereview.chromium.org/8483003/diff/16002/base/bind.h.pump#newcode93 base/bind.h.pump:93: // scoped_refptr check because the binder itself takes care ...
9 years, 1 month ago (2011-11-11 01:30:25 UTC) #6
awong
PTAL http://codereview.chromium.org/8483003/diff/13002/base/bind.h.pump File base/bind.h.pump (right): http://codereview.chromium.org/8483003/diff/13002/base/bind.h.pump#newcode41 base/bind.h.pump:41: // bit it feels a little nicer to ...
9 years, 1 month ago (2011-11-11 02:17:57 UTC) #7
willchan no longer on Chromium
lgtm
9 years, 1 month ago (2011-11-11 21:32:48 UTC) #8
James Hawkins
http://codereview.chromium.org/8483003/diff/23001/base/bind_helpers.h File base/bind_helpers.h (right): http://codereview.chromium.org/8483003/diff/23001/base/bind_helpers.h#newcode393 base/bind_helpers.h:393: // IsWeakMethod determines is a helper to determine if ...
9 years, 1 month ago (2011-11-19 01:33:12 UTC) #9
awong
http://codereview.chromium.org/8483003/diff/23001/base/bind_helpers.h File base/bind_helpers.h (right): http://codereview.chromium.org/8483003/diff/23001/base/bind_helpers.h#newcode393 base/bind_helpers.h:393: // IsWeakMethod determines is a helper to determine if ...
9 years, 1 month ago (2011-11-21 20:11:18 UTC) #10
joth
I just noticed this appeared to reduce the size of windows and mac builds (22 ...
9 years, 1 month ago (2011-11-22 10:27:24 UTC) #11
awong
9 years, 1 month ago (2011-11-22 19:34:30 UTC) #12
Whoa, that's nuts.

Where's that extra 70kb coming from then?  I'm looking at chrome-bss and
chrome-data which don't seem to show 70kb of growth. Do you know if these builds
include debug symbols?  More symbols is expected...

-Albert

On 2011/11/22 10:27:24, joth wrote:
> I just noticed this appeared to reduce the size of windows and mac builds (22
> and 48 kb resp) but increased the linux binary by 140kb (although, chrome-text
> dipped by 70kb)
>
http://build.chromium.org/f/chromium/perf/linux-release/sizes/report.html?his...
> 
> Mostly just mentioning it here in passing / for the record, but there could be
> something worth exploring further?

Powered by Google App Engine
This is Rietveld 408576698