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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 427 } |
428 | 428 |
429 WeakMember& operator=(std::nullptr_t) { | 429 WeakMember& operator=(std::nullptr_t) { |
430 this->m_raw = nullptr; | 430 this->m_raw = nullptr; |
431 return *this; | 431 return *this; |
432 } | 432 } |
433 | 433 |
434 private: | 434 private: |
435 T** cell() const { return const_cast<T**>(&this->m_raw); } | 435 T** cell() const { return const_cast<T**>(&this->m_raw); } |
436 | 436 |
437 template <typename Derived> | 437 friend class Visitor; |
438 friend class VisitorHelper; | |
439 }; | 438 }; |
440 | 439 |
441 // UntracedMember is a pointer to an on-heap object that is not traced for some | 440 // UntracedMember is a pointer to an on-heap object that is not traced for some |
442 // reason. Please don't use this unless you understand what you're doing. | 441 // reason. Please don't use this unless you understand what you're doing. |
443 // Basically, all pointers to on-heap objects must be stored in either of | 442 // Basically, all pointers to on-heap objects must be stored in either of |
444 // Persistent, Member or WeakMember. It is not allowed to leave raw pointers to | 443 // Persistent, Member or WeakMember. It is not allowed to leave raw pointers to |
445 // on-heap objects. However, there can be scenarios where you have to use raw | 444 // on-heap objects. However, there can be scenarios where you have to use raw |
446 // pointers for some reason, and in that case you can use UntracedMember. Of | 445 // pointers for some reason, and in that case you can use UntracedMember. Of |
447 // course, it must be guaranteed that the pointing on-heap object is kept alive | 446 // course, it must be guaranteed that the pointing on-heap object is kept alive |
448 // while the raw pointer is pointing to the object. | 447 // while the raw pointer is pointing to the object. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 | 566 |
568 template <typename T> | 567 template <typename T> |
569 struct IsTraceable<blink::TraceWrapperMember<T>> { | 568 struct IsTraceable<blink::TraceWrapperMember<T>> { |
570 STATIC_ONLY(IsTraceable); | 569 STATIC_ONLY(IsTraceable); |
571 static const bool value = true; | 570 static const bool value = true; |
572 }; | 571 }; |
573 | 572 |
574 } // namespace WTF | 573 } // namespace WTF |
575 | 574 |
576 #endif // Member_h | 575 #endif // Member_h |
OLD | NEW |