| 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 <type_traits> | 11 #include <type_traits> |
| 11 | 12 |
| 12 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 13 #include "base/callback_internal.h" | 14 #include "base/callback_internal.h" |
| 14 #include "base/memory/raw_scoped_refptr_mismatch_checker.h" | 15 #include "base/memory/raw_scoped_refptr_mismatch_checker.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/template_util.h" | 17 #include "base/template_util.h" |
| 17 #include "base/tuple.h" | 18 #include "base/tuple.h" |
| 18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 19 | 20 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 struct Invoker<IndexSequence<bound_indices...>, | 355 struct Invoker<IndexSequence<bound_indices...>, |
| 355 StorageType, | 356 StorageType, |
| 356 is_weak_call, | 357 is_weak_call, |
| 357 R(UnboundArgs...)> { | 358 R(UnboundArgs...)> { |
| 358 static R Run(BindStateBase* base, UnboundArgs&&... unbound_args) { | 359 static R Run(BindStateBase* base, UnboundArgs&&... unbound_args) { |
| 359 StorageType* storage = static_cast<StorageType*>(base); | 360 StorageType* storage = static_cast<StorageType*>(base); |
| 360 // Local references to make debugger stepping easier. If in a debugger, | 361 // Local references to make debugger stepping easier. If in a debugger, |
| 361 // you really want to warp ahead and step through the | 362 // you really want to warp ahead and step through the |
| 362 // InvokeHelper<>::MakeItSo() call below. | 363 // InvokeHelper<>::MakeItSo() call below. |
| 363 return InvokeHelper<is_weak_call, R>::MakeItSo( | 364 return InvokeHelper<is_weak_call, R>::MakeItSo( |
| 364 storage->runnable_, Unwrap(get<bound_indices>(storage->bound_args_))..., | 365 storage->runnable_, |
| 366 Unwrap(std::get<bound_indices>(storage->bound_args_))..., |
| 365 std::forward<UnboundArgs>(unbound_args)...); | 367 std::forward<UnboundArgs>(unbound_args)...); |
| 366 } | 368 } |
| 367 }; | 369 }; |
| 368 | 370 |
| 369 // Used to implement MakeArgsStorage. | 371 // Used to implement MakeArgsStorage. |
| 370 template <bool is_method, typename... BoundArgs> | 372 template <bool is_method, typename... BoundArgs> |
| 371 struct MakeArgsStorageImpl { | 373 struct MakeArgsStorageImpl { |
| 372 using Type = std::tuple<BoundArgs...>; | 374 using Type = std::tuple<BoundArgs...>; |
| 373 }; | 375 }; |
| 374 | 376 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 437 |
| 436 static void Destroy(BindStateBase* self) { | 438 static void Destroy(BindStateBase* self) { |
| 437 delete static_cast<BindState*>(self); | 439 delete static_cast<BindState*>(self); |
| 438 } | 440 } |
| 439 }; | 441 }; |
| 440 | 442 |
| 441 } // namespace internal | 443 } // namespace internal |
| 442 } // namespace base | 444 } // namespace base |
| 443 | 445 |
| 444 #endif // BASE_BIND_INTERNAL_H_ | 446 #endif // BASE_BIND_INTERNAL_H_ |
| OLD | NEW |