| 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 } | 542 } |
| 543 return this; | 543 return this; |
| 544 } | 544 } |
| 545 | 545 |
| 546 private: | 546 private: |
| 547 | 547 |
| 548 // Used when the registered PersistentNode of this object is | 548 // Used when the registered PersistentNode of this object is |
| 549 // released during ThreadState shutdown, clearing the association. | 549 // released during ThreadState shutdown, clearing the association. |
| 550 static void clearPersistentNode(void *self) | 550 static void clearPersistentNode(void *self) |
| 551 { | 551 { |
| 552 (reinterpret_cast<PersistentHeapCollectionBase<Collection>*>(self))->uni
nitialize(); | 552 PersistentHeapCollectionBase<Collection>* collection = (reinterpret_cast
<PersistentHeapCollectionBase<Collection>*>(self)); |
| 553 collection->uninitialize(); |
| 554 collection->clear(); |
| 553 } | 555 } |
| 554 | 556 |
| 555 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 557 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 556 void initialize() | 558 void initialize() |
| 557 { | 559 { |
| 558 // FIXME: Derive affinity based on the collection. | 560 // FIXME: Derive affinity based on the collection. |
| 559 ThreadState* state = ThreadState::current(); | 561 ThreadState* state = ThreadState::current(); |
| 560 ASSERT(state->checkThread()); | 562 ASSERT(state->checkThread()); |
| 561 m_persistentNode = state->getPersistentRegion()->allocatePersistentNode(
this, TraceMethodDelegate<PersistentHeapCollectionBase<Collection>, &PersistentH
eapCollectionBase<Collection>::trace>::trampoline); | 563 m_persistentNode = state->getPersistentRegion()->allocatePersistentNode(
this, TraceMethodDelegate<PersistentHeapCollectionBase<Collection>, &PersistentH
eapCollectionBase<Collection>::trace>::trampoline); |
| 562 #if ENABLE(ASSERT) | 564 #if ENABLE(ASSERT) |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 // into it. | 1214 // into it. |
| 1213 // | 1215 // |
| 1214 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like | 1216 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like |
| 1215 // CrossThreadWeakPersistent<>. | 1217 // CrossThreadWeakPersistent<>. |
| 1216 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } | 1218 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } |
| 1217 }; | 1219 }; |
| 1218 | 1220 |
| 1219 } // namespace WTF | 1221 } // namespace WTF |
| 1220 | 1222 |
| 1221 #endif | 1223 #endif |
| OLD | NEW |