Commit 61ac737e authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Use base::MakeRefCounted() in scoped_refptr.h documentation.

Change-Id: I09440837fddc4ed6a7163b6adcd08ee7ef13634a
Reviewed-on: https://chromium-review.googlesource.com/973915Reviewed-by: default avatarTaiju Tsuiki <tzik@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544999}
parent 67fa126c
...@@ -115,13 +115,13 @@ scoped_refptr<T> WrapRefCounted(T* t) { ...@@ -115,13 +115,13 @@ scoped_refptr<T> WrapRefCounted(T* t) {
// }; // };
// //
// void some_function() { // void some_function() {
// scoped_refptr<MyFoo> foo = new MyFoo(); // scoped_refptr<MyFoo> foo = MakeRefCounted<MyFoo>();
// foo->Method(param); // foo->Method(param);
// // |foo| is released when this function returns // // |foo| is released when this function returns
// } // }
// //
// void some_other_function() { // void some_other_function() {
// scoped_refptr<MyFoo> foo = new MyFoo(); // scoped_refptr<MyFoo> foo = MakeRefCounted<MyFoo>();
// ... // ...
// foo = nullptr; // explicitly releases |foo| // foo = nullptr; // explicitly releases |foo|
// ... // ...
...@@ -134,7 +134,7 @@ scoped_refptr<T> WrapRefCounted(T* t) { ...@@ -134,7 +134,7 @@ scoped_refptr<T> WrapRefCounted(T* t) {
// references between the two objects, like so: // references between the two objects, like so:
// //
// { // {
// scoped_refptr<MyFoo> a = new MyFoo(); // scoped_refptr<MyFoo> a = MakeRefCounted<MyFoo>();
// scoped_refptr<MyFoo> b; // scoped_refptr<MyFoo> b;
// //
// b.swap(a); // b.swap(a);
...@@ -145,7 +145,7 @@ scoped_refptr<T> WrapRefCounted(T* t) { ...@@ -145,7 +145,7 @@ scoped_refptr<T> WrapRefCounted(T* t) {
// object, simply use the assignment operator: // object, simply use the assignment operator:
// //
// { // {
// scoped_refptr<MyFoo> a = new MyFoo(); // scoped_refptr<MyFoo> a = MakeRefCounted<MyFoo>();
// scoped_refptr<MyFoo> b; // scoped_refptr<MyFoo> b;
// //
// b = a; // b = a;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment