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_
22 // In the x64 architecture in Windows, __fastcall, __stdcall, etc, are all
23 // the same as __cdecl which would turn the following specializations into
24 // multiple definitions.
25 #if !defined(ARCH_CPU_X86_64)
30 template <typename Functor>
31 class RunnableAdapter;
33 $range ARITY 0..MAX_ARITY
37 // __stdcall Function: Arity $(ARITY).
38 template <typename R[[]]
39 $if ARITY > 0[[, ]] $for ARG , [[typename A$(ARG)]]>
40 class RunnableAdapter<R(__stdcall *)($for ARG , [[A$(ARG)]])> {
42 typedef R (RunType)($for ARG , [[A$(ARG)]]);
44 explicit RunnableAdapter(R(__stdcall *function)($for ARG , [[A$(ARG)]]))
45 : function_(function) {
48 R Run($for ARG , [[typename CallbackParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) {
49 return function_($for ARG , [[a$(ARG)]]);
53 R (__stdcall *function_)($for ARG , [[A$(ARG)]]);
56 // __fastcall Function: Arity $(ARITY).
57 template <typename R[[]]
58 $if ARITY > 0[[, ]] $for ARG , [[typename A$(ARG)]]>
59 class RunnableAdapter<R(__fastcall *)($for ARG , [[A$(ARG)]])> {
61 typedef R (RunType)($for ARG , [[A$(ARG)]]);
63 explicit RunnableAdapter(R(__fastcall *function)($for ARG , [[A$(ARG)]]))
64 : function_(function) {
67 R Run($for ARG , [[typename CallbackParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) {
68 return function_($for ARG , [[a$(ARG)]]);
72 R (__fastcall *function_)($for ARG , [[A$(ARG)]]);
77 } // namespace internal
80 #endif // !defined(ARCH_CPU_X86_64)
82 #endif // BASE_BIND_INTERNAL_WIN_H_