OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // | 53 // |
54 // { | 54 // { |
55 // scoped_refptr<MyFoo> a = new MyFoo(); | 55 // scoped_refptr<MyFoo> a = new MyFoo(); |
56 // scoped_refptr<MyFoo> b; | 56 // scoped_refptr<MyFoo> b; |
57 // | 57 // |
58 // b = a; | 58 // b = a; |
59 // // now, |a| and |b| each own a reference to the same MyFoo object. | 59 // // now, |a| and |b| each own a reference to the same MyFoo object. |
60 // } | 60 // } |
61 // | 61 // |
62 | 62 |
63 #ifndef WEBRTC_BASE_SCOPED_REF_PTR_H_ | 63 #ifndef WEBRTC_RTC_BASE_SCOPED_REF_PTR_H_ |
64 #define WEBRTC_BASE_SCOPED_REF_PTR_H_ | 64 #define WEBRTC_RTC_BASE_SCOPED_REF_PTR_H_ |
65 | 65 |
66 #include <memory> | 66 #include <memory> |
67 | 67 |
68 namespace rtc { | 68 namespace rtc { |
69 | 69 |
70 template <class T> | 70 template <class T> |
71 class scoped_refptr { | 71 class scoped_refptr { |
72 public: | 72 public: |
73 scoped_refptr() : ptr_(nullptr) {} | 73 scoped_refptr() : ptr_(nullptr) {} |
74 | 74 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 void swap(scoped_refptr<T>& r) { | 153 void swap(scoped_refptr<T>& r) { |
154 swap(&r.ptr_); | 154 swap(&r.ptr_); |
155 } | 155 } |
156 | 156 |
157 protected: | 157 protected: |
158 T* ptr_; | 158 T* ptr_; |
159 }; | 159 }; |
160 | 160 |
161 } // namespace rtc | 161 } // namespace rtc |
162 | 162 |
163 #endif // WEBRTC_BASE_SCOPED_REF_PTR_H_ | 163 #endif // WEBRTC_RTC_BASE_SCOPED_REF_PTR_H_ |
OLD | NEW |