| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 } | 244 } |
| 245 | 245 |
| 246 Persistent(std::nullptr_t) : m_raw(0) | 246 Persistent(std::nullptr_t) : m_raw(0) |
| 247 { | 247 { |
| 248 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis
tent); | 248 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis
tent); |
| 249 } | 249 } |
| 250 | 250 |
| 251 Persistent(T* raw) : m_raw(raw) | 251 Persistent(T* raw) : m_raw(raw) |
| 252 { | 252 { |
| 253 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis
tent); | 253 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis
tent); |
| 254 #ifndef NDEBUG |
| 255 // For global persistent handles we cannot check that the |
| 256 // pointer is in the heap because that would involve |
| 257 // inspecting the heap of running threads. |
| 258 bool isGlobalPersistent = WTF::IsSubclass<RootsAccessor, GlobalPersisten
ts>::value; |
| 259 ASSERT(!raw || isGlobalPersistent || ThreadStateFor<ThreadingTrait<T>::A
ffinity>::state()->contains(raw)); |
| 260 #endif |
| 254 } | 261 } |
| 255 | 262 |
| 256 Persistent(const Persistent& other) : m_raw(other) | 263 Persistent(const Persistent& other) : m_raw(other) |
| 257 { | 264 { |
| 258 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis
tent); | 265 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis
tent); |
| 259 } | 266 } |
| 260 | 267 |
| 261 template<typename U> | 268 template<typename U> |
| 262 Persistent(const Persistent<U, RootsAccessor>& other) : m_raw(other) { } | 269 Persistent(const Persistent<U, RootsAccessor>& other) : m_raw(other) { } |
| 263 | 270 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 } | 423 } |
| 417 | 424 |
| 418 Member(std::nullptr_t) : m_raw(0) | 425 Member(std::nullptr_t) : m_raw(0) |
| 419 { | 426 { |
| 420 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); | 427 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); |
| 421 } | 428 } |
| 422 | 429 |
| 423 Member(T* raw) : m_raw(raw) | 430 Member(T* raw) : m_raw(raw) |
| 424 { | 431 { |
| 425 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); | 432 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); |
| 433 ASSERT(!raw || ThreadStateFor<ThreadingTrait<T>::Affinity>::state()->con
tains(raw)); |
| 426 } | 434 } |
| 427 | 435 |
| 428 Member(WTF::HashTableDeletedValueType) : m_raw(reinterpret_cast<T*>(-1)) | 436 Member(WTF::HashTableDeletedValueType) : m_raw(reinterpret_cast<T*>(-1)) |
| 429 { | 437 { |
| 430 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); | 438 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); |
| 431 } | 439 } |
| 432 | 440 |
| 433 bool isHashTableDeletedValue() const { return m_raw == reinterpret_cast<T*>(
-1); } | 441 bool isHashTableDeletedValue() const { return m_raw == reinterpret_cast<T*>(
-1); } |
| 434 | 442 |
| 435 template<typename U> | 443 template<typename U> |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 }; | 930 }; |
| 923 | 931 |
| 924 template<typename T, typename U> | 932 template<typename T, typename U> |
| 925 struct NeedsTracing<HashMap<T, U> > { | 933 struct NeedsTracing<HashMap<T, U> > { |
| 926 static const bool value = false; | 934 static const bool value = false; |
| 927 }; | 935 }; |
| 928 | 936 |
| 929 } // namespace WTF | 937 } // namespace WTF |
| 930 | 938 |
| 931 #endif | 939 #endif |
| OLD | NEW |