Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: base/callback.h

Issue 5887001: Reland 69237 - Fix raw_scoped_refptr_mismatch_checker.h.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/raw_scoped_refptr_mismatch_checker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include "base/tuple.h" 9 #include "base/tuple.h"
10 #include "base/raw_scoped_refptr_mismatch_checker.h" 10 #include "base/raw_scoped_refptr_mismatch_checker.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3, Arg4, Arg5), 199 return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3, Arg4, Arg5),
200 Tuple5<Arg1, Arg2, Arg3, Arg4, Arg5> >(object, method); 200 Tuple5<Arg1, Arg2, Arg3, Arg4, Arg5> >(object, method);
201 } 201 }
202 202
203 // An UnboundMethod is a wrapper for a method where the actual object is 203 // An UnboundMethod is a wrapper for a method where the actual object is
204 // provided at Run dispatch time. 204 // provided at Run dispatch time.
205 template <class T, class Method, class Params> 205 template <class T, class Method, class Params>
206 class UnboundMethod { 206 class UnboundMethod {
207 public: 207 public:
208 UnboundMethod(Method m, const Params& p) : m_(m), p_(p) { 208 UnboundMethod(Method m, const Params& p) : m_(m), p_(p) {
209 COMPILE_ASSERT((MethodUsesScopedRefptrCorrectly<Method, Params>::value), 209 COMPILE_ASSERT(
210 badunboundmethodparams); 210 (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value),
211 badunboundmethodparams);
211 } 212 }
212 void Run(T* obj) const { 213 void Run(T* obj) const {
213 DispatchToMethod(obj, m_, p_); 214 DispatchToMethod(obj, m_, p_);
214 } 215 }
215 private: 216 private:
216 Method m_; 217 Method m_;
217 Params p_; 218 Params p_;
218 }; 219 };
219 220
220 // Return value implementation with no args. 221 // Return value implementation with no args.
(...skipping 23 matching lines...) Expand all
244 }; 245 };
245 246
246 template <class T, typename ReturnValue> 247 template <class T, typename ReturnValue>
247 typename CallbackWithReturnValue<ReturnValue>::Type* 248 typename CallbackWithReturnValue<ReturnValue>::Type*
248 NewCallbackWithReturnValue(T* object, ReturnValue (T::*method)()) { 249 NewCallbackWithReturnValue(T* object, ReturnValue (T::*method)()) {
249 return new CallbackWithReturnValueImpl<T, ReturnValue (T::*)(), ReturnValue>( 250 return new CallbackWithReturnValueImpl<T, ReturnValue (T::*)(), ReturnValue>(
250 object, method); 251 object, method);
251 } 252 }
252 253
253 #endif // BASE_CALLBACK_H 254 #endif // BASE_CALLBACK_H
OLDNEW
« no previous file with comments | « no previous file | base/raw_scoped_refptr_mismatch_checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698