OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009-2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009-2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // ptr->member(p1, ..., pn); | 73 // ptr->member(p1, ..., pn); |
74 // | 74 // |
75 // ExecutionContext: | 75 // ExecutionContext: |
76 // |context| is supplied by the target thread. | 76 // |context| is supplied by the target thread. |
77 // | 77 // |
78 // Deep copies by threadSafeBind(): | 78 // Deep copies by threadSafeBind(): |
79 // |ptr|, |p1|, ..., |pn| are processed by threadSafeBind() and thus | 79 // |ptr|, |p1|, ..., |pn| are processed by threadSafeBind() and thus |
80 // CrossThreadCopier. | 80 // CrossThreadCopier. |
81 // You don't have to call manually e.g. isolatedCopy(). | 81 // You don't have to call manually e.g. isolatedCopy(). |
82 // To pass things that cannot be copied by CrossThreadCopier | 82 // To pass things that cannot be copied by CrossThreadCopier |
83 // (e.g. pointers), use AllowCrossThreadAccess() explicitly. | 83 // (e.g. pointers), use crossThreadUnretained() explicitly. |
84 | 84 |
85 // RETTYPE, PS, and MPS are added as template parameters to circumvent MSVC 18.0
0.21005.1 (VS 2013) issues. | 85 // RETTYPE, PS, and MPS are added as template parameters to circumvent MSVC 18.0
0.21005.1 (VS 2013) issues. |
86 | 86 |
87 template<typename FunctionType, typename... P, | 87 template<typename FunctionType, typename... P, |
88 typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof
...(P), size_t MPS = WTF::FunctionWrapper<FunctionType>::numberOfArguments> | 88 typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof
...(P), size_t MPS = WTF::FunctionWrapper<FunctionType>::numberOfArguments> |
89 typename std::enable_if<PS + 1 == MPS, RETTYPE>::type createCrossThreadTask(Func
tionType function, P&&... parameters) | 89 typename std::enable_if<PS + 1 == MPS, RETTYPE>::type createCrossThreadTask(Func
tionType function, P&&... parameters) |
90 { | 90 { |
91 return internal::createCallClosureTask(threadSafeBind(function, std::forward
<P>(parameters)...)); | 91 return internal::createCallClosureTask(threadSafeBind(function, std::forward
<P>(parameters)...)); |
92 } | 92 } |
93 | 93 |
94 template<typename FunctionType, typename... P, | 94 template<typename FunctionType, typename... P, |
95 typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof
...(P), size_t MPS = WTF::FunctionWrapper<FunctionType>::numberOfArguments> | 95 typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof
...(P), size_t MPS = WTF::FunctionWrapper<FunctionType>::numberOfArguments> |
96 typename std::enable_if<PS == MPS, RETTYPE>::type createCrossThreadTask(Function
Type function, P&&... parameters) | 96 typename std::enable_if<PS == MPS, RETTYPE>::type createCrossThreadTask(Function
Type function, P&&... parameters) |
97 { | 97 { |
98 return internal::createCallClosureTask(threadSafeBind(function, std::forward
<P>(parameters)...)); | 98 return internal::createCallClosureTask(threadSafeBind(function, std::forward
<P>(parameters)...)); |
99 } | 99 } |
100 | 100 |
101 } // namespace blink | 101 } // namespace blink |
102 | 102 |
103 #endif // CrossThreadTask_h | 103 #endif // CrossThreadTask_h |
OLD | NEW |