| OLD | NEW |
| 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 public: | 59 public: |
| 60 void AddRef(void) const {} | 60 void AddRef(void) const {} |
| 61 void Release(void) const {} | 61 void Release(void) const {} |
| 62 virtual void VirtualSet() { value = kParentValue; } | 62 virtual void VirtualSet() { value = kParentValue; } |
| 63 void NonVirtualSet() { value = kParentValue; } | 63 void NonVirtualSet() { value = kParentValue; } |
| 64 int value; | 64 int value; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 class Child : public Parent { | 67 class Child : public Parent { |
| 68 public: | 68 public: |
| 69 virtual void VirtualSet() { value = kChildValue; } | 69 virtual void VirtualSet() OVERRIDE { value = kChildValue; } |
| 70 void NonVirtualSet() { value = kChildValue; } | 70 void NonVirtualSet() { value = kChildValue; } |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 class NoRefParent { | 73 class NoRefParent { |
| 74 public: | 74 public: |
| 75 virtual void VirtualSet() { value = kParentValue; } | 75 virtual void VirtualSet() { value = kParentValue; } |
| 76 void NonVirtualSet() { value = kParentValue; } | 76 void NonVirtualSet() { value = kParentValue; } |
| 77 int value; | 77 int value; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 class NoRefChild : public NoRefParent { | 80 class NoRefChild : public NoRefParent { |
| 81 virtual void VirtualSet() { value = kChildValue; } | 81 virtual void VirtualSet() OVERRIDE { value = kChildValue; } |
| 82 void NonVirtualSet() { value = kChildValue; } | 82 void NonVirtualSet() { value = kChildValue; } |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 // Used for probing the number of copies that occur if a type must be coerced | 85 // Used for probing the number of copies that occur if a type must be coerced |
| 86 // during argument forwarding in the Run() methods. | 86 // during argument forwarding in the Run() methods. |
| 87 struct DerivedCopyCounter { | 87 struct DerivedCopyCounter { |
| 88 DerivedCopyCounter(int* copies, int* assigns) | 88 DerivedCopyCounter(int* copies, int* assigns) |
| 89 : copies_(copies), assigns_(assigns) { | 89 : copies_(copies), assigns_(assigns) { |
| 90 } | 90 } |
| 91 int* copies_; | 91 int* copies_; |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 Callback<int(void)> fastcall_cb = Bind(&FastCallFunc, 1); | 797 Callback<int(void)> fastcall_cb = Bind(&FastCallFunc, 1); |
| 798 EXPECT_EQ(1, fastcall_cb.Run()); | 798 EXPECT_EQ(1, fastcall_cb.Run()); |
| 799 | 799 |
| 800 Callback<int(void)> stdcall_cb = Bind(&StdCallFunc, 2); | 800 Callback<int(void)> stdcall_cb = Bind(&StdCallFunc, 2); |
| 801 EXPECT_EQ(2, stdcall_cb.Run()); | 801 EXPECT_EQ(2, stdcall_cb.Run()); |
| 802 } | 802 } |
| 803 #endif | 803 #endif |
| 804 | 804 |
| 805 } // namespace | 805 } // namespace |
| 806 } // namespace base | 806 } // namespace base |
| OLD | NEW |