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

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

Issue 461413002: WIP: ~HashTableAddResult crashes in oilpan builds Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« Source/core/dom/NodeListsNodeData.h ('K') | « Source/wtf/HashMap.h ('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) 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) 2008 David Levin <levin@chromium.org> 3 * Copyright (C) 2008 David Levin <levin@chromium.org>
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 281 }
282 282
283 ~HashTableAddResult() 283 ~HashTableAddResult()
284 { 284 {
285 // If rehash happened before accessing storedValue, it's 285 // If rehash happened before accessing storedValue, it's
286 // use-after-free. Any modification may cause a rehash, so we check 286 // use-after-free. Any modification may cause a rehash, so we check
287 // for modifications here. 287 // for modifications here.
288 // Rehash after accessing storedValue is harmless but will assert if 288 // Rehash after accessing storedValue is harmless but will assert if
289 // the AddResult destructor takes place after a modification. You 289 // the AddResult destructor takes place after a modification. You
290 // may need to limit the scope of the AddResult. 290 // may need to limit the scope of the AddResult.
291 fprintf(stderr, "%ld %ld\n", m_containerModifications, m_container-> modifications());
291 ASSERT_WITH_SECURITY_IMPLICATION(m_containerModifications == m_conta iner->modifications()); 292 ASSERT_WITH_SECURITY_IMPLICATION(m_containerModifications == m_conta iner->modifications());
292 } 293 }
293 294
294 ValueType* storedValue; 295 ValueType* storedValue;
295 bool isNewEntry; 296 bool isNewEntry;
296 297
297 #if ENABLE(SECURITY_ASSERT) 298 #if ENABLE(SECURITY_ASSERT)
298 private:
299 const HashTableType* m_container; 299 const HashTableType* m_container;
300 const int64_t m_containerModifications; 300 const int64_t m_containerModifications;
301 #endif 301 #endif
302 }; 302 };
303 303
304 template<typename Value, typename Extractor, typename KeyTraits> 304 template<typename Value, typename Extractor, typename KeyTraits>
305 struct HashTableHelper { 305 struct HashTableHelper {
306 static bool isEmptyBucket(const Value& value) { return isHashTraitsEmpty Value<KeyTraits>(Extractor::extract(value)); } 306 static bool isEmptyBucket(const Value& value) { return isHashTraitsEmpty Value<KeyTraits>(Extractor::extract(value)); }
307 static bool isDeletedBucket(const Value& value) { return KeyTraits::isDe letedValue(Extractor::extract(value)); } 307 static bool isDeletedBucket(const Value& value) { return KeyTraits::isDe letedValue(Extractor::extract(value)); }
308 static bool isEmptyOrDeletedBucket(const Value& value) { return isEmptyB ucket(value) || isDeletedBucket(value); } 308 static bool isEmptyOrDeletedBucket(const Value& value) { return isEmptyB ucket(value) || isDeletedBucket(value); }
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 CollectionIterator end(toBeRemoved.end()); 1343 CollectionIterator end(toBeRemoved.end());
1344 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it) 1344 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it)
1345 collection.remove(*it); 1345 collection.remove(*it);
1346 } 1346 }
1347 1347
1348 } // namespace WTF 1348 } // namespace WTF
1349 1349
1350 #include "wtf/HashIterators.h" 1350 #include "wtf/HashIterators.h"
1351 1351
1352 #endif // WTF_HashTable_h 1352 #endif // WTF_HashTable_h
OLDNEW
« Source/core/dom/NodeListsNodeData.h ('K') | « Source/wtf/HashMap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698