| 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 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 class HasRefPrivateDtor : public HasRef { | 56 class HasRefPrivateDtor : public HasRef { |
| 57 private: | 57 private: |
| 58 ~HasRefPrivateDtor() {} | 58 ~HasRefPrivateDtor() {} |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 static const int kParentValue = 1; | 61 static const int kParentValue = 1; |
| 62 static const int kChildValue = 2; | 62 static const int kChildValue = 2; |
| 63 | 63 |
| 64 class Parent { | 64 class Parent { |
| 65 public: | 65 public: |
| 66 virtual ~Parent() = default; |
| 66 void AddRef() const {} | 67 void AddRef() const {} |
| 67 void Release() const {} | 68 void Release() const {} |
| 68 virtual void VirtualSet() { value = kParentValue; } | 69 virtual void VirtualSet() { value = kParentValue; } |
| 69 void NonVirtualSet() { value = kParentValue; } | 70 void NonVirtualSet() { value = kParentValue; } |
| 70 int value; | 71 int value; |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 class Child : public Parent { | 74 class Child : public Parent { |
| 74 public: | 75 public: |
| 76 ~Child() override = default; |
| 75 void VirtualSet() override { value = kChildValue; } | 77 void VirtualSet() override { value = kChildValue; } |
| 76 void NonVirtualSet() { value = kChildValue; } | 78 void NonVirtualSet() { value = kChildValue; } |
| 77 }; | 79 }; |
| 78 | 80 |
| 79 class NoRefParent { | 81 class NoRefParent { |
| 80 public: | 82 public: |
| 83 virtual ~NoRefParent() = default; |
| 81 virtual void VirtualSet() { value = kParentValue; } | 84 virtual void VirtualSet() { value = kParentValue; } |
| 82 void NonVirtualSet() { value = kParentValue; } | 85 void NonVirtualSet() { value = kParentValue; } |
| 83 int value; | 86 int value; |
| 84 }; | 87 }; |
| 85 | 88 |
| 86 class NoRefChild : public NoRefParent { | 89 class NoRefChild : public NoRefParent { |
| 90 public: |
| 91 ~NoRefChild() override = default; |
| 87 void VirtualSet() override { value = kChildValue; } | 92 void VirtualSet() override { value = kChildValue; } |
| 88 void NonVirtualSet() { value = kChildValue; } | 93 void NonVirtualSet() { value = kChildValue; } |
| 89 }; | 94 }; |
| 90 | 95 |
| 91 // Used for probing the number of copies and moves that occur if a type must be | 96 // Used for probing the number of copies and moves that occur if a type must be |
| 92 // coerced during argument forwarding in the Run() methods. | 97 // coerced during argument forwarding in the Run() methods. |
| 93 struct DerivedCopyMoveCounter { | 98 struct DerivedCopyMoveCounter { |
| 94 DerivedCopyMoveCounter(int* copies, | 99 DerivedCopyMoveCounter(int* copies, |
| 95 int* assigns, | 100 int* assigns, |
| 96 int* move_constructs, | 101 int* move_constructs, |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 base::Callback<void(int)> null_cb; | 1099 base::Callback<void(int)> null_cb; |
| 1095 ASSERT_TRUE(null_cb.is_null()); | 1100 ASSERT_TRUE(null_cb.is_null()); |
| 1096 EXPECT_DEATH(base::Bind(null_cb, 42), ""); | 1101 EXPECT_DEATH(base::Bind(null_cb, 42), ""); |
| 1097 } | 1102 } |
| 1098 | 1103 |
| 1099 #endif // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && | 1104 #endif // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && |
| 1100 // GTEST_HAS_DEATH_TEST | 1105 // GTEST_HAS_DEATH_TEST |
| 1101 | 1106 |
| 1102 } // namespace | 1107 } // namespace |
| 1103 } // namespace base | 1108 } // namespace base |
| OLD | NEW |