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

Side by Side Diff: base/bind_internal.h

Issue 2317563002: Move CallbackBase::polymorphic_invoke_ into BindStateBase (Closed)
Patch Set: rebase 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 | « base/bind.h ('k') | base/callback.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) 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 IsNull(const Functor&) { 372 IsNull(const Functor&) {
373 return false; 373 return false;
374 } 374 }
375 375
376 // BindState<> 376 // BindState<>
377 // 377 //
378 // This stores all the state passed into Bind(). 378 // This stores all the state passed into Bind().
379 template <typename Functor, typename... BoundArgs> 379 template <typename Functor, typename... BoundArgs>
380 struct BindState final : BindStateBase { 380 struct BindState final : BindStateBase {
381 template <typename ForwardFunctor, typename... ForwardBoundArgs> 381 template <typename ForwardFunctor, typename... ForwardBoundArgs>
382 explicit BindState(ForwardFunctor&& functor, ForwardBoundArgs&&... bound_args) 382 explicit BindState(BindStateBase::InvokeFuncStorage invoke_func,
383 : BindStateBase(&Destroy), 383 ForwardFunctor&& functor,
384 ForwardBoundArgs&&... bound_args)
385 : BindStateBase(invoke_func, &Destroy),
384 functor_(std::forward<ForwardFunctor>(functor)), 386 functor_(std::forward<ForwardFunctor>(functor)),
385 bound_args_(std::forward<ForwardBoundArgs>(bound_args)...) { 387 bound_args_(std::forward<ForwardBoundArgs>(bound_args)...) {
386 DCHECK(!IsNull(functor_)); 388 DCHECK(!IsNull(functor_));
387 } 389 }
388 390
389 Functor functor_; 391 Functor functor_;
390 std::tuple<BoundArgs...> bound_args_; 392 std::tuple<BoundArgs...> bound_args_;
391 393
392 private: 394 private:
393 ~BindState() {} 395 ~BindState() {}
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 447
446 // Returns a RunType of bound functor. 448 // Returns a RunType of bound functor.
447 // E.g. MakeUnboundRunType<R(A, B, C), A, B> is evaluated to R(C). 449 // E.g. MakeUnboundRunType<R(A, B, C), A, B> is evaluated to R(C).
448 template <typename Functor, typename... BoundArgs> 450 template <typename Functor, typename... BoundArgs>
449 using MakeUnboundRunType = 451 using MakeUnboundRunType =
450 typename internal::MakeUnboundRunTypeImpl<Functor, BoundArgs...>::Type; 452 typename internal::MakeUnboundRunTypeImpl<Functor, BoundArgs...>::Type;
451 453
452 } // namespace base 454 } // namespace base
453 455
454 #endif // BASE_BIND_INTERNAL_H_ 456 #endif // BASE_BIND_INTERNAL_H_
OLDNEW
« no previous file with comments | « base/bind.h ('k') | base/callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698