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

Unified Diff: third_party/WebKit/Source/platform/wtf/RefCounted.h

Issue 2781313004: Implement RefCountedCopyable<T>. (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 | « third_party/WebKit/Source/core/style/StyleBoxData.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/wtf/RefCounted.h
diff --git a/third_party/WebKit/Source/platform/wtf/RefCounted.h b/third_party/WebKit/Source/platform/wtf/RefCounted.h
index 357e294e9ac2ebbf1b355cc128c920eb111183d9..671e49b2943759692f321f4c62f06f0bcabaf919 100644
--- a/third_party/WebKit/Source/platform/wtf/RefCounted.h
+++ b/third_party/WebKit/Source/platform/wtf/RefCounted.h
@@ -164,8 +164,19 @@ class RefCounted : public RefCountedBase {
#endif
};
+// Unlike subclasses of RefCounted where the copy constructor must be
+// handwritten, subclasses of RefCountedCopyable can use the default
+// compiler-generated copy constructor.
alancutter (OOO until 2018) 2017/04/03 12:07:45 This wording is a bit too fancy. For speed of read
+template <typename T>
+class RefCountedCopyable : public RefCounted<T> {
+ protected:
+ RefCountedCopyable() = default;
+ RefCountedCopyable(const RefCountedCopyable&) : RefCounted<T>() {}
+};
+
} // namespace WTF
using WTF::RefCounted;
+using WTF::RefCountedCopyable;
#endif // RefCounted_h
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleBoxData.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698