Chromium Code Reviews| 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 TraceWrapperMember_h | 5 #ifndef TraceWrapperMember_h |
| 6 #define TraceWrapperMember_h | 6 #define TraceWrapperMember_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappableVisitor.h" | 8 #include "bindings/core/v8/ScriptWrappableVisitor.h" |
| 9 #include "platform/heap/HeapAllocator.h" | 9 #include "platform/heap/HeapAllocator.h" |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 #endif | 30 #endif |
| 31 ScriptWrappableVisitor::writeBarrier(m_parent, raw); | 31 ScriptWrappableVisitor::writeBarrier(m_parent, raw); |
| 32 } | 32 } |
| 33 TraceWrapperMember(WTF::HashTableDeletedValueType x) | 33 TraceWrapperMember(WTF::HashTableDeletedValueType x) |
| 34 : Member<T>(x), m_parent(nullptr) {} | 34 : Member<T>(x), m_parent(nullptr) {} |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Copying a TraceWrapperMember means that its backpointer will also be | 37 * Copying a TraceWrapperMember means that its backpointer will also be |
| 38 * copied. | 38 * copied. |
| 39 */ | 39 */ |
| 40 TraceWrapperMember(const TraceWrapperMember& other) { *this = other; } | 40 TraceWrapperMember(const TraceWrapperMember& other) { *this = other; } |
|
Michael Lippautz
2016/12/09 14:46:55
The copy ctor did not forward to the explicitly de
| |
| 41 | 41 |
| 42 template <typename U> | 42 TraceWrapperMember& operator=(const TraceWrapperMember& other) { |
|
Michael Lippautz
2016/12/09 14:46:55
There's no sense in a different type U here.
| |
| 43 TraceWrapperMember& operator=(const TraceWrapperMember<U>& other) { | |
| 44 DCHECK(other.m_parent); | 43 DCHECK(other.m_parent); |
| 45 m_parent = other.m_parent; | 44 m_parent = other.m_parent; |
| 46 Member<T>::operator=(other); | 45 Member<T>::operator=(other); |
| 47 ScriptWrappableVisitor::writeBarrier(m_parent, other); | 46 ScriptWrappableVisitor::writeBarrier(m_parent, other); |
| 48 return *this; | 47 return *this; |
| 49 } | 48 } |
| 50 | 49 |
| 51 template <typename U> | 50 TraceWrapperMember& operator=(const Member<T>& other) { |
| 52 TraceWrapperMember& operator=(const Member<U>& other) { | |
| 53 DCHECK(!traceWrapperMemberIsNotInitialized()); | 51 DCHECK(!traceWrapperMemberIsNotInitialized()); |
| 54 Member<T>::operator=(other); | 52 Member<T>::operator=(other); |
| 55 ScriptWrappableVisitor::writeBarrier(m_parent, other); | 53 ScriptWrappableVisitor::writeBarrier(m_parent, other); |
| 56 return *this; | 54 return *this; |
| 57 } | 55 } |
| 58 | 56 |
| 59 template <typename U> | 57 TraceWrapperMember& operator=(T* other) { |
| 60 TraceWrapperMember& operator=(U* other) { | |
| 61 DCHECK(!traceWrapperMemberIsNotInitialized()); | 58 DCHECK(!traceWrapperMemberIsNotInitialized()); |
| 62 Member<T>::operator=(other); | 59 Member<T>::operator=(other); |
| 63 ScriptWrappableVisitor::writeBarrier(m_parent, other); | 60 ScriptWrappableVisitor::writeBarrier(m_parent, other); |
| 64 return *this; | 61 return *this; |
| 65 } | 62 } |
| 66 | 63 |
| 67 TraceWrapperMember& operator=(std::nullptr_t) { | 64 TraceWrapperMember& operator=(std::nullptr_t) { |
| 68 // No need for a write barrier when assigning nullptr. | 65 // No need for a write barrier when assigning nullptr. |
| 69 Member<T>::operator=(nullptr); | 66 Member<T>::operator=(nullptr); |
| 70 return *this; | 67 return *this; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 b.clear(); | 128 b.clear(); |
| 132 b.reserveCapacity(temp.size()); | 129 b.reserveCapacity(temp.size()); |
| 133 for (auto item : temp) { | 130 for (auto item : temp) { |
| 134 b.push_back(item.get()); | 131 b.push_back(item.get()); |
| 135 } | 132 } |
| 136 } | 133 } |
| 137 | 134 |
| 138 } // namespace blink | 135 } // namespace blink |
| 139 | 136 |
| 140 #endif // TraceWrapperMember_h | 137 #endif // TraceWrapperMember_h |
| OLD | NEW |