| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef Member_h | 5 #ifndef Member_h |
| 6 #define Member_h | 6 #define Member_h |
| 7 | 7 |
| 8 #include "wtf/Allocator.h" | 8 #include "wtf/Allocator.h" |
| 9 #include "wtf/HashFunctions.h" | 9 #include "wtf/HashFunctions.h" |
| 10 #include "wtf/HashTraits.h" | 10 #include "wtf/HashTraits.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 WTF::WeakHandlingFlag y, | 245 WTF::WeakHandlingFlag y, |
| 246 WTF::ShouldWeakPointersBeMarkedStrongly z, | 246 WTF::ShouldWeakPointersBeMarkedStrongly z, |
| 247 typename U, | 247 typename U, |
| 248 typename V> | 248 typename V> |
| 249 friend struct CollectionBackingTraceTrait; | 249 friend struct CollectionBackingTraceTrait; |
| 250 friend class Visitor; | 250 friend class Visitor; |
| 251 }; | 251 }; |
| 252 | 252 |
| 253 // WeakMember is similar to Member in that it is used to point to other oilpan | 253 // WeakMember is similar to Member in that it is used to point to other oilpan |
| 254 // heap allocated objects. | 254 // heap allocated objects. |
| 255 // However instead of creating a strong pointer to the object, the WeakMember cr
eates | 255 // However instead of creating a strong pointer to the object, the WeakMember |
| 256 // a weak pointer, which does not keep the pointee alive. Hence if all pointers
to | 256 // creates a weak pointer, which does not keep the pointee alive. Hence if all |
| 257 // to a heap allocated object are weak the object will be garbage collected. At
the | 257 // pointers to to a heap allocated object are weak the object will be garbage |
| 258 // time of GC the weak pointers will automatically be set to null. | 258 // collected. At the time of GC the weak pointers will automatically be set to |
| 259 // null. |
| 259 template <typename T> | 260 template <typename T> |
| 260 class WeakMember : public MemberBase<T, TracenessMemberConfiguration::Traced> { | 261 class WeakMember : public MemberBase<T, TracenessMemberConfiguration::Traced> { |
| 261 typedef MemberBase<T, TracenessMemberConfiguration::Traced> Parent; | 262 typedef MemberBase<T, TracenessMemberConfiguration::Traced> Parent; |
| 262 | 263 |
| 263 public: | 264 public: |
| 264 WeakMember() : Parent() {} | 265 WeakMember() : Parent() {} |
| 265 | 266 |
| 266 WeakMember(std::nullptr_t) : Parent(nullptr) {} | 267 WeakMember(std::nullptr_t) : Parent(nullptr) {} |
| 267 | 268 |
| 268 WeakMember(T* raw) : Parent(raw) {} | 269 WeakMember(T* raw) : Parent(raw) {} |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 414 |
| 414 template <typename T> | 415 template <typename T> |
| 415 struct IsTraceable<blink::WeakMember<T>> { | 416 struct IsTraceable<blink::WeakMember<T>> { |
| 416 STATIC_ONLY(IsTraceable); | 417 STATIC_ONLY(IsTraceable); |
| 417 static const bool value = true; | 418 static const bool value = true; |
| 418 }; | 419 }; |
| 419 | 420 |
| 420 } // namespace WTF | 421 } // namespace WTF |
| 421 | 422 |
| 422 #endif // Member_h | 423 #endif // Member_h |
| OLD | NEW |