| 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 20 matching lines...) Expand all Loading... |
| 31 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
| 32 #include "wtf/RefPtr.h" | 32 #include "wtf/RefPtr.h" |
| 33 #include "wtf/ThreadSafeRefCounted.h" | 33 #include "wtf/ThreadSafeRefCounted.h" |
| 34 #include "wtf/WeakPtr.h" | 34 #include "wtf/WeakPtr.h" |
| 35 | 35 |
| 36 namespace WTF { | 36 namespace WTF { |
| 37 | 37 |
| 38 // Functional.h provides a very simple way to bind a function pointer and argume
nts together into a function object | 38 // Functional.h provides a very simple way to bind a function pointer and argume
nts together into a function object |
| 39 // that can be stored, copied and invoked, similar to how boost::bind and std::b
ind in C++11. | 39 // that can be stored, copied and invoked, similar to how boost::bind and std::b
ind in C++11. |
| 40 | 40 |
| 41 // Use threadSafeBind() or createCrossThreadTask() if the function/task is |
| 42 // called on a (potentially) different thread from the current thread. |
| 43 |
| 41 // A FunctionWrapper is a class template that can wrap a function pointer or a m
ember function pointer and | 44 // A FunctionWrapper is a class template that can wrap a function pointer or a m
ember function pointer and |
| 42 // provide a unified interface for calling that function. | 45 // provide a unified interface for calling that function. |
| 43 template<typename> | 46 template<typename> |
| 44 class FunctionWrapper; | 47 class FunctionWrapper; |
| 45 | 48 |
| 46 // Bound static functions: | 49 // Bound static functions: |
| 47 template<typename R, typename... P> | 50 template<typename R, typename... P> |
| 48 class FunctionWrapper<R(*)(P...)> { | 51 class FunctionWrapper<R(*)(P...)> { |
| 49 public: | 52 public: |
| 50 typedef R ResultType; | 53 typedef R ResultType; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 364 |
| 362 typedef Function<void()> Closure; | 365 typedef Function<void()> Closure; |
| 363 | 366 |
| 364 } | 367 } |
| 365 | 368 |
| 366 using WTF::Function; | 369 using WTF::Function; |
| 367 using WTF::bind; | 370 using WTF::bind; |
| 368 using WTF::Closure; | 371 using WTF::Closure; |
| 369 | 372 |
| 370 #endif // WTF_Functional_h | 373 #endif // WTF_Functional_h |
| OLD | NEW |