| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 struct E: public D { | 50 struct E: public D { |
| 51 int Release(); | 51 int Release(); |
| 52 }; | 52 }; |
| 53 struct F { | 53 struct F { |
| 54 void AddRef(); | 54 void AddRef(); |
| 55 void Release(); | 55 void Release(); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 struct LifeTimeCheck { | 58 struct LifeTimeCheck { |
| 59 LifeTimeCheck() : ref_count_(0) {} | 59 LifeTimeCheck() : ref_count_(0) {} |
| 60 void AddRef() { ++ref_count_; } | 60 void AddRef() const { ++ref_count_; } |
| 61 void Release() { --ref_count_; } | 61 void Release() const { --ref_count_; } |
| 62 void NullaryVoid() {} | 62 void NullaryVoid() {} |
| 63 int ref_count_; | 63 mutable int ref_count_; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 int Return42() { return 42; } | 66 int Return42() { return 42; } |
| 67 int Negate(int a) { return -a; } | 67 int Negate(int a) { return -a; } |
| 68 int Multiply(int a, int b) { return a * b; } | 68 int Multiply(int a, int b) { return a * b; } |
| 69 | 69 |
| 70 } // namespace | 70 } // namespace |
| 71 | 71 |
| 72 // Try to catch any problem with scoped_refptr type deduction in rtc::Bind at | 72 // Try to catch any problem with scoped_refptr type deduction in rtc::Bind at |
| 73 // compile time. | 73 // compile time. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // modified to a non-reference capture. | 229 // modified to a non-reference capture. |
| 230 TEST(BindTest, RefArgument) { | 230 TEST(BindTest, RefArgument) { |
| 231 const int x = 42; | 231 const int x = 42; |
| 232 EXPECT_EQ(&x, Ref(x)); | 232 EXPECT_EQ(&x, Ref(x)); |
| 233 // Bind() should make a copy of |x|, i.e. the pointers should be different. | 233 // Bind() should make a copy of |x|, i.e. the pointers should be different. |
| 234 auto functor = Bind(&Ref, x); | 234 auto functor = Bind(&Ref, x); |
| 235 EXPECT_NE(&x, functor()); | 235 EXPECT_NE(&x, functor()); |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace rtc | 238 } // namespace rtc |
| OLD | NEW |