diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-27 01:25:59 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-27 01:25:59 +0000 |
commit | 054ac754be8bcdecd3f1a39a085f01ef5c5d379a (patch) | |
tree | e713bfa32a32f74e3bb7d93af58e08ced826c075 /base/bind_internal_win.h.pump | |
parent | 8cf26423f5e01f1e25b66b126f9bf102b726b8ba (diff) | |
download | chromium_src-054ac754be8bcdecd3f1a39a085f01ef5c5d379a.zip chromium_src-054ac754be8bcdecd3f1a39a085f01ef5c5d379a.tar.gz chromium_src-054ac754be8bcdecd3f1a39a085f01ef5c5d379a.tar.bz2 |
Callback support for __fastcall and __stdcall functions.
Create FunctionTraits specializations that can unwrap function pointers that
are delcared with __fastcall and __stdcall on windows.
Only include these in the Windows build.
BUG=35223
TEST=new unittests
Review URL: http://codereview.chromium.org/6561004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76174 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/bind_internal_win.h.pump')
-rw-r--r-- | base/bind_internal_win.h.pump | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/base/bind_internal_win.h.pump b/base/bind_internal_win.h.pump new file mode 100644 index 0000000..4d213a3 --- /dev/null +++ b/base/bind_internal_win.h.pump @@ -0,0 +1,52 @@ +$$ This is a pump file for generating file templates. Pump is a python +$$ script that is part of the Google Test suite of utilities. Description +$$ can be found here: +$$ +$$ http://code.google.com/p/googletest/wiki/PumpManual +$$ + +$var MAX_ARITY = 6 + +// 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. + +// Specializations of FunctionTraits<> for Windows specific calling +// conventions. Please see base/bind_internal.h for more info. + +#ifndef BASE_BIND_INTERNAL_WIN_H_ +#define BASE_BIND_INTERNAL_WIN_H_ +#pragma once + +namespace base { +namespace internal { + +template <typename Sig> +struct FunctionTraits; + +$range ARITY 0..MAX_ARITY +$for ARITY [[ +$range ARG 1..ARITY + +// __stdcall Function: Arity $(ARITY). +template <typename R[[]] +$if ARITY > 0[[, ]] $for ARG , [[typename X$(ARG)]]> +struct FunctionTraits<R(__stdcall *)($for ARG , [[X$(ARG)]])> { + typedef R (*NormalizedSig)($for ARG , [[X$(ARG)]]); + typedef false_type IsMethod; +}; + +// __fastcall Function: Arity $(ARITY). +template <typename R[[]] +$if ARITY > 0[[, ]] $for ARG , [[typename X$(ARG)]]> +struct FunctionTraits<R(__fastcall *)($for ARG , [[X$(ARG)]])> { + typedef R (*NormalizedSig)($for ARG , [[X$(ARG)]]); + typedef false_type IsMethod; +}; + +]] $$for ARITY + +} // namespace internal +} // namespace base + +#endif // BASE_BIND_INTERNAL_WIN_H_ |