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

Side by Side Diff: base/bind_internal_win.h

Issue 1498973002: WIP: base::Bind for rvalue references. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Specializations of RunnableAdapter<> for Windows specific calling 5 // Specializations of RunnableAdapter<> for Windows specific calling
6 // conventions. Please see base/bind_internal.h for more info. 6 // conventions. Please see base/bind_internal.h for more info.
7 7
8 #ifndef BASE_BIND_INTERNAL_WIN_H_ 8 #ifndef BASE_BIND_INTERNAL_WIN_H_
9 #define BASE_BIND_INTERNAL_WIN_H_ 9 #define BASE_BIND_INTERNAL_WIN_H_
10 10
(...skipping 11 matching lines...) Expand all
22 // __stdcall Function. 22 // __stdcall Function.
23 template <typename R, typename... Args> 23 template <typename R, typename... Args>
24 class RunnableAdapter<R(__stdcall *)(Args...)> { 24 class RunnableAdapter<R(__stdcall *)(Args...)> {
25 public: 25 public:
26 typedef R (RunType)(Args...); 26 typedef R (RunType)(Args...);
27 27
28 explicit RunnableAdapter(R(__stdcall *function)(Args...)) 28 explicit RunnableAdapter(R(__stdcall *function)(Args...))
29 : function_(function) { 29 : function_(function) {
30 } 30 }
31 31
32 R Run(typename CallbackParamTraits<Args>::ForwardType... args) { 32 template <typename... RunArgs>
33 return function_(args...); 33 R Run(RunArgs&&... args) {
34 return function_(std::forward<RunArgs>(args)...);
34 } 35 }
35 36
36 private: 37 private:
37 R (__stdcall *function_)(Args...); 38 R (__stdcall *function_)(Args...);
38 }; 39 };
39 40
40 // __fastcall Function. 41 // __fastcall Function.
41 template <typename R, typename... Args> 42 template <typename R, typename... Args>
42 class RunnableAdapter<R(__fastcall *)(Args...)> { 43 class RunnableAdapter<R(__fastcall *)(Args...)> {
43 public: 44 public:
44 typedef R (RunType)(Args...); 45 typedef R (RunType)(Args...);
45 46
46 explicit RunnableAdapter(R(__fastcall *function)(Args...)) 47 explicit RunnableAdapter(R(__fastcall *function)(Args...))
47 : function_(function) { 48 : function_(function) {
48 } 49 }
49 50
50 R Run(typename CallbackParamTraits<Args>::ForwardType... args) { 51 template <typename... RunArgs>
51 return function_(args...); 52 R Run(RunArgs&&... args) {
53 return function_(std::forward<RunArgs>(args)...);
52 } 54 }
53 55
54 private: 56 private:
55 R (__fastcall *function_)(Args...); 57 R (__fastcall *function_)(Args...);
56 }; 58 };
57 59
58 } // namespace internal 60 } // namespace internal
59 } // namespace base 61 } // namespace base
60 62
61 #endif // !defined(ARCH_CPU_X86_64) 63 #endif // !defined(ARCH_CPU_X86_64)
62 64
63 #endif // BASE_BIND_INTERNAL_WIN_H_ 65 #endif // BASE_BIND_INTERNAL_WIN_H_
OLDNEW
« no previous file with comments | « base/bind_internal.h ('k') | base/bind_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698