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

Side by Side Diff: base/bind_internal_win.h

Issue 2106773002: Remove `Runnable` concept from base/bind_internal.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +comment. fix spacing. Created 4 years, 5 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
« no previous file with comments | « base/bind_internal.h ('k') | base/bind_unittest.nc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Specializations of RunnableAdapter<> for Windows specific calling
6 // conventions. Please see base/bind_internal.h for more info.
7
8 #ifndef BASE_BIND_INTERNAL_WIN_H_
9 #define BASE_BIND_INTERNAL_WIN_H_
10
11 #include <utility>
12
13 #include "build/build_config.h"
14
15 // In the x64 architecture in Windows, __fastcall, __stdcall, etc, are all
16 // the same as __cdecl which would turn the following specializations into
17 // multiple definitions.
18 #if !defined(ARCH_CPU_X86_64)
19
20 namespace base {
21 namespace internal {
22
23 template <typename Functor>
24 class RunnableAdapter;
25
26 // __stdcall Function.
27 template <typename R, typename... Args>
28 class RunnableAdapter<R(__stdcall *)(Args...)> {
29 public:
30 // MSVC 2013 doesn't support Type Alias of function types.
31 // Revisit this after we update it to newer version.
32 typedef R RunType(Args...);
33
34 explicit RunnableAdapter(R(__stdcall *function)(Args...))
35 : function_(function) {
36 }
37
38 template <typename... RunArgs>
39 R Run(RunArgs&&... args) const {
40 return function_(std::forward<RunArgs>(args)...);
41 }
42
43 private:
44 R (__stdcall *function_)(Args...);
45 };
46
47 // __fastcall Function.
48 template <typename R, typename... Args>
49 class RunnableAdapter<R(__fastcall *)(Args...)> {
50 public:
51 // MSVC 2013 doesn't support Type Alias of function types.
52 // Revisit this after we update it to newer version.
53 typedef R RunType(Args...);
54
55 explicit RunnableAdapter(R(__fastcall *function)(Args...))
56 : function_(function) {
57 }
58
59 template <typename... RunArgs>
60 R Run(RunArgs&&... args) const {
61 return function_(std::forward<RunArgs>(args)...);
62 }
63
64 private:
65 R (__fastcall *function_)(Args...);
66 };
67
68 } // namespace internal
69 } // namespace base
70
71 #endif // !defined(ARCH_CPU_X86_64)
72
73 #endif // BASE_BIND_INTERNAL_WIN_H_
OLDNEW
« no previous file with comments | « base/bind_internal.h ('k') | base/bind_unittest.nc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698