| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 uninitialize(); | 208 uninitialize(); |
| 209 m_raw = nullptr; | 209 m_raw = nullptr; |
| 210 m_trace = nullptr; | 210 m_trace = nullptr; |
| 211 } | 211 } |
| 212 | 212 |
| 213 template<typename VisitorDispatcher> | 213 template<typename VisitorDispatcher> |
| 214 void trace(VisitorDispatcher visitor) | 214 void trace(VisitorDispatcher visitor) |
| 215 { | 215 { |
| 216 static_assert(sizeof(T), "T must be fully defined"); | 216 static_assert(sizeof(T), "T must be fully defined"); |
| 217 static_assert(IsGarbageCollectedType<T>::value, "T needs to be a garbage
collected object"); | 217 static_assert(IsGarbageCollectedType<T>::value, "T needs to be a garbage
collected object"); |
| 218 #if ENABLE(GC_PROFILING) | |
| 219 visitor->setHostInfo(this, m_tracingName.isEmpty() ? "Persistent" : m_tr
acingName); | |
| 220 #endif | |
| 221 visitor->mark(m_raw); | 218 visitor->mark(m_raw); |
| 222 } | 219 } |
| 223 | 220 |
| 224 RawPtr<T> release() | 221 RawPtr<T> release() |
| 225 { | 222 { |
| 226 RawPtr<T> result = m_raw; | 223 RawPtr<T> result = m_raw; |
| 227 m_raw = nullptr; | 224 m_raw = nullptr; |
| 228 return result; | 225 return result; |
| 229 } | 226 } |
| 230 | 227 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 uninitialize(); | 406 uninitialize(); |
| 410 m_raw = nullptr; | 407 m_raw = nullptr; |
| 411 m_trace = nullptr; | 408 m_trace = nullptr; |
| 412 } | 409 } |
| 413 | 410 |
| 414 template<typename VisitorDispatcher> | 411 template<typename VisitorDispatcher> |
| 415 void trace(VisitorDispatcher visitor) | 412 void trace(VisitorDispatcher visitor) |
| 416 { | 413 { |
| 417 static_assert(sizeof(T), "T must be fully defined"); | 414 static_assert(sizeof(T), "T must be fully defined"); |
| 418 static_assert(IsGarbageCollectedType<T>::value, "T needs to be a garbage
collected object"); | 415 static_assert(IsGarbageCollectedType<T>::value, "T needs to be a garbage
collected object"); |
| 419 #if ENABLE(GC_PROFILING) | |
| 420 visitor->setHostInfo(this, m_tracingName.isEmpty() ? "CrossThreadPersist
ent" : m_tracingName); | |
| 421 #endif | |
| 422 visitor->mark(m_raw); | 416 visitor->mark(m_raw); |
| 423 } | 417 } |
| 424 | 418 |
| 425 RawPtr<T> release() | 419 RawPtr<T> release() |
| 426 { | 420 { |
| 427 RawPtr<T> result = m_raw; | 421 RawPtr<T> result = m_raw; |
| 428 m_raw = nullptr; | 422 m_raw = nullptr; |
| 429 return result; | 423 return result; |
| 430 } | 424 } |
| 431 | 425 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 ~PersistentHeapCollectionBase() | 565 ~PersistentHeapCollectionBase() |
| 572 { | 566 { |
| 573 uninitialize(); | 567 uninitialize(); |
| 574 m_trace = nullptr; | 568 m_trace = nullptr; |
| 575 } | 569 } |
| 576 | 570 |
| 577 template<typename VisitorDispatcher> | 571 template<typename VisitorDispatcher> |
| 578 void trace(VisitorDispatcher visitor) | 572 void trace(VisitorDispatcher visitor) |
| 579 { | 573 { |
| 580 static_assert(sizeof(Collection), "Collection must be fully defined"); | 574 static_assert(sizeof(Collection), "Collection must be fully defined"); |
| 581 #if ENABLE(GC_PROFILING) | |
| 582 visitor->setHostInfo(this, "PersistentHeapCollectionBase"); | |
| 583 #endif | |
| 584 visitor->trace(*static_cast<Collection*>(this)); | 575 visitor->trace(*static_cast<Collection*>(this)); |
| 585 } | 576 } |
| 586 | 577 |
| 587 private: | 578 private: |
| 588 void initialize() | 579 void initialize() |
| 589 { | 580 { |
| 590 ThreadState* state = ThreadState::current(); | 581 ThreadState* state = ThreadState::current(); |
| 591 m_prev = state->roots(); | 582 m_prev = state->roots(); |
| 592 m_next = m_prev->m_next; | 583 m_next = m_prev->m_next; |
| 593 m_prev->m_next = this; | 584 m_prev->m_next = this; |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { | 1281 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { |
| 1291 static_assert(sizeof(T), "T must be fully defined"); | 1282 static_assert(sizeof(T), "T must be fully defined"); |
| 1292 }; | 1283 }; |
| 1293 | 1284 |
| 1294 template<typename T> | 1285 template<typename T> |
| 1295 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1286 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
| 1296 | 1287 |
| 1297 } // namespace WTF | 1288 } // namespace WTF |
| 1298 | 1289 |
| 1299 #endif | 1290 #endif |
| OLD | NEW |