| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains utility functions and classes that help the | 5 // This file contains utility functions and classes that help the |
| 6 // implementation, and management of the Callback objects. | 6 // implementation, and management of the Callback objects. |
| 7 | 7 |
| 8 #ifndef BASE_CALLBACK_INTERNAL_H_ | 8 #ifndef BASE_CALLBACK_INTERNAL_H_ |
| 9 #define BASE_CALLBACK_INTERNAL_H_ | 9 #define BASE_CALLBACK_INTERNAL_H_ |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // RefCountedThreadSafe since it requires the destructor to be a virtual method. | 29 // RefCountedThreadSafe since it requires the destructor to be a virtual method. |
| 30 // Creating a vtable for every BindState template instantiation results in a lot | 30 // Creating a vtable for every BindState template instantiation results in a lot |
| 31 // of bloat. Its only task is to call the destructor which can be done with a | 31 // of bloat. Its only task is to call the destructor which can be done with a |
| 32 // function pointer. | 32 // function pointer. |
| 33 class BASE_EXPORT BindStateBase { | 33 class BASE_EXPORT BindStateBase { |
| 34 public: | 34 public: |
| 35 using InvokeFuncStorage = void(*)(); | 35 using InvokeFuncStorage = void(*)(); |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 BindStateBase(InvokeFuncStorage polymorphic_invoke, | 38 BindStateBase(InvokeFuncStorage polymorphic_invoke, |
| 39 void (*destructor)(BindStateBase*)); |
| 40 BindStateBase(InvokeFuncStorage polymorphic_invoke, |
| 39 void (*destructor)(BindStateBase*), | 41 void (*destructor)(BindStateBase*), |
| 40 bool (*is_cancelled)(const BindStateBase*)); | 42 bool (*is_cancelled)(const BindStateBase*)); |
| 41 ~BindStateBase() = default; | 43 ~BindStateBase() = default; |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 friend class scoped_refptr<BindStateBase>; | 46 friend class scoped_refptr<BindStateBase>; |
| 45 template <CopyMode copy_mode> | 47 template <CopyMode copy_mode> |
| 46 friend class CallbackBase; | 48 friend class CallbackBase; |
| 47 | 49 |
| 48 bool IsCancelled() const { | 50 bool IsCancelled() const { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 ~CallbackBase() {} | 127 ~CallbackBase() {} |
| 126 }; | 128 }; |
| 127 | 129 |
| 128 extern template class CallbackBase<CopyMode::MoveOnly>; | 130 extern template class CallbackBase<CopyMode::MoveOnly>; |
| 129 extern template class CallbackBase<CopyMode::Copyable>; | 131 extern template class CallbackBase<CopyMode::Copyable>; |
| 130 | 132 |
| 131 } // namespace internal | 133 } // namespace internal |
| 132 } // namespace base | 134 } // namespace base |
| 133 | 135 |
| 134 #endif // BASE_CALLBACK_INTERNAL_H_ | 136 #endif // BASE_CALLBACK_INTERNAL_H_ |
| OLD | NEW |