summaryrefslogtreecommitdiffstats
path: root/base/template_util_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Switch template_utils_unittest to using COMPILE_ASSERT.gavinp@chromium.org2012-06-191-58/+53
| | | | | | | | | | | This should be faster, and just as correct. BUG=None Review URL: https://chromiumcodereview.appspot.com/10565006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142998 0039d316-1c4b-4281-b951-d872f2087c98
* Callback API Change: Reimplement Bind(); support IgnoreResult, full ↵ajwong@chromium.org2011-11-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add COMPILE_ASSERT to ensure the result of Bind matches the Callback's type.ajwong@chromium.org2011-06-261-0/+11
| | | | | | | | | | | | | | Required because we abstract the storage of the funciton pointer out using a reinterpret_cast to reduce template bloat. This effectively readds the failure that would have happened had we stored the function pointer directly in the template class. BUG=86008 TEST=new unittests. Review URL: http://codereview.chromium.org/7241015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90525 0039d316-1c4b-4281-b951-d872f2087c98
* Fix is_convertible for windows.ajwong@chromium.org2011-02-161-4/+6
| | | | | | | | | | | | | It turns out that if you nest a template inside the initializer list of another template, the namelookup in windows gets all funky. In this case, it couldn't tell that the found name was a function. Luckily, we could just move the template parameters one level deeper. BUG=none TEST=unittests & trybots. Review URL: http://codereview.chromium.org/6537001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75194 0039d316-1c4b-4281-b951-d872f2087c98
* Clang doesn't like EXPECT_EQ with false and a template value.ajwong@chromium.org2011-02-151-7/+7
| | | | | | | | | BUG=none TEST=Clang try-bot passes. Review URL: http://codereview.chromium.org/6523014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74908 0039d316-1c4b-4281-b951-d872f2087c98
* Unified callback system based on tr1::function/tr1::bind and Google's ↵ajwong@chromium.org2011-02-151-0/+66
internal callback code. This callback system allows for creation of functors for normal functions, methods, and const methods. It is a superset of the functionality of NewRunnableMethod, NewRunnableFunction, NewCallback, and CreateFunctor. We support partial binding of function arguments, and also specification of refcounting semantics by wrapping a target object in a wrapper object. BUG=35223 TEST=none Review URL: http://codereview.chromium.org/6109007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74904 0039d316-1c4b-4281-b951-d872f2087c98