summaryrefslogtreecommitdiffstats
path: root/base/template_util.h
Commit message (Collapse)AuthorAgeFilesLines
* Update base::is_member_function_pointer to use variadic templates.aa2014-09-251-28/+6
| | | | | | | | BUG= Review URL: https://codereview.chromium.org/598223003 Cr-Commit-Position: refs/heads/master@{#296817}
* Gin: Add support for binding JS methods to C++ instance methods.aa@chromium.org2013-12-061-0/+33
| | | | | | | | | | | | | Also: - Added support for computed properties to ObjectTemplateBuilder - Realized it was possible for CreateFunctionTemplate to be just one template BUG= R=abarth@chromium.org, jyasskin@chromium.org Review URL: https://codereview.chromium.org/103703002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239126 0039d316-1c4b-4281-b951-d872f2087c98
* Remove move-only-type whitelists in CallbackParamTraits and CallbackForward ↵kinuko@chromium.org2013-10-221-0/+9
| | | | | | | | | | | | | | by SFINAE So that all move-only types defined with MOVE_ONLY_TYPE_FOR_CPP03 automatically becomes Passable in bind and callbacks. BUG=none R=ajwong@chromium.org, awong Review URL: https://codereview.chromium.org/26848010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230080 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the rest of #pragma once in one big CL.ajwong@chromium.org2012-07-111-1/+0
| | | | | | | | | For context see this thread: https://groups.google.com/a/chromium.org/forum/?fromgroups#!topic/chromium-dev/RMcVNGjB4II TBR=thakis,pkasting,jam git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146163 0039d316-1c4b-4281-b951-d872f2087c98
* Callback API Change: Reimplement Bind(); support IgnoreResult, full ↵ajwong@chromium.org2011-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+3
| | | | | | | | | | | | | | 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
* Support binding WeakPtr<> to methods with void return types.ajwong@chromium.org2011-05-161-1/+4
| | | | | | | | | | | | | | | 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 Review URL: http://codereview.chromium.org/7015064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85549 0039d316-1c4b-4281-b951-d872f2087c98
* Fix is_convertible for windows.ajwong@chromium.org2011-02-161-12/+11
| | | | | | | | | | | | | 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
* Unified callback system based on tr1::function/tr1::bind and Google's ↵ajwong@chromium.org2011-02-151-8/+35
| | | | | | | | | | | | | | | 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
* Take 3: Reland 69237 - Fix raw_scoped_refptr_mismatch_checker.h."willchan@chromium.org2010-12-151-0/+47
| | | | | | | | | | | If this one fails, I'm just reverting and calling it quits for tonight. BUG=28083 TEST=builds Review URL: http://codereview.chromium.org/5844002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69245 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 69243 - Reland 69237 - Fix raw_scoped_refptr_mismatch_checker.h.willchan@chromium.org2010-12-151-47/+0
| | | | | | | | | | | | | | | | | | | | Damn, missed a unittest. BUG=28083 TEST=none Review URL: http://codereview.chromium.org/3549010 TBR=willchan@chromium.org Review URL: http://codereview.chromium.org/5885001 TBR=phajdan.jr@chromium.org Review URL: http://codereview.chromium.org/5887001 TBR=willchan@chromium.org Review URL: http://codereview.chromium.org/5888001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69244 0039d316-1c4b-4281-b951-d872f2087c98
* Reland 69237 - Fix raw_scoped_refptr_mismatch_checker.h.willchan@chromium.org2010-12-151-0/+47
| | | | | | | | | | | | | | | BUG=28083 TEST=none Review URL: http://codereview.chromium.org/3549010 TBR=willchan@chromium.org Review URL: http://codereview.chromium.org/5885001 TBR=phajdan.jr@chromium.org Review URL: http://codereview.chromium.org/5887001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69243 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 69237 - Fix raw_scoped_refptr_mismatch_checker.h.phajdan.jr@chromium.org2010-12-151-47/+0
| | | | | | | | | | | | BUG=28083 TEST=none Review URL: http://codereview.chromium.org/3549010 TBR=willchan@chromium.org Review URL: http://codereview.chromium.org/5885001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69239 0039d316-1c4b-4281-b951-d872f2087c98
* Fix raw_scoped_refptr_mismatch_checker.h.willchan@chromium.org2010-12-151-0/+47
| | | | | | | | | BUG=28083 TEST=none Review URL: http://codereview.chromium.org/3549010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69237 0039d316-1c4b-4281-b951-d872f2087c98
* Fix style guide errors in commentsdpolukhin@chromium.org2010-09-161-1/+1
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/3402004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59622 0039d316-1c4b-4281-b951-d872f2087c98
* `#pragma once` for app, base, chrome, gfx, ipc, net, skia, viewsthakis@chromium.org2010-07-261-0/+1
| | | | | | | | | BUG=50273 TEST=everything still builds, build is 10% faster on windows, same speed on mac/linux TBR: erg git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53716 0039d316-1c4b-4281-b951-d872f2087c98
* Improve error messages for bad SocketParams.willchan@chromium.org2010-06-151-0/+29
Make it a compile-time error instead of link-time. Add a check to make sure you don't try to use it with a pointer. BUG=41016 Review URL: http://codereview.chromium.org/1604042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49823 0039d316-1c4b-4281-b951-d872f2087c98