OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/callback_internal.h" | 8 #include "base/callback_internal.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // White-box testpoints to inject into a Callback<> object for checking | 29 // White-box testpoints to inject into a Callback<> object for checking |
30 // comparators and emptiness APIs. Use a BindState that is specialized | 30 // comparators and emptiness APIs. Use a BindState that is specialized |
31 // based on a type we declared in the anonymous namespace above to remove any | 31 // based on a type we declared in the anonymous namespace above to remove any |
32 // chance of colliding with another instantiation and breaking the | 32 // chance of colliding with another instantiation and breaking the |
33 // one-definition-rule. | 33 // one-definition-rule. |
34 template <> | 34 template <> |
35 struct BindState<void(void), void(void), void(FakeInvoker)> | 35 struct BindState<void(void), void(void), void(FakeInvoker)> |
36 : public BindStateBase { | 36 : public BindStateBase { |
37 public: | 37 public: |
38 typedef FakeInvoker InvokerType; | 38 typedef FakeInvoker InvokerType; |
| 39 private: |
| 40 ~BindState() override {} |
39 }; | 41 }; |
40 | 42 |
41 template <> | 43 template <> |
42 struct BindState<void(void), void(void), | 44 struct BindState<void(void), void(void), |
43 void(FakeInvoker, FakeInvoker)> | 45 void(FakeInvoker, FakeInvoker)> |
44 : public BindStateBase { | 46 : public BindStateBase { |
45 public: | 47 public: |
46 typedef FakeInvoker InvokerType; | 48 typedef FakeInvoker InvokerType; |
| 49 private: |
| 50 ~BindState() override {} |
47 }; | 51 }; |
48 } // namespace internal | 52 } // namespace internal |
49 | 53 |
50 namespace { | 54 namespace { |
51 | 55 |
52 typedef internal::BindState<void(void), void(void), void(FakeInvoker)> | 56 typedef internal::BindState<void(void), void(void), void(FakeInvoker)> |
53 FakeBindState1; | 57 FakeBindState1; |
54 typedef internal::BindState<void(void), void(void), | 58 typedef internal::BindState<void(void), void(void), |
55 void(FakeInvoker, FakeInvoker)> | 59 void(FakeInvoker, FakeInvoker)> |
56 FakeBindState2; | 60 FakeBindState2; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 176 |
173 TEST_F(CallbackTest, CallbackHasLastRefOnContainingObject) { | 177 TEST_F(CallbackTest, CallbackHasLastRefOnContainingObject) { |
174 bool deleted = false; | 178 bool deleted = false; |
175 CallbackOwner* owner = new CallbackOwner(&deleted); | 179 CallbackOwner* owner = new CallbackOwner(&deleted); |
176 owner->Reset(); | 180 owner->Reset(); |
177 ASSERT_TRUE(deleted); | 181 ASSERT_TRUE(deleted); |
178 } | 182 } |
179 | 183 |
180 } // namespace | 184 } // namespace |
181 } // namespace base | 185 } // namespace base |
OLD | NEW |