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

Side by Side Diff: third_party/WebKit/Source/wtf/Functional.h

Issue 2327793002: Expose base::Callback::IsCancelled via WTF::Function (Closed)
Patch Set: Created 4 years, 3 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/FunctionalTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 { 197 {
198 DCHECK(m_threadChecker.CalledOnValidThread()); 198 DCHECK(m_threadChecker.CalledOnValidThread());
199 } 199 }
200 200
201 R operator()(Args... args) 201 R operator()(Args... args)
202 { 202 {
203 DCHECK(m_threadChecker.CalledOnValidThread()); 203 DCHECK(m_threadChecker.CalledOnValidThread());
204 return m_callback.Run(std::forward<Args>(args)...); 204 return m_callback.Run(std::forward<Args>(args)...);
205 } 205 }
206 206
207 bool isCancelled() const
208 {
209 return m_callback.IsCancelled();
210 }
211
207 friend base::Callback<R(Args...)> convertToBaseCallback(std::unique_ptr<Func tion> function) 212 friend base::Callback<R(Args...)> convertToBaseCallback(std::unique_ptr<Func tion> function)
208 { 213 {
209 return std::move(function->m_callback); 214 return std::move(function->m_callback);
210 } 215 }
211 216
212 private: 217 private:
213 using MaybeThreadChecker = typename std::conditional< 218 using MaybeThreadChecker = typename std::conditional<
214 threadAffinity == SameThreadAffinity, 219 threadAffinity == SameThreadAffinity,
215 base::ThreadChecker, 220 base::ThreadChecker,
216 base::ThreadCheckerDoNothing>::type; 221 base::ThreadCheckerDoNothing>::type;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 } // namespace base 273 } // namespace base
269 274
270 using WTF::passed; 275 using WTF::passed;
271 using WTF::unretained; 276 using WTF::unretained;
272 using WTF::crossThreadUnretained; 277 using WTF::crossThreadUnretained;
273 278
274 using WTF::Function; 279 using WTF::Function;
275 using WTF::CrossThreadClosure; 280 using WTF::CrossThreadClosure;
276 281
277 #endif // WTF_Functional_h 282 #endif // WTF_Functional_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/FunctionalTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698