Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: webrtc/base/bind_unittest.cc

Issue 2084893002: Implement scoped_const_refptr template. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/base/scoped_ref_ptr.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/scoped_ref_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698