| OLD | NEW |
| 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 #ifndef BASE_CALLBACK_FORWARD_H_ | 5 #ifndef BASE_CALLBACK_FORWARD_H_ |
| 6 #define BASE_CALLBACK_FORWARD_H_ | 6 #define BASE_CALLBACK_FORWARD_H_ |
| 7 | 7 |
| 8 namespace base { | 8 namespace base { |
| 9 namespace internal { | 9 namespace internal { |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 internal::RepeatMode::Once>; | 38 internal::RepeatMode::Once>; |
| 39 template <typename Signature> | 39 template <typename Signature> |
| 40 using RepeatingCallback = Callback<Signature, | 40 using RepeatingCallback = Callback<Signature, |
| 41 internal::CopyMode::Copyable, | 41 internal::CopyMode::Copyable, |
| 42 internal::RepeatMode::Repeating>; | 42 internal::RepeatMode::Repeating>; |
| 43 using OnceClosure = OnceCallback<void()>; | 43 using OnceClosure = OnceCallback<void()>; |
| 44 using RepeatingClosure = RepeatingCallback<void()>; | 44 using RepeatingClosure = RepeatingCallback<void()>; |
| 45 | 45 |
| 46 } // namespace base | 46 } // namespace base |
| 47 | 47 |
| 48 namespace base { |
| 49 namespace dupe { |
| 50 namespace internal { |
| 51 |
| 52 // CopyMode is used to control the copyablity of a Callback. |
| 53 // MoveOnly indicates the Callback is not copyable but movable, and Copyable |
| 54 // indicates it is copyable and movable. |
| 55 enum class CopyMode { |
| 56 MoveOnly, |
| 57 Copyable, |
| 58 }; |
| 59 |
| 60 enum class RepeatMode { |
| 61 Once, |
| 62 Repeating, |
| 63 }; |
| 64 |
| 65 } // namespace internal |
| 66 |
| 67 template <typename Signature, |
| 68 internal::CopyMode copy_mode = internal::CopyMode::Copyable, |
| 69 internal::RepeatMode repeat_mode = internal::RepeatMode::Repeating> |
| 70 class Callback; |
| 71 |
| 72 // Syntactic sugar to make Callback<void()> easier to declare since it |
| 73 // will be used in a lot of APIs with delayed execution. |
| 74 using Closure = Callback<void()>; |
| 75 |
| 76 template <typename Signature> |
| 77 using OnceCallback = Callback<Signature, |
| 78 internal::CopyMode::MoveOnly, |
| 79 internal::RepeatMode::Once>; |
| 80 template <typename Signature> |
| 81 using RepeatingCallback = Callback<Signature, |
| 82 internal::CopyMode::Copyable, |
| 83 internal::RepeatMode::Repeating>; |
| 84 using OnceClosure = OnceCallback<void()>; |
| 85 using RepeatingClosure = RepeatingCallback<void()>; |
| 86 |
| 87 } |
| 88 } // namespace base |
| 48 #endif // BASE_CALLBACK_FORWARD_H_ | 89 #endif // BASE_CALLBACK_FORWARD_H_ |
| OLD | NEW |