Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BIND_INTERNAL_H_ | 5 #ifndef BASE_BIND_INTERNAL_H_ |
| 6 #define BASE_BIND_INTERNAL_H_ | 6 #define BASE_BIND_INTERNAL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 std::forward<Runnable>(runnable).Run(std::forward<RunArgs>(args)...); | 312 std::forward<Runnable>(runnable).Run(std::forward<RunArgs>(args)...); |
| 313 } | 313 } |
| 314 }; | 314 }; |
| 315 | 315 |
| 316 template <> | 316 template <> |
| 317 struct InvokeHelper<true, void> { | 317 struct InvokeHelper<true, void> { |
| 318 template <typename Runnable, typename BoundWeakPtr, typename... RunArgs> | 318 template <typename Runnable, typename BoundWeakPtr, typename... RunArgs> |
| 319 static void MakeItSo(Runnable&& runnable, | 319 static void MakeItSo(Runnable&& runnable, |
| 320 BoundWeakPtr weak_ptr, | 320 BoundWeakPtr weak_ptr, |
| 321 RunArgs&&... args) { | 321 RunArgs&&... args) { |
| 322 if (!weak_ptr.get()) { | 322 if (!weak_ptr) { |
| 323 return; | 323 return; |
| 324 } | 324 } |
| 325 std::forward<Runnable>(runnable).Run( | 325 std::forward<Runnable>(runnable).Run( |
| 326 weak_ptr.get(), std::forward<RunArgs>(args)...); | 326 weak_ptr, std::forward<RunArgs>(args)...); |
|
danakj
2016/06/10 23:36:18
I had to look at a bunch of places to understand w
tzik
2016/06/14 12:06:10
Done.
| |
| 327 } | 327 } |
| 328 }; | 328 }; |
| 329 | 329 |
| 330 #if !defined(_MSC_VER) | 330 #if !defined(_MSC_VER) |
| 331 | 331 |
| 332 template <typename ReturnType> | 332 template <typename ReturnType> |
| 333 struct InvokeHelper<true, ReturnType> { | 333 struct InvokeHelper<true, ReturnType> { |
| 334 // WeakCalls are only supported for functions with a void return type. | 334 // WeakCalls are only supported for functions with a void return type. |
| 335 // Otherwise, the function result would be undefined if the the WeakPtr<> | 335 // Otherwise, the function result would be undefined if the the WeakPtr<> |
| 336 // is invalidated. | 336 // is invalidated. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 | 437 |
| 438 static void Destroy(BindStateBase* self) { | 438 static void Destroy(BindStateBase* self) { |
| 439 delete static_cast<BindState*>(self); | 439 delete static_cast<BindState*>(self); |
| 440 } | 440 } |
| 441 }; | 441 }; |
| 442 | 442 |
| 443 } // namespace internal | 443 } // namespace internal |
| 444 } // namespace base | 444 } // namespace base |
| 445 | 445 |
| 446 #endif // BASE_BIND_INTERNAL_H_ | 446 #endif // BASE_BIND_INTERNAL_H_ |
| OLD | NEW |