Index: webrtc/base/scoped_ref_ptr.h |
diff --git a/webrtc/base/scoped_ref_ptr.h b/webrtc/base/scoped_ref_ptr.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..259956292f52eed9f4f66a6d242c94d6bc8b7e06 |
--- /dev/null |
+++ b/webrtc/base/scoped_ref_ptr.h |
@@ -0,0 +1,71 @@ |
+/* |
+ * Copyright 2011 The WebRTC Project Authors. All rights reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+// Originally these classes are from Chromium. |
+// http://src.chromium.org/viewvc/chrome/trunk/src/base/memory/ref_counted.h?view=markup |
+ |
+// |
+// A smart pointer class for reference counted objects. Use this class instead |
+// of calling AddRef and Release manually on a reference counted object to |
+// avoid common memory leaks caused by forgetting to Release an object |
+// reference. Sample usage: |
+// |
+// class MyFoo : public RefCounted<MyFoo> { |
+// ... |
+// }; |
+// |
+// void some_function() { |
+// scoped_refptr<MyFoo> foo = new MyFoo(); |
+// foo->Method(param); |
+// // |foo| is released when this function returns |
+// } |
+// |
+// void some_other_function() { |
+// scoped_refptr<MyFoo> foo = new MyFoo(); |
+// ... |
+// foo = nullptr; // explicitly releases |foo| |
+// ... |
+// if (foo) |
+// foo->Method(param); |
+// } |
+// |
+// The above examples show how scoped_refptr<T> acts like a pointer to T. |
+// Given two scoped_refptr<T> classes, it is also possible to exchange |
+// references between the two objects, like so: |
+// |
+// { |
+// scoped_refptr<MyFoo> a = new MyFoo(); |
+// scoped_refptr<MyFoo> b; |
+// |
+// b.swap(a); |
+// // now, |b| references the MyFoo object, and |a| references null. |
+// } |
+// |
+// To make both |a| and |b| in the above example reference the same MyFoo |
+// object, simply use the assignment operator: |
+// |
+// { |
+// scoped_refptr<MyFoo> a = new MyFoo(); |
+// scoped_refptr<MyFoo> b; |
+// |
+// b = a; |
+// // now, |a| and |b| each own a reference to the same MyFoo object. |
+// } |
+// |
+ |
+#ifndef WEBRTC_BASE_SCOPED_REF_PTR_H_ |
+#define WEBRTC_BASE_SCOPED_REF_PTR_H_ |
+ |
+ |
+// This header is deprecated and is just left here temporarily during |
+// refactoring. See https://bugs.webrtc.org/7634 for more details. |
+#include "webrtc/rtc_base/scoped_ref_ptr.h" |
+ |
+#endif // WEBRTC_BASE_SCOPED_REF_PTR_H_ |