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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 337 |
338 template<typename U> | 338 template<typename U> |
339 U* as() const | 339 U* as() const |
340 { | 340 { |
341 return static_cast<U*>(m_raw); | 341 return static_cast<U*>(m_raw); |
342 } | 342 } |
343 | 343 |
344 void trace(Visitor* visitor) | 344 void trace(Visitor* visitor) |
345 { | 345 { |
346 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis
tent); | 346 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersis
tent); |
347 #if ENABLE(GC_TRACING) | 347 #if GC_PROFILE_MARKING |
348 visitor->setHostInfo(this, m_tracingName.isEmpty() ? "Persistent" : m_tr
acingName); | 348 visitor->setHostInfo(this, m_tracingName.isEmpty() ? "Persistent" : m_tr
acingName); |
349 #endif | 349 #endif |
350 visitor->mark(m_raw); | 350 visitor->mark(m_raw); |
351 } | 351 } |
352 | 352 |
353 T* release() | 353 T* release() |
354 { | 354 { |
355 T* result = m_raw; | 355 T* result = m_raw; |
356 m_raw = 0; | 356 m_raw = 0; |
357 return result; | 357 return result; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 Persistent& operator=(const RawPtr<U>& other) | 393 Persistent& operator=(const RawPtr<U>& other) |
394 { | 394 { |
395 m_raw = other; | 395 m_raw = other; |
396 recordBacktrace(); | 396 recordBacktrace(); |
397 return *this; | 397 return *this; |
398 } | 398 } |
399 | 399 |
400 T* get() const { return m_raw; } | 400 T* get() const { return m_raw; } |
401 | 401 |
402 private: | 402 private: |
403 #if ENABLE(GC_TRACING) | 403 #if GC_PROFILE_MARKING |
404 void recordBacktrace() | 404 void recordBacktrace() |
405 { | 405 { |
406 if (m_raw) | 406 if (m_raw) |
407 m_tracingName = Heap::createBacktraceString(); | 407 m_tracingName = Heap::createBacktraceString(); |
408 } | 408 } |
409 | 409 |
410 String m_tracingName; | 410 String m_tracingName; |
411 #else | 411 #else |
412 inline void recordBacktrace() const { } | 412 inline void recordBacktrace() const { } |
413 #endif | 413 #endif |
(...skipping 24 matching lines...) Expand all Loading... |
438 // DEFINE_STATIC_LOCAL et. al. | 438 // DEFINE_STATIC_LOCAL et. al. |
439 WTF_USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::DefaultAllocator); | 439 WTF_USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::DefaultAllocator); |
440 public: | 440 public: |
441 PersistentHeapCollectionBase() { } | 441 PersistentHeapCollectionBase() { } |
442 | 442 |
443 template<typename OtherCollection> | 443 template<typename OtherCollection> |
444 PersistentHeapCollectionBase(const OtherCollection& other) : Collection(othe
r) { } | 444 PersistentHeapCollectionBase(const OtherCollection& other) : Collection(othe
r) { } |
445 | 445 |
446 void trace(Visitor* visitor) | 446 void trace(Visitor* visitor) |
447 { | 447 { |
448 #if ENABLE(GC_TRACING) | 448 #if GC_PROFILE_MARKING |
449 visitor->setHostInfo(this, "PersistentHeapCollectionBase"); | 449 visitor->setHostInfo(this, "PersistentHeapCollectionBase"); |
450 #endif | 450 #endif |
451 visitor->trace(*static_cast<Collection*>(this)); | 451 visitor->trace(*static_cast<Collection*>(this)); |
452 } | 452 } |
453 }; | 453 }; |
454 | 454 |
455 template< | 455 template< |
456 typename KeyArg, | 456 typename KeyArg, |
457 typename MappedArg, | 457 typename MappedArg, |
458 typename HashArg = typename DefaultHash<KeyArg>::Hash, | 458 typename HashArg = typename DefaultHash<KeyArg>::Hash, |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, WebCore::Is
GarbageCollectedType<T>::value> { | 1163 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, WebCore::Is
GarbageCollectedType<T>::value> { |
1164 }; | 1164 }; |
1165 | 1165 |
1166 template<typename T> | 1166 template<typename T> |
1167 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, Web
Core::IsGarbageCollectedType<T>::value> { | 1167 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, Web
Core::IsGarbageCollectedType<T>::value> { |
1168 }; | 1168 }; |
1169 | 1169 |
1170 } // namespace WTF | 1170 } // namespace WTF |
1171 | 1171 |
1172 #endif | 1172 #endif |
OLD | NEW |