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

Side by Side Diff: base/bind_internal_win.h

Issue 2039093002: Pass bound values as const values to the bound function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
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 18 matching lines...) Expand all
29 public: 29 public:
30 // MSVC 2013 doesn't support Type Alias of function types. 30 // MSVC 2013 doesn't support Type Alias of function types.
31 // Revisit this after we update it to newer version. 31 // Revisit this after we update it to newer version.
32 typedef R RunType(Args...); 32 typedef R RunType(Args...);
33 33
34 explicit RunnableAdapter(R(__stdcall *function)(Args...)) 34 explicit RunnableAdapter(R(__stdcall *function)(Args...))
35 : function_(function) { 35 : function_(function) {
36 } 36 }
37 37
38 template <typename... RunArgs> 38 template <typename... RunArgs>
39 R Run(RunArgs&&... args) { 39 R Run(RunArgs&&... args) const {
40 return function_(std::forward<RunArgs>(args)...); 40 return function_(std::forward<RunArgs>(args)...);
41 } 41 }
42 42
43 private: 43 private:
44 R (__stdcall *function_)(Args...); 44 R (__stdcall *function_)(Args...);
45 }; 45 };
46 46
47 // __fastcall Function. 47 // __fastcall Function.
48 template <typename R, typename... Args> 48 template <typename R, typename... Args>
49 class RunnableAdapter<R(__fastcall *)(Args...)> { 49 class RunnableAdapter<R(__fastcall *)(Args...)> {
50 public: 50 public:
51 // MSVC 2013 doesn't support Type Alias of function types. 51 // MSVC 2013 doesn't support Type Alias of function types.
52 // Revisit this after we update it to newer version. 52 // Revisit this after we update it to newer version.
53 typedef R RunType(Args...); 53 typedef R RunType(Args...);
54 54
55 explicit RunnableAdapter(R(__fastcall *function)(Args...)) 55 explicit RunnableAdapter(R(__fastcall *function)(Args...))
56 : function_(function) { 56 : function_(function) {
57 } 57 }
58 58
59 template <typename... RunArgs> 59 template <typename... RunArgs>
60 R Run(RunArgs&&... args) { 60 R Run(RunArgs&&... args) const {
61 return function_(std::forward<RunArgs>(args)...); 61 return function_(std::forward<RunArgs>(args)...);
62 } 62 }
63 63
64 private: 64 private:
65 R (__fastcall *function_)(Args...); 65 R (__fastcall *function_)(Args...);
66 }; 66 };
67 67
68 } // namespace internal 68 } // namespace internal
69 } // namespace base 69 } // namespace base
70 70
71 #endif // !defined(ARCH_CPU_X86_64) 71 #endif // !defined(ARCH_CPU_X86_64)
72 72
73 #endif // BASE_BIND_INTERNAL_WIN_H_ 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