OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 11 matching lines...) Expand all Loading... |
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef WTF_Functional_h | 26 #ifndef WTF_Functional_h |
27 #define WTF_Functional_h | 27 #define WTF_Functional_h |
28 | 28 |
29 #include "base/tuple.h" | 29 #include "base/tuple.h" |
30 #include "wtf/Allocator.h" | 30 #include "wtf/Allocator.h" |
31 #include "wtf/Assertions.h" | 31 #include "wtf/Assertions.h" |
| 32 #include "wtf/PassOwnPtr.h" |
32 #include "wtf/PassRefPtr.h" | 33 #include "wtf/PassRefPtr.h" |
33 #include "wtf/PtrUtil.h" | 34 #include "wtf/PtrUtil.h" |
34 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
35 #include "wtf/ThreadSafeRefCounted.h" | 36 #include "wtf/ThreadSafeRefCounted.h" |
36 #include "wtf/TypeTraits.h" | 37 #include "wtf/TypeTraits.h" |
37 #include "wtf/WeakPtr.h" | 38 #include "wtf/WeakPtr.h" |
38 #include <tuple> | 39 #include <tuple> |
39 #include <utility> | 40 #include <utility> |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 { | 161 { |
161 } | 162 } |
162 | 163 |
163 template <typename... IncomingParameters> | 164 template <typename... IncomingParameters> |
164 R operator()(C* c, IncomingParameters&&... parameters) | 165 R operator()(C* c, IncomingParameters&&... parameters) |
165 { | 166 { |
166 return (c->*m_function)(std::forward<IncomingParameters>(parameters)...)
; | 167 return (c->*m_function)(std::forward<IncomingParameters>(parameters)...)
; |
167 } | 168 } |
168 | 169 |
169 template <typename... IncomingParameters> | 170 template <typename... IncomingParameters> |
| 171 R operator()(const PassOwnPtr<C>& c, IncomingParameters&&... parameters) |
| 172 { |
| 173 return (c.get()->*m_function)(std::forward<IncomingParameters>(parameter
s)...); |
| 174 } |
| 175 |
| 176 template <typename... IncomingParameters> |
170 R operator()(const std::unique_ptr<C>& c, IncomingParameters&&... parameters
) | 177 R operator()(const std::unique_ptr<C>& c, IncomingParameters&&... parameters
) |
171 { | 178 { |
172 return (c.get()->*m_function)(std::forward<IncomingParameters>(parameter
s)...); | 179 return (c.get()->*m_function)(std::forward<IncomingParameters>(parameter
s)...); |
173 } | 180 } |
174 | 181 |
175 template <typename... IncomingParameters> | 182 template <typename... IncomingParameters> |
176 R operator()(const WeakPtr<C>& c, IncomingParameters&&... parameters) | 183 R operator()(const WeakPtr<C>& c, IncomingParameters&&... parameters) |
177 { | 184 { |
178 C* obj = c.get(); | 185 C* obj = c.get(); |
179 if (!obj) | 186 if (!obj) |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 376 |
370 } // namespace WTF | 377 } // namespace WTF |
371 | 378 |
372 using WTF::passed; | 379 using WTF::passed; |
373 using WTF::Function; | 380 using WTF::Function; |
374 using WTF::bind; | 381 using WTF::bind; |
375 using WTF::SameThreadClosure; | 382 using WTF::SameThreadClosure; |
376 using WTF::CrossThreadClosure; | 383 using WTF::CrossThreadClosure; |
377 | 384 |
378 #endif // WTF_Functional_h | 385 #endif // WTF_Functional_h |
OLD | NEW |