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

Unified Diff: base/memory/ref_counted.h

Issue 2732063005: Revert of Remove a scoped_refptr<>::swap overload (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/ref_counted.h
diff --git a/base/memory/ref_counted.h b/base/memory/ref_counted.h
index 9c9aea12e83784509d851c5e67e8da1291b34695..ff46e6d6e5a9c87782b449474fbbebc4e0865454 100644
--- a/base/memory/ref_counted.h
+++ b/base/memory/ref_counted.h
@@ -7,7 +7,6 @@
#include <stddef.h>
-#include <algorithm>
#include <cassert>
#include <iosfwd>
#include <type_traits>
@@ -355,7 +354,15 @@
return *this;
}
- void swap(scoped_refptr<T>& r) { std::swap(ptr_, r.ptr_); }
+ void swap(T** pp) {
+ T* p = ptr_;
+ ptr_ = *pp;
+ *pp = p;
+ }
+
+ void swap(scoped_refptr<T>& r) {
+ swap(&r.ptr_);
+ }
explicit operator bool() const { return ptr_ != nullptr; }
« no previous file with comments | « no previous file | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698