Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 { | 222 { |
| 223 DCHECK(m_threadChecker.CalledOnValidThread()); | 223 DCHECK(m_threadChecker.CalledOnValidThread()); |
| 224 } | 224 } |
| 225 | 225 |
| 226 R operator()(Args... args) | 226 R operator()(Args... args) |
| 227 { | 227 { |
| 228 DCHECK(m_threadChecker.CalledOnValidThread()); | 228 DCHECK(m_threadChecker.CalledOnValidThread()); |
| 229 return m_callback.Run(std::forward<Args>(args)...); | 229 return m_callback.Run(std::forward<Args>(args)...); |
| 230 } | 230 } |
| 231 | 231 |
| 232 explicit operator base::Callback<R(Args...)>() | 232 friend base::Callback<R(Args...)> convertToBaseCallback(std::unique_ptr<Func tion> function) |
|
hiroshige
2016/07/08 05:42:04
Just checking: is this syntax allowed in the Blink
tzik
2016/07/08 05:53:50
I think so. I found nothing that bans this in our
| |
| 233 { | 233 { |
| 234 return m_callback; | 234 return std::move(function->m_callback); |
| 235 } | 235 } |
| 236 | 236 |
| 237 private: | 237 private: |
| 238 using MaybeThreadChecker = typename std::conditional< | 238 using MaybeThreadChecker = typename std::conditional< |
| 239 threadAffinity == SameThreadAffinity, | 239 threadAffinity == SameThreadAffinity, |
| 240 base::ThreadChecker, | 240 base::ThreadChecker, |
| 241 base::ThreadCheckerDoNothing>::type; | 241 base::ThreadCheckerDoNothing>::type; |
| 242 MaybeThreadChecker m_threadChecker; | 242 MaybeThreadChecker m_threadChecker; |
| 243 base::Callback<R(Args...)> m_callback; | 243 base::Callback<R(Args...)> m_callback; |
| 244 }; | 244 }; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 262 } // namespace WTF | 262 } // namespace WTF |
| 263 | 263 |
| 264 using WTF::passed; | 264 using WTF::passed; |
| 265 using WTF::unretained; | 265 using WTF::unretained; |
| 266 using WTF::crossThreadUnretained; | 266 using WTF::crossThreadUnretained; |
| 267 | 267 |
| 268 using WTF::Function; | 268 using WTF::Function; |
| 269 using WTF::CrossThreadClosure; | 269 using WTF::CrossThreadClosure; |
| 270 | 270 |
| 271 #endif // WTF_Functional_h | 271 #endif // WTF_Functional_h |
| OLD | NEW |