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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 return *this; | 344 return *this; |
345 } | 345 } |
346 | 346 |
347 void clear() { m_raw = nullptr; } | 347 void clear() { m_raw = nullptr; } |
348 | 348 |
349 virtual ~Persistent() | 349 virtual ~Persistent() |
350 { | 350 { |
351 m_raw = nullptr; | 351 m_raw = nullptr; |
352 } | 352 } |
353 | 353 |
354 template<typename U> | |
355 U* as() const | |
356 { | |
357 return static_cast<U*>(m_raw); | |
358 } | |
359 | |
360 void trace(Visitor* visitor) | 354 void trace(Visitor* visitor) |
361 { | 355 { |
362 STATIC_ASSERT_IS_GARBAGE_COLLECTED(T, "non-garbage collected object shou
ld not be in Persistent"); | 356 STATIC_ASSERT_IS_GARBAGE_COLLECTED(T, "non-garbage collected object shou
ld not be in Persistent"); |
363 #if ENABLE(GC_PROFILE_MARKING) | 357 #if ENABLE(GC_PROFILE_MARKING) |
364 visitor->setHostInfo(this, m_tracingName.isEmpty() ? "Persistent" : m_tr
acingName); | 358 visitor->setHostInfo(this, m_tracingName.isEmpty() ? "Persistent" : m_tr
acingName); |
365 #endif | 359 #endif |
366 visitor->mark(m_raw); | 360 visitor->mark(m_raw); |
367 } | 361 } |
368 | 362 |
369 RawPtr<T> release() | 363 RawPtr<T> release() |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 template<typename U> | 556 template<typename U> |
563 Member(const Member<U>& other) : m_raw(other) { } | 557 Member(const Member<U>& other) : m_raw(other) { } |
564 | 558 |
565 T* release() | 559 T* release() |
566 { | 560 { |
567 T* result = m_raw; | 561 T* result = m_raw; |
568 m_raw = nullptr; | 562 m_raw = nullptr; |
569 return result; | 563 return result; |
570 } | 564 } |
571 | 565 |
572 template<typename U> | |
573 U* as() const | |
574 { | |
575 return static_cast<U*>(m_raw); | |
576 } | |
577 | |
578 bool operator!() const { return !m_raw; } | 566 bool operator!() const { return !m_raw; } |
579 | 567 |
580 operator T*() const { return m_raw; } | 568 operator T*() const { return m_raw; } |
581 | 569 |
582 T* operator->() const { return m_raw; } | 570 T* operator->() const { return m_raw; } |
583 T& operator*() const { return *m_raw; } | 571 T& operator*() const { return *m_raw; } |
584 template<typename U> | 572 template<typename U> |
585 operator RawPtr<U>() const { return m_raw; } | 573 operator RawPtr<U>() const { return m_raw; } |
586 | 574 |
587 template<typename U> | 575 template<typename U> |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 template<typename T> | 1181 template<typename T> |
1194 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { | 1182 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { |
1195 }; | 1183 }; |
1196 | 1184 |
1197 template<typename T> | 1185 template<typename T> |
1198 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1186 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
1199 | 1187 |
1200 } // namespace WTF | 1188 } // namespace WTF |
1201 | 1189 |
1202 #endif | 1190 #endif |
OLD | NEW |