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

Unified Diff: base/ref_counted.h

Issue 3971004: Revert "Revert "Const-ify RefCountedThreadSafe::AddRef and Release."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 2 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 | « base/message_loop_proxy_impl_unittest.cc ('k') | base/task.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/ref_counted.h
diff --git a/base/ref_counted.h b/base/ref_counted.h
index 2cc4029101f0a2d562be79f23221ff7c7b505ba1..9c84efa580402cc60be05a8c99abd5dbd1e56937 100644
--- a/base/ref_counted.h
+++ b/base/ref_counted.h
@@ -106,7 +106,7 @@ template <class T, typename Traits> class RefCountedThreadSafe;
// count reaches 0. Overload to delete it on a different thread etc.
template<typename T>
struct DefaultRefCountedThreadSafeTraits {
- static void Destruct(T* x) {
+ static void Destruct(const T* x) {
// Delete through RefCountedThreadSafe to make child classes only need to be
// friend with RefCountedThreadSafe instead of this struct, which is an
// implementation detail.
@@ -133,19 +133,19 @@ class RefCountedThreadSafe : public subtle::RefCountedThreadSafeBase {
RefCountedThreadSafe() { }
~RefCountedThreadSafe() { }
- void AddRef() {
+ void AddRef() const {
subtle::RefCountedThreadSafeBase::AddRef();
}
- void Release() {
+ void Release() const {
if (subtle::RefCountedThreadSafeBase::Release()) {
- Traits::Destruct(static_cast<T*>(this));
+ Traits::Destruct(static_cast<const T*>(this));
}
}
private:
friend struct DefaultRefCountedThreadSafeTraits<T>;
- static void DeleteInternal(T* x) { delete x; }
+ static void DeleteInternal(const T* x) { delete x; }
DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafe);
};
« no previous file with comments | « base/message_loop_proxy_impl_unittest.cc ('k') | base/task.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698