Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/TraceWrapperMember.h

Issue 2802593002: Allow null other.m_parent in TraceWrapperMember::operator= if other is nullptr. (Closed)
Patch Set: m_parent swap test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/TraceWrapperMemberTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 TraceWrapperMember(WTF::HashTableDeletedValueType x) 43 TraceWrapperMember(WTF::HashTableDeletedValueType x)
44 : Member<T>(x), m_parent(nullptr) {} 44 : Member<T>(x), m_parent(nullptr) {}
45 45
46 /** 46 /**
47 * Copying a TraceWrapperMember means that its backpointer will also be 47 * Copying a TraceWrapperMember means that its backpointer will also be
48 * copied. 48 * copied.
49 */ 49 */
50 TraceWrapperMember(const TraceWrapperMember& other) { *this = other; } 50 TraceWrapperMember(const TraceWrapperMember& other) { *this = other; }
51 51
52 TraceWrapperMember& operator=(const TraceWrapperMember& other) { 52 TraceWrapperMember& operator=(const TraceWrapperMember& other) {
53 DCHECK(other.m_parent); 53 DCHECK(!other.m_raw || other.m_parent);
54 m_parent = other.m_parent; 54 m_parent = other.m_parent;
55 Member<T>::operator=(other); 55 Member<T>::operator=(other);
56 ScriptWrappableVisitor::writeBarrier(m_parent, other); 56 ScriptWrappableVisitor::writeBarrier(m_parent, other);
57 return *this; 57 return *this;
58 } 58 }
59 59
60 TraceWrapperMember& operator=(const Member<T>& other) { 60 TraceWrapperMember& operator=(const Member<T>& other) {
61 DCHECK(!traceWrapperMemberIsNotInitialized()); 61 DCHECK(!traceWrapperMemberIsNotInitialized());
62 Member<T>::operator=(other); 62 Member<T>::operator=(other);
63 ScriptWrappableVisitor::writeBarrier(m_parent, other); 63 ScriptWrappableVisitor::writeBarrier(m_parent, other);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 b.clear(); 138 b.clear();
139 b.reserveCapacity(temp.size()); 139 b.reserveCapacity(temp.size());
140 for (auto item : temp) { 140 for (auto item : temp) {
141 b.push_back(item.get()); 141 b.push_back(item.get());
142 } 142 }
143 } 143 }
144 144
145 } // namespace blink 145 } // namespace blink
146 146
147 #endif // TraceWrapperMember_h 147 #endif // TraceWrapperMember_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/TraceWrapperMemberTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698