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 class BindStateBase : public RefCountedThreadSafe<BindStateBase> { | 29 class BindStateBase : public RefCountedThreadSafe<BindStateBase> { |
30 protected: | 30 protected: |
31 friend class RefCountedThreadSafe<BindStateBase>; | 31 friend class RefCountedThreadSafe<BindStateBase>; |
32 virtual ~BindStateBase() {} | 32 virtual ~BindStateBase() {} |
33 }; | 33 }; |
34 | 34 |
35 // Holds the Callback methods that don't require specialization to reduce | 35 // Holds the Callback methods that don't require specialization to reduce |
36 // template bloat. | 36 // template bloat. |
37 class BASE_EXPORT CallbackBase { | 37 class BASE_EXPORT CallbackBase { |
38 public: | 38 public: |
| 39 CallbackBase(const CallbackBase& c); |
| 40 CallbackBase& operator=(const CallbackBase& c); |
| 41 |
39 // Returns true if Callback is null (doesn't refer to anything). | 42 // Returns true if Callback is null (doesn't refer to anything). |
40 bool is_null() const { return bind_state_.get() == NULL; } | 43 bool is_null() const { return bind_state_.get() == NULL; } |
41 | 44 |
42 // Returns the Callback into an uninitialized state. | 45 // Returns the Callback into an uninitialized state. |
43 void Reset(); | 46 void Reset(); |
44 | 47 |
45 protected: | 48 protected: |
46 // In C++, it is safe to cast function pointers to function pointers of | 49 // In C++, it is safe to cast function pointers to function pointers of |
47 // another type. It is not okay to use void*. We create a InvokeFuncStorage | 50 // another type. It is not okay to use void*. We create a InvokeFuncStorage |
48 // that that can store our function pointer, and then cast it back to | 51 // that that can store our function pointer, and then cast it back to |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 201 |
199 template <typename T> | 202 template <typename T> |
200 typename enable_if<IsMoveOnlyType<T>::value, T>::type CallbackForward(T& t) { | 203 typename enable_if<IsMoveOnlyType<T>::value, T>::type CallbackForward(T& t) { |
201 return t.Pass(); | 204 return t.Pass(); |
202 } | 205 } |
203 | 206 |
204 } // namespace internal | 207 } // namespace internal |
205 } // namespace base | 208 } // namespace base |
206 | 209 |
207 #endif // BASE_CALLBACK_INTERNAL_H_ | 210 #endif // BASE_CALLBACK_INTERNAL_H_ |
OLD | NEW |