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

Side by Side Diff: third_party/WebKit/Source/platform/wtf/RefCounted.h

Issue 2781313004: Implement RefCountedCopyable<T>. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleBoxData.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 protected: 157 protected:
158 #if ENABLE(INSTANCE_COUNTER) 158 #if ENABLE(INSTANCE_COUNTER)
159 RefCounted() { incrementInstanceCount<T>(static_cast<T*>(this)); } 159 RefCounted() { incrementInstanceCount<T>(static_cast<T*>(this)); }
160 160
161 ~RefCounted() { decrementInstanceCount<T>(static_cast<T*>(this)); } 161 ~RefCounted() { decrementInstanceCount<T>(static_cast<T*>(this)); }
162 #else 162 #else
163 RefCounted() {} 163 RefCounted() {}
164 #endif 164 #endif
165 }; 165 };
166 166
167 // Unlike subclasses of RefCounted where the copy constructor must be
168 // handwritten, subclasses of RefCountedCopyable can use the default
169 // 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
170 template <typename T>
171 class RefCountedCopyable : public RefCounted<T> {
172 protected:
173 RefCountedCopyable() = default;
174 RefCountedCopyable(const RefCountedCopyable&) : RefCounted<T>() {}
175 };
176
167 } // namespace WTF 177 } // namespace WTF
168 178
169 using WTF::RefCounted; 179 using WTF::RefCounted;
180 using WTF::RefCountedCopyable;
170 181
171 #endif // RefCounted_h 182 #endif // RefCounted_h
OLDNEW
« 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