| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 template<typename U> | 360 template<typename U> |
| 361 U* as() const | 361 U* as() const |
| 362 { | 362 { |
| 363 return static_cast<U*>(m_raw); | 363 return static_cast<U*>(m_raw); |
| 364 } | 364 } |
| 365 | 365 |
| 366 void trace(Visitor* visitor) | 366 void trace(Visitor* visitor) |
| 367 { | 367 { |
| 368 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis
tent); | 368 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis
tent); |
| 369 #if ENABLE(GC_TRACING) | 369 #if ENABLE(GC_PROFILE_MARKING) |
| 370 visitor->setHostInfo(this, m_tracingName.isEmpty() ? "Persistent" : m_tr
acingName); | 370 visitor->setHostInfo(this, m_tracingName.isEmpty() ? "Persistent" : m_tr
acingName); |
| 371 #endif | 371 #endif |
| 372 visitor->mark(m_raw); | 372 visitor->mark(m_raw); |
| 373 } | 373 } |
| 374 | 374 |
| 375 T* release() | 375 T* release() |
| 376 { | 376 { |
| 377 T* result = m_raw; | 377 T* result = m_raw; |
| 378 m_raw = 0; | 378 m_raw = 0; |
| 379 return result; | 379 return result; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 Persistent& operator=(const RawPtr<U>& other) | 415 Persistent& operator=(const RawPtr<U>& other) |
| 416 { | 416 { |
| 417 m_raw = other; | 417 m_raw = other; |
| 418 recordBacktrace(); | 418 recordBacktrace(); |
| 419 return *this; | 419 return *this; |
| 420 } | 420 } |
| 421 | 421 |
| 422 T* get() const { return m_raw; } | 422 T* get() const { return m_raw; } |
| 423 | 423 |
| 424 private: | 424 private: |
| 425 #if ENABLE(GC_TRACING) | 425 #if ENABLE(GC_PROFILE_MARKING) |
| 426 void recordBacktrace() | 426 void recordBacktrace() |
| 427 { | 427 { |
| 428 if (m_raw) | 428 if (m_raw) |
| 429 m_tracingName = Heap::createBacktraceString(); | 429 m_tracingName = Heap::createBacktraceString(); |
| 430 } | 430 } |
| 431 | 431 |
| 432 String m_tracingName; | 432 String m_tracingName; |
| 433 #else | 433 #else |
| 434 inline void recordBacktrace() const { } | 434 inline void recordBacktrace() const { } |
| 435 #endif | 435 #endif |
| (...skipping 24 matching lines...) Expand all Loading... |
| 460 // DEFINE_STATIC_LOCAL et. al. | 460 // DEFINE_STATIC_LOCAL et. al. |
| 461 WTF_USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::DefaultAllocator); | 461 WTF_USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::DefaultAllocator); |
| 462 public: | 462 public: |
| 463 PersistentHeapCollectionBase() { } | 463 PersistentHeapCollectionBase() { } |
| 464 | 464 |
| 465 template<typename OtherCollection> | 465 template<typename OtherCollection> |
| 466 PersistentHeapCollectionBase(const OtherCollection& other) : Collection(othe
r) { } | 466 PersistentHeapCollectionBase(const OtherCollection& other) : Collection(othe
r) { } |
| 467 | 467 |
| 468 void trace(Visitor* visitor) | 468 void trace(Visitor* visitor) |
| 469 { | 469 { |
| 470 #if ENABLE(GC_TRACING) | 470 #if ENABLE(GC_PROFILE_MARKING) |
| 471 visitor->setHostInfo(this, "PersistentHeapCollectionBase"); | 471 visitor->setHostInfo(this, "PersistentHeapCollectionBase"); |
| 472 #endif | 472 #endif |
| 473 visitor->trace(*static_cast<Collection*>(this)); | 473 visitor->trace(*static_cast<Collection*>(this)); |
| 474 } | 474 } |
| 475 }; | 475 }; |
| 476 | 476 |
| 477 template< | 477 template< |
| 478 typename KeyArg, | 478 typename KeyArg, |
| 479 typename MappedArg, | 479 typename MappedArg, |
| 480 typename HashArg = typename DefaultHash<KeyArg>::Hash, | 480 typename HashArg = typename DefaultHash<KeyArg>::Hash, |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, blink::IsGa
rbageCollectedType<T>::value> { | 1199 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, blink::IsGa
rbageCollectedType<T>::value> { |
| 1200 }; | 1200 }; |
| 1201 | 1201 |
| 1202 template<typename T> | 1202 template<typename T> |
| 1203 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, bli
nk::IsGarbageCollectedType<T>::value> { | 1203 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, bli
nk::IsGarbageCollectedType<T>::value> { |
| 1204 }; | 1204 }; |
| 1205 | 1205 |
| 1206 } // namespace WTF | 1206 } // namespace WTF |
| 1207 | 1207 |
| 1208 #endif | 1208 #endif |
| OLD | NEW |