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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 ~CallbackBase() {} | 130 ~CallbackBase() {} |
129 }; | 131 }; |
130 | 132 |
131 extern template class CallbackBase<CopyMode::MoveOnly>; | 133 extern template class CallbackBase<CopyMode::MoveOnly>; |
132 extern template class CallbackBase<CopyMode::Copyable>; | 134 extern template class CallbackBase<CopyMode::Copyable>; |
133 | 135 |
134 } // namespace internal | 136 } // namespace internal |
135 } // namespace base | 137 } // namespace base |
136 | 138 |
137 #endif // BASE_CALLBACK_INTERNAL_H_ | 139 #endif // BASE_CALLBACK_INTERNAL_H_ |
OLD | NEW |