| 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 | 10 |
| 10 template <typename Sig> | 11 // CopyMode is used to control the copyablity of a Callback. |
| 12 // MoveOnly indicates the Callback is not copyable but movable, and Copyable |
| 13 // indicates it is copyable and movable. |
| 14 enum class CopyMode { |
| 15 MoveOnly, Copyable, |
| 16 }; |
| 17 |
| 18 } // namespace internal |
| 19 |
| 20 template <typename Signature, |
| 21 internal::CopyMode copy_mode = internal::CopyMode::Copyable> |
| 11 class Callback; | 22 class Callback; |
| 12 | 23 |
| 13 // Syntactic sugar to make Callback<void()> easier to declare since it | 24 // Syntactic sugar to make Callback<void()> easier to declare since it |
| 14 // will be used in a lot of APIs with delayed execution. | 25 // will be used in a lot of APIs with delayed execution. |
| 15 using Closure = Callback<void()>; | 26 using Closure = Callback<void()>; |
| 16 | 27 |
| 17 } // namespace base | 28 } // namespace base |
| 18 | 29 |
| 19 #endif // BASE_CALLBACK_FORWARD_H_ | 30 #endif // BASE_CALLBACK_FORWARD_H_ |
| OLD | NEW |