| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_H_ | 5 #ifndef BASE_CALLBACK_H_ |
| 6 #define BASE_CALLBACK_H_ | 6 #define BASE_CALLBACK_H_ |
| 7 | 7 |
| 8 #include "base/tuple.h" | 8 #include "base/tuple.h" |
| 9 #include "base/raw_scoped_refptr_mismatch_checker.h" | 9 #include "base/raw_scoped_refptr_mismatch_checker.h" |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 DispatchToMethod(this->obj_, this->meth_, params); | 118 DispatchToMethod(this->obj_, this->meth_, params); |
| 119 } | 119 } |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 // 0-arg implementation | 122 // 0-arg implementation |
| 123 struct Callback0 { | 123 struct Callback0 { |
| 124 typedef CallbackRunner<Tuple0> Type; | 124 typedef CallbackRunner<Tuple0> Type; |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 template <class T> | 127 template <class T> |
| 128 Callback0::Type* NewCallback(T* object, void (T::*method)()) { | 128 typename Callback0::Type* NewCallback(T* object, void (T::*method)()) { |
| 129 return new CallbackImpl<T, void (T::*)(), Tuple0 >(object, method); | 129 return new CallbackImpl<T, void (T::*)(), Tuple0 >(object, method); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // 1-arg implementation | 132 // 1-arg implementation |
| 133 template <typename Arg1> | 133 template <typename Arg1> |
| 134 struct Callback1 { | 134 struct Callback1 { |
| 135 typedef CallbackRunner<Tuple1<Arg1> > Type; | 135 typedef CallbackRunner<Tuple1<Arg1> > Type; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 template <class T, typename Arg1> | 138 template <class T, typename Arg1> |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 template <class T, typename ReturnValue> | 245 template <class T, typename ReturnValue> |
| 246 typename CallbackWithReturnValue<ReturnValue>::Type* | 246 typename CallbackWithReturnValue<ReturnValue>::Type* |
| 247 NewCallbackWithReturnValue(T* object, ReturnValue (T::*method)()) { | 247 NewCallbackWithReturnValue(T* object, ReturnValue (T::*method)()) { |
| 248 return new CallbackWithReturnValueImpl<T, ReturnValue (T::*)(), ReturnValue>( | 248 return new CallbackWithReturnValueImpl<T, ReturnValue (T::*)(), ReturnValue>( |
| 249 object, method); | 249 object, method); |
| 250 } | 250 } |
| 251 | 251 |
| 252 #endif // BASE_CALLBACK_H | 252 #endif // BASE_CALLBACK_H |
| OLD | NEW |