Add the stub headers from https://codereview.webrtc.org/2877023002 as a separate commit. This preserves git blame history of the moved files. BUG=webrtc:7634 NOTRY=True TBR=kwiberg@webrtc.org Change-Id: Ic141abf11801fbfdeea5bcdb23608696ad449013 Reviewed-on: https://chromium-review.googlesource.com/554623 Reviewed-by: Henrik Kjellander <kjellander@webrtc.org> Cr-Commit-Position: refs/heads/master@{#18822}
72 lines
2.2 KiB
C
72 lines
2.2 KiB
C
/*
|
|
* 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_
|