diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 22:13:54 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 22:13:54 +0000 |
commit | fccef1559e02b001c69a0d35ad960e37dcbfd650 (patch) | |
tree | b3ddaa715bf24e5d44a134b7298f39e59b2c1f27 /base/bind_internal_win.h | |
parent | 485c5558393ab8fa34c580eed539a37d9d8f1450 (diff) | |
download | chromium_src-fccef1559e02b001c69a0d35ad960e37dcbfd650.zip chromium_src-fccef1559e02b001c69a0d35ad960e37dcbfd650.tar.gz chromium_src-fccef1559e02b001c69a0d35ad960e37dcbfd650.tar.bz2 |
Increase Bind/Callback Arity from 6 -> 7.
A few functions need this and the expected compile-speed impact is low. We should be careful when raising this number higher. If you're binding a function that has more parameters than this supports, consider refactoring your API to use a parameter struct or something.
Template equation: (n^2 + 26n) / 2
Template growth: 96 -> 116 types.
BUG=98542
TEST=try bots
Review URL: http://codereview.chromium.org/8728010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111788 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/bind_internal_win.h')
-rw-r--r-- | base/bind_internal_win.h | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/base/bind_internal_win.h b/base/bind_internal_win.h index 17d3aa3..b50361b 100644 --- a/base/bind_internal_win.h +++ b/base/bind_internal_win.h @@ -3,7 +3,6 @@ // DO NOT EDIT BY HAND!!! - // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -312,6 +311,56 @@ class RunnableAdapter<R(__fastcall *)(A1, A2, A3, A4, A5, A6)> { R (__fastcall *function_)(A1, A2, A3, A4, A5, A6); }; +// __stdcall Function: Arity 7. +template <typename R, typename A1, typename A2, typename A3, typename A4, + typename A5, typename A6, typename A7> +class RunnableAdapter<R(__stdcall *)(A1, A2, A3, A4, A5, A6, A7)> { + public: + typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7); + + explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3, A4, A5, A6, A7)) + : function_(function) { + } + + R Run(typename CallbackParamTraits<A1>::ForwardType a1, + typename CallbackParamTraits<A2>::ForwardType a2, + typename CallbackParamTraits<A3>::ForwardType a3, + typename CallbackParamTraits<A4>::ForwardType a4, + typename CallbackParamTraits<A5>::ForwardType a5, + typename CallbackParamTraits<A6>::ForwardType a6, + typename CallbackParamTraits<A7>::ForwardType a7) { + return function_(a1, a2, a3, a4, a5, a6, a7); + } + + private: + R (__stdcall *function_)(A1, A2, A3, A4, A5, A6, A7); +}; + +// __fastcall Function: Arity 7. +template <typename R, typename A1, typename A2, typename A3, typename A4, + typename A5, typename A6, typename A7> +class RunnableAdapter<R(__fastcall *)(A1, A2, A3, A4, A5, A6, A7)> { + public: + typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7); + + explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3, A4, A5, A6, A7)) + : function_(function) { + } + + R Run(typename CallbackParamTraits<A1>::ForwardType a1, + typename CallbackParamTraits<A2>::ForwardType a2, + typename CallbackParamTraits<A3>::ForwardType a3, + typename CallbackParamTraits<A4>::ForwardType a4, + typename CallbackParamTraits<A5>::ForwardType a5, + typename CallbackParamTraits<A6>::ForwardType a6, + typename CallbackParamTraits<A7>::ForwardType a7) { + return function_(a1, a2, a3, a4, a5, a6, a7); + } + + private: + R (__fastcall *function_)(A1, A2, A3, A4, A5, A6, A7); +}; + } // namespace internal } // namespace base |