Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 template <class U> bool operator!=(scoped_ptr<U> const& p2) const; | 588 template <class U> bool operator!=(scoped_ptr<U> const& p2) const; |
| 589 }; | 589 }; |
| 590 | 590 |
| 591 template <class T, class D> | 591 template <class T, class D> |
| 592 void swap(rtc::scoped_ptr<T, D>& p1, rtc::scoped_ptr<T, D>& p2) { | 592 void swap(rtc::scoped_ptr<T, D>& p1, rtc::scoped_ptr<T, D>& p2) { |
| 593 p1.swap(p2); | 593 p1.swap(p2); |
| 594 } | 594 } |
| 595 | 595 |
| 596 // Convert between the most common kinds of scoped_ptr and unique_ptr. | 596 // Convert between the most common kinds of scoped_ptr and unique_ptr. |
| 597 template <typename T> | 597 template <typename T> |
| 598 std::unique_ptr<T> ScopedToUnique(scoped_ptr<T> sp) { | 598 std::unique_ptr<T> ScopedToUnique(scoped_ptr<T>&& sp) { |
|
Sergey Ulanov
2016/03/31 18:41:15
Is this change related to this CL?
I don't see the
Hzj_jie
2016/04/05 23:15:17
No, not related, my bad to copy this change from C
| |
| 599 return std::unique_ptr<T>(sp.release()); | 599 return std::unique_ptr<T>(sp.release()); |
| 600 } | 600 } |
| 601 template <typename T> | 601 template <typename T> |
| 602 scoped_ptr<T> UniqueToScoped(std::unique_ptr<T> up) { | 602 scoped_ptr<T> UniqueToScoped(std::unique_ptr<T>&& up) { |
| 603 return scoped_ptr<T>(up.release()); | 603 return scoped_ptr<T>(up.release()); |
| 604 } | 604 } |
| 605 | 605 |
| 606 } // namespace rtc | 606 } // namespace rtc |
| 607 | 607 |
| 608 template <class T, class D> | 608 template <class T, class D> |
| 609 bool operator==(T* p1, const rtc::scoped_ptr<T, D>& p2) { | 609 bool operator==(T* p1, const rtc::scoped_ptr<T, D>& p2) { |
| 610 return p1 == p2.get(); | 610 return p1 == p2.get(); |
| 611 } | 611 } |
| 612 | 612 |
| 613 template <class T, class D> | 613 template <class T, class D> |
| 614 bool operator!=(T* p1, const rtc::scoped_ptr<T, D>& p2) { | 614 bool operator!=(T* p1, const rtc::scoped_ptr<T, D>& p2) { |
| 615 return p1 != p2.get(); | 615 return p1 != p2.get(); |
| 616 } | 616 } |
| 617 | 617 |
| 618 // A function to convert T* into scoped_ptr<T> | 618 // A function to convert T* into scoped_ptr<T> |
| 619 // Doing e.g. make_scoped_ptr(new FooBarBaz<type>(arg)) is a shorter notation | 619 // Doing e.g. make_scoped_ptr(new FooBarBaz<type>(arg)) is a shorter notation |
| 620 // for scoped_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg)) | 620 // for scoped_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg)) |
| 621 template <typename T> | 621 template <typename T> |
| 622 rtc::scoped_ptr<T> rtc_make_scoped_ptr(T* ptr) { | 622 rtc::scoped_ptr<T> rtc_make_scoped_ptr(T* ptr) { |
| 623 return rtc::scoped_ptr<T>(ptr); | 623 return rtc::scoped_ptr<T>(ptr); |
| 624 } | 624 } |
| 625 | 625 |
| 626 #endif // #ifndef WEBRTC_BASE_SCOPED_PTR_H__ | 626 #endif // #ifndef WEBRTC_BASE_SCOPED_PTR_H__ |
| OLD | NEW |