Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Unified Diff: webrtc/base/scoped_ref_ptr.h

Issue 2877023002: Move webrtc/{base => rtc_base} (Closed)
Patch Set: update presubmit.py and DEPS include rules Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/sanitizer.h ('k') | webrtc/base/sequenced_task_checker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/scoped_ref_ptr.h
diff --git a/webrtc/base/scoped_ref_ptr.h b/webrtc/base/scoped_ref_ptr.h
index 26aff03504ac5d71de40b28a79b038e31b790844..259956292f52eed9f4f66a6d242c94d6bc8b7e06 100644
--- a/webrtc/base/scoped_ref_ptr.h
+++ b/webrtc/base/scoped_ref_ptr.h
@@ -63,101 +63,9 @@
#ifndef WEBRTC_BASE_SCOPED_REF_PTR_H_
#define WEBRTC_BASE_SCOPED_REF_PTR_H_
-#include <memory>
-namespace rtc {
-
-template <class T>
-class scoped_refptr {
- public:
- scoped_refptr() : ptr_(nullptr) {}
-
- scoped_refptr(T* p) : ptr_(p) {
- if (ptr_)
- ptr_->AddRef();
- }
-
- scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {
- if (ptr_)
- ptr_->AddRef();
- }
-
- template <typename U>
- scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) {
- if (ptr_)
- ptr_->AddRef();
- }
-
- // Move constructors.
- scoped_refptr(scoped_refptr<T>&& r) : ptr_(r.release()) {}
-
- template <typename U>
- scoped_refptr(scoped_refptr<U>&& r) : ptr_(r.release()) {}
-
- ~scoped_refptr() {
- if (ptr_)
- ptr_->Release();
- }
-
- T* get() const { return ptr_; }
- operator T*() const { return ptr_; }
- T* operator->() const { return ptr_; }
-
- // Release a pointer.
- // The return value is the current pointer held by this object.
- // If this object holds a null pointer, the return value is null.
- // After this operation, this object will hold a null pointer,
- // and will not own the object any more.
- T* release() {
- T* retVal = ptr_;
- ptr_ = nullptr;
- return retVal;
- }
-
- scoped_refptr<T>& operator=(T* p) {
- // AddRef first so that self assignment should work
- if (p)
- p->AddRef();
- if (ptr_ )
- ptr_ ->Release();
- ptr_ = p;
- return *this;
- }
-
- scoped_refptr<T>& operator=(const scoped_refptr<T>& r) {
- return *this = r.ptr_;
- }
-
- template <typename U>
- scoped_refptr<T>& operator=(const scoped_refptr<U>& r) {
- return *this = r.get();
- }
-
- scoped_refptr<T>& operator=(scoped_refptr<T>&& r) {
- scoped_refptr<T>(std::move(r)).swap(*this);
- return *this;
- }
-
- template <typename U>
- scoped_refptr<T>& operator=(scoped_refptr<U>&& r) {
- scoped_refptr<T>(std::move(r)).swap(*this);
- return *this;
- }
-
- void swap(T** pp) {
- T* p = ptr_;
- ptr_ = *pp;
- *pp = p;
- }
-
- void swap(scoped_refptr<T>& r) {
- swap(&r.ptr_);
- }
-
- protected:
- T* ptr_;
-};
-
-} // namespace rtc
+// 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_
« no previous file with comments | « webrtc/base/sanitizer.h ('k') | webrtc/base/sequenced_task_checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698