Chromium Code Reviews| Index: base/callback_internal.h |
| diff --git a/base/callback_internal.h b/base/callback_internal.h |
| index afed81c843e408c01076d92691f81fb9153298e0..f7501f96c5d737f0a0be70590743c45e6b05329a 100644 |
| --- a/base/callback_internal.h |
| +++ b/base/callback_internal.h |
| @@ -36,9 +36,9 @@ class BASE_EXPORT BindStateBase { |
| protected: |
| BindStateBase(InvokeFuncStorage polymorphic_invoke, |
| - void (*destructor)(BindStateBase*)); |
| + void (*destructor)(const BindStateBase*)); |
| BindStateBase(InvokeFuncStorage polymorphic_invoke, |
| - void (*destructor)(BindStateBase*), |
| + void (*destructor)(const BindStateBase*), |
| bool (*is_cancelled)(const BindStateBase*)); |
| ~BindStateBase() = default; |
| @@ -51,8 +51,8 @@ class BASE_EXPORT BindStateBase { |
| return is_cancelled_(this); |
| } |
| - void AddRef(); |
| - void Release(); |
| + void AddRef() const; |
| + void Release() const; |
|
Yuta Kitamura
2016/09/20 10:04:21
I'm not sure adding const to these is legit. In my
tzik
2016/09/20 10:54:30
The refcount is not a state of the instance, but a
Yuta Kitamura
2016/09/21 06:01:36
Ah okay, this lets us refcount const objects, righ
|
| // In C++, it is safe to cast function pointers to function pointers of |
| // another type. It is not okay to use void*. We create a InvokeFuncStorage |
| @@ -60,10 +60,10 @@ class BASE_EXPORT BindStateBase { |
| // the original type on usage. |
| InvokeFuncStorage polymorphic_invoke_; |
| - AtomicRefCount ref_count_; |
| + mutable AtomicRefCount ref_count_; |
| // Pointer to a function that will properly destroy |this|. |
| - void (*destructor_)(BindStateBase*); |
| + void (*destructor_)(const BindStateBase*); |
| bool (*is_cancelled_)(const BindStateBase*); |
| DISALLOW_COPY_AND_ASSIGN(BindStateBase); |