summaryrefslogtreecommitdiffstats
path: root/base/template_util.h
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-21 19:23:44 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-21 19:23:44 +0000
commit7296f2763bd40e560466f09836c7208c42d90f94 (patch)
tree142a03c36f75f42738206355a029707ad88cdffc /base/template_util.h
parent1fbbf963079bc977ea041b7e50ddf4666f6fec38 (diff)
downloadchromium_src-7296f2763bd40e560466f09836c7208c42d90f94.zip
chromium_src-7296f2763bd40e560466f09836c7208c42d90f94.tar.gz
chromium_src-7296f2763bd40e560466f09836c7208c42d90f94.tar.bz2
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 Review URL: http://codereview.chromium.org/8483003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110975 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/template_util.h')
-rw-r--r--base/template_util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/base/template_util.h b/base/template_util.h
index f19fb4b..916e942 100644
--- a/base/template_util.h
+++ b/base/template_util.h
@@ -70,7 +70,7 @@ struct ConvertHelper {
static NoType Test(...);
template <typename From>
- static From Create();
+ static From& Create();
};
// Used to determine if a type is a struct/union/class. Inspired by Boost's