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

Side by Side Diff: Source/wtf/RefCounted.h

Issue 214453005: RefCounted::derefBase() should do the decrement from 1 to 0 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Returns whether the pointer should be freed or not. 111 // Returns whether the pointer should be freed or not.
112 bool derefBase() 112 bool derefBase()
113 { 113 {
114 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); 114 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
115 #if CHECK_REF_COUNTED_LIFECYCLE 115 #if CHECK_REF_COUNTED_LIFECYCLE
116 ASSERT(m_verifier.isSafeToUse()); 116 ASSERT(m_verifier.isSafeToUse());
117 ASSERT(!m_adoptionIsRequired); 117 ASSERT(!m_adoptionIsRequired);
118 #endif 118 #endif
119 119
120 ASSERT(m_refCount > 0); 120 ASSERT(m_refCount > 0);
121 if (m_refCount == 1) { 121 --m_refCount;
122 if (!m_refCount) {
122 #if SECURITY_ASSERT_ENABLED 123 #if SECURITY_ASSERT_ENABLED
123 m_deletionHasBegun = true; 124 m_deletionHasBegun = true;
124 #endif 125 #endif
125 return true; 126 return true;
126 } 127 }
127 128
128 --m_refCount;
129 #if CHECK_REF_COUNTED_LIFECYCLE 129 #if CHECK_REF_COUNTED_LIFECYCLE
130 // Stop thread verification when the ref goes to 1 because it 130 // Stop thread verification when the ref goes to 1 because it
131 // is safe to be passed to another thread at this point. 131 // is safe to be passed to another thread at this point.
132 if (m_refCount == 1) 132 if (m_refCount == 1)
133 m_verifier.setShared(false); 133 m_verifier.setShared(false);
134 #endif 134 #endif
135 return false; 135 return false;
136 } 136 }
137 137
138 #if CHECK_REF_COUNTED_LIFECYCLE 138 #if CHECK_REF_COUNTED_LIFECYCLE
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 { 197 {
198 } 198 }
199 #endif 199 #endif
200 }; 200 };
201 201
202 } // namespace WTF 202 } // namespace WTF
203 203
204 using WTF::RefCounted; 204 using WTF::RefCounted;
205 205
206 #endif // RefCounted_h 206 #endif // RefCounted_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698