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

Side by Side Diff: base/bind_internal.h

Issue 8073012: Callback API Change: Allow Bind() to take a Callback<> and bind all its free parameters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/bind.h.pump ('k') | base/bind_internal.h.pump » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This file was GENERATED by command: 1 // This file was GENERATED by command:
2 // pump.py bind_internal.h.pump 2 // pump.py bind_internal.h.pump
3 // DO NOT EDIT BY HAND!!! 3 // DO NOT EDIT BY HAND!!!
4 4
5 5
6 6
7 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 7 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
8 // Use of this source code is governed by a BSD-style license that can be 8 // Use of this source code is governed by a BSD-style license that can be
9 // found in the LICENSE file. 9 // found in the LICENSE file.
10 10
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 StorageType* invoker = static_cast<StorageType*>(base); 1714 StorageType* invoker = static_cast<StorageType*>(base);
1715 typename StorageType::P1Traits::StorageType& weak_ptr = invoker->p1_; 1715 typename StorageType::P1Traits::StorageType& weak_ptr = invoker->p1_;
1716 if (!weak_ptr.get()) { 1716 if (!weak_ptr.get()) {
1717 return; 1717 return;
1718 } 1718 }
1719 (weak_ptr->*invoker->f_)(Unwrap(invoker->p2_), Unwrap(invoker->p3_), 1719 (weak_ptr->*invoker->f_)(Unwrap(invoker->p2_), Unwrap(invoker->p3_),
1720 Unwrap(invoker->p4_), Unwrap(invoker->p5_), Unwrap(invoker->p6_)); 1720 Unwrap(invoker->p4_), Unwrap(invoker->p5_), Unwrap(invoker->p6_));
1721 } 1721 }
1722 }; 1722 };
1723 1723
1724 // BindMoreFuncN<>
1725 //
1726 // This set of functions help in fully binding the free parameters in a
1727 // Callback<>.
1728 template <typename Sig, typename P1>
1729 void BindMoreFunc1(const base::Callback<Sig>& callback, const P1& p1) {
1730 callback.Run(p1);
1731 }
1732
1733 template <typename Sig, typename P1, typename P2>
1734 void BindMoreFunc2(const base::Callback<Sig>& callback, const P1& p1,
1735 const P2& p2) {
1736 callback.Run(p1, p2);
1737 }
1738
1739 template <typename Sig, typename P1, typename P2, typename P3>
1740 void BindMoreFunc3(const base::Callback<Sig>& callback, const P1& p1,
1741 const P2& p2, const P3& p3) {
1742 callback.Run(p1, p2, p3);
1743 }
1744
1745 template <typename Sig, typename P1, typename P2, typename P3, typename P4>
1746 void BindMoreFunc4(const base::Callback<Sig>& callback, const P1& p1,
1747 const P2& p2, const P3& p3, const P4& p4) {
1748 callback.Run(p1, p2, p3, p4);
1749 }
1750
1751 template <typename Sig, typename P1, typename P2, typename P3, typename P4,
1752 typename P5>
1753 void BindMoreFunc5(const base::Callback<Sig>& callback, const P1& p1,
1754 const P2& p2, const P3& p3, const P4& p4, const P5& p5) {
1755 callback.Run(p1, p2, p3, p4, p5);
1756 }
1757
1758 template <typename Sig, typename P1, typename P2, typename P3, typename P4,
1759 typename P5, typename P6>
1760 void BindMoreFunc6(const base::Callback<Sig>& callback, const P1& p1,
1761 const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) {
1762 callback.Run(p1, p2, p3, p4, p5, p6);
1763 }
1764
1724 // InvokerStorageN<> 1765 // InvokerStorageN<>
1725 // 1766 //
1726 // These are the actual storage classes for the Invokers. 1767 // These are the actual storage classes for the Invokers.
1727 // 1768 //
1728 // Though these types are "classes", they are being used as structs with 1769 // Though these types are "classes", they are being used as structs with
1729 // all member variable public. We cannot make it a struct because it inherits 1770 // all member variable public. We cannot make it a struct because it inherits
1730 // from a class which causes a compiler warning. We cannot add a "Run()" method 1771 // from a class which causes a compiler warning. We cannot add a "Run()" method
1731 // that forwards the unbound arguments because that would require we unwrap the 1772 // that forwards the unbound arguments because that would require we unwrap the
1732 // Sig type like in InvokerN above to know the return type, and the arity 1773 // Sig type like in InvokerN above to know the return type, and the arity
1733 // of Run(). 1774 // of Run().
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 typename ParamTraits<P3>::StorageType p3_; 2164 typename ParamTraits<P3>::StorageType p3_;
2124 typename ParamTraits<P4>::StorageType p4_; 2165 typename ParamTraits<P4>::StorageType p4_;
2125 typename ParamTraits<P5>::StorageType p5_; 2166 typename ParamTraits<P5>::StorageType p5_;
2126 typename ParamTraits<P6>::StorageType p6_; 2167 typename ParamTraits<P6>::StorageType p6_;
2127 }; 2168 };
2128 2169
2129 } // namespace internal 2170 } // namespace internal
2130 } // namespace base 2171 } // namespace base
2131 2172
2132 #endif // BASE_BIND_INTERNAL_H_ 2173 #endif // BASE_BIND_INTERNAL_H_
OLDNEW
« no previous file with comments | « base/bind.h.pump ('k') | base/bind_internal.h.pump » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698