1 $$ This is a pump file for generating file templates. Pump is a python
2 $$ script that is part of the Google Test suite of utilities. Description
5 $$ http://code.google.com/p/googletest/wiki/PumpManual
8 $$ See comment for MAX_ARITY in base/bind.h.pump.
11 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
12 // Use of this source code is governed by a BSD-style license that can be
13 // found in the LICENSE file.
15 // Specializations of RunnableAdapter<> for Windows specific calling
16 // conventions. Please see base/bind_internal.h for more info.
18 #ifndef BASE_BIND_INTERNAL_WIN_H_
19 #define BASE_BIND_INTERNAL_WIN_H_
21 // In the x64 architecture in Windows, __fastcall, __stdcall, etc, are all
22 // the same as __cdecl which would turn the following specializations into
23 // multiple definitions.
24 #if !defined(ARCH_CPU_X86_64)
29 template <typename Functor>
30 class RunnableAdapter;
32 $range ARITY 0..MAX_ARITY
36 // __stdcall Function: Arity $(ARITY).
37 template <typename R[[]]
38 $if ARITY > 0[[, ]] $for ARG , [[typename A$(ARG)]]>
39 class RunnableAdapter<R(__stdcall *)($for ARG , [[A$(ARG)]])> {
41 typedef R (RunType)($for ARG , [[A$(ARG)]]);
43 explicit RunnableAdapter(R(__stdcall *function)($for ARG , [[A$(ARG)]]))
44 : function_(function) {
47 R Run($for ARG , [[typename CallbackParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) {
48 return function_($for ARG , [[a$(ARG)]]);
52 R (__stdcall *function_)($for ARG , [[A$(ARG)]]);
55 // __fastcall Function: Arity $(ARITY).
56 template <typename R[[]]
57 $if ARITY > 0[[, ]] $for ARG , [[typename A$(ARG)]]>
58 class RunnableAdapter<R(__fastcall *)($for ARG , [[A$(ARG)]])> {
60 typedef R (RunType)($for ARG , [[A$(ARG)]]);
62 explicit RunnableAdapter(R(__fastcall *function)($for ARG , [[A$(ARG)]]))
63 : function_(function) {
66 R Run($for ARG , [[typename CallbackParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) {
67 return function_($for ARG , [[a$(ARG)]]);
71 R (__fastcall *function_)($for ARG , [[A$(ARG)]]);
76 } // namespace internal
79 #endif // !defined(ARCH_CPU_X86_64)
81 #endif // BASE_BIND_INTERNAL_WIN_H_