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

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

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 5 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 | « Source/wtf/DefaultAllocator.h ('k') | Source/wtf/PartitionAlloc.h » ('j') | 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) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> 3 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 // ListHashSetNode has this base class to hold the members because the MSVC 211 // ListHashSetNode has this base class to hold the members because the MSVC
212 // compiler otherwise gets into circular template dependencies when trying 212 // compiler otherwise gets into circular template dependencies when trying
213 // to do sizeof on a node. 213 // to do sizeof on a node.
214 template<typename ValueArg> class ListHashSetNodeBase { 214 template<typename ValueArg> class ListHashSetNodeBase {
215 protected: 215 protected:
216 ListHashSetNodeBase(const ValueArg& value) 216 ListHashSetNodeBase(const ValueArg& value)
217 : m_value(value) 217 : m_value(value)
218 , m_prev(0) 218 , m_prev(0)
219 , m_next(0) 219 , m_next(0)
220 #ifndef NDEBUG 220 #if ENABLE(ASSERT)
221 , m_isAllocated(true) 221 , m_isAllocated(true)
222 #endif 222 #endif
223 { 223 {
224 } 224 }
225 225
226 template <typename U> 226 template <typename U>
227 ListHashSetNodeBase(const U& value) 227 ListHashSetNodeBase(const U& value)
228 : m_value(value) 228 : m_value(value)
229 , m_prev(0) 229 , m_prev(0)
230 , m_next(0) 230 , m_next(0)
231 #ifndef NDEBUG 231 #if ENABLE(ASSERT)
232 , m_isAllocated(true) 232 , m_isAllocated(true)
233 #endif 233 #endif
234 { 234 {
235 } 235 }
236 236
237 public: 237 public:
238 ValueArg m_value; 238 ValueArg m_value;
239 ListHashSetNodeBase* m_prev; 239 ListHashSetNodeBase* m_prev;
240 ListHashSetNodeBase* m_next; 240 ListHashSetNodeBase* m_next;
241 #ifndef NDEBUG 241 #if ENABLE(ASSERT)
242 bool m_isAllocated; 242 bool m_isAllocated;
243 #endif 243 #endif
244 }; 244 };
245 245
246 // This allocator is only used for non-Heap ListHashSets. 246 // This allocator is only used for non-Heap ListHashSets.
247 template<typename ValueArg, size_t inlineCapacity> 247 template<typename ValueArg, size_t inlineCapacity>
248 struct ListHashSetAllocator : public DefaultAllocator { 248 struct ListHashSetAllocator : public DefaultAllocator {
249 typedef DefaultAllocator TableAllocator; 249 typedef DefaultAllocator TableAllocator;
250 typedef ListHashSetNode<ValueArg, ListHashSetAllocator> Node; 250 typedef ListHashSetNode<ValueArg, ListHashSetAllocator> Node;
251 typedef ListHashSetNodeBase<ValueArg> NodeBase; 251 typedef ListHashSetNodeBase<ValueArg> NodeBase;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 } 308 }
309 m_freeList = next; 309 m_freeList = next;
310 310
311 return result; 311 return result;
312 } 312 }
313 313
314 void deallocate(Node* node) 314 void deallocate(Node* node)
315 { 315 {
316 if (inPool(node)) { 316 if (inPool(node)) {
317 #ifndef NDEBUG 317 #if ENABLE(ASSERT)
318 node->m_isAllocated = false; 318 node->m_isAllocated = false;
319 #endif 319 #endif
320 node->m_next = m_freeList; 320 node->m_next = m_freeList;
321 m_freeList = node; 321 m_freeList = node;
322 return; 322 return;
323 } 323 }
324 324
325 fastFree(node); 325 fastFree(node);
326 } 326 }
327 327
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 struct NeedsTracing<ListHashSet<T, U, V> > { 1008 struct NeedsTracing<ListHashSet<T, U, V> > {
1009 static const bool value = false; 1009 static const bool value = false;
1010 }; 1010 };
1011 #endif 1011 #endif
1012 1012
1013 } // namespace WTF 1013 } // namespace WTF
1014 1014
1015 using WTF::ListHashSet; 1015 using WTF::ListHashSet;
1016 1016
1017 #endif /* WTF_ListHashSet_h */ 1017 #endif /* WTF_ListHashSet_h */
OLDNEW
« no previous file with comments | « Source/wtf/DefaultAllocator.h ('k') | Source/wtf/PartitionAlloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698