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

Side by Side Diff: base/bind_internal.h

Issue 2344143002: Add const to BindStateBase to align RefCounted constness (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 | base/callback_internal.h » ('j') | base/callback_internal.h » ('J')
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 ForwardFunctor&& functor, 463 ForwardFunctor&& functor,
464 ForwardBoundArgs&&... bound_args) 464 ForwardBoundArgs&&... bound_args)
465 : BindStateBase(invoke_func, &Destroy), 465 : BindStateBase(invoke_func, &Destroy),
466 functor_(std::forward<ForwardFunctor>(functor)), 466 functor_(std::forward<ForwardFunctor>(functor)),
467 bound_args_(std::forward<ForwardBoundArgs>(bound_args)...) { 467 bound_args_(std::forward<ForwardBoundArgs>(bound_args)...) {
468 DCHECK(!IsNull(functor_)); 468 DCHECK(!IsNull(functor_));
469 } 469 }
470 470
471 ~BindState() {} 471 ~BindState() {}
472 472
473 static void Destroy(BindStateBase* self) { 473 static void Destroy(const BindStateBase* self) {
474 delete static_cast<BindState*>(self); 474 delete static_cast<const BindState*>(self);
475 } 475 }
476 }; 476 };
477 477
478 // Used to implement MakeBindStateType. 478 // Used to implement MakeBindStateType.
479 template <bool is_method, typename Functor, typename... BoundArgs> 479 template <bool is_method, typename Functor, typename... BoundArgs>
480 struct MakeBindStateTypeImpl; 480 struct MakeBindStateTypeImpl;
481 481
482 template <typename Functor, typename... BoundArgs> 482 template <typename Functor, typename... BoundArgs>
483 struct MakeBindStateTypeImpl<false, Functor, BoundArgs...> { 483 struct MakeBindStateTypeImpl<false, Functor, BoundArgs...> {
484 static_assert(!HasRefCountedTypeAsRawPtr<BoundArgs...>::value, 484 static_assert(!HasRefCountedTypeAsRawPtr<BoundArgs...>::value,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 523
524 // Returns a RunType of bound functor. 524 // Returns a RunType of bound functor.
525 // E.g. MakeUnboundRunType<R(A, B, C), A, B> is evaluated to R(C). 525 // E.g. MakeUnboundRunType<R(A, B, C), A, B> is evaluated to R(C).
526 template <typename Functor, typename... BoundArgs> 526 template <typename Functor, typename... BoundArgs>
527 using MakeUnboundRunType = 527 using MakeUnboundRunType =
528 typename internal::MakeUnboundRunTypeImpl<Functor, BoundArgs...>::Type; 528 typename internal::MakeUnboundRunTypeImpl<Functor, BoundArgs...>::Type;
529 529
530 } // namespace base 530 } // namespace base
531 531
532 #endif // BASE_BIND_INTERNAL_H_ 532 #endif // BASE_BIND_INTERNAL_H_
OLDNEW
« no previous file with comments | « no previous file | base/callback_internal.h » ('j') | base/callback_internal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698