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

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

Issue 2698673003: Call HeapObjectHeader::checkHeader solely for its side-effect. (Closed)
Patch Set: Use DCHECK on a bool instead of DCHECK_EQ. 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/platform/heap/GCInfo.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
11 namespace blink { 11 namespace blink {
12 12
13 class HeapObjectHeader; 13 class HeapObjectHeader;
14 template <typename T> 14 template <typename T>
15 class Member; 15 class Member;
16 16
17 /** 17 /**
18 * TraceWrapperMember is used for Member fields that should participate in 18 * TraceWrapperMember is used for Member fields that should participate in
19 * wrapper tracing, i.e., strongly hold a ScriptWrappable alive. All 19 * wrapper tracing, i.e., strongly hold a ScriptWrappable alive. All
20 * TraceWrapperMember fields must be traced in the class' traceWrappers method. 20 * TraceWrapperMember fields must be traced in the class' traceWrappers method.
21 */ 21 */
22 template <class T> 22 template <class T>
23 class TraceWrapperMember : public Member<T> { 23 class TraceWrapperMember : public Member<T> {
24 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 24 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
25 25
26 public: 26 public:
27 TraceWrapperMember(void* parent, T* raw) : Member<T>(raw), m_parent(parent) { 27 TraceWrapperMember(void* parent, T* raw) : Member<T>(raw), m_parent(parent) {
28 #if DCHECK_IS_ON() 28 #if DCHECK_IS_ON()
29 DCHECK(!m_parent || HeapObjectHeader::fromPayload(m_parent)->checkHeader()); 29 if (m_parent) {
30 HeapObjectHeader::fromPayload(m_parent)->checkHeader();
31 }
30 #endif 32 #endif
31 // We don't require a write barrier here as TraceWrapperMember is used for 33 // We don't require a write barrier here as TraceWrapperMember is used for
32 // the following scenarios: 34 // the following scenarios:
33 // - Initial initialization: The write barrier will not fire as the parent 35 // - Initial initialization: The write barrier will not fire as the parent
34 // is initially white. 36 // is initially white.
35 // - Wrapping when inserting into a container: The write barrier will fire 37 // - Wrapping when inserting into a container: The write barrier will fire
36 // upon establishing the move into the container. 38 // upon establishing the move into the container.
37 // - Assignment to a field: The regular assignment operator will fire the 39 // - Assignment to a field: The regular assignment operator will fire the
38 // write barrier. 40 // write barrier.
39 // Note that support for black allocation would require a barrier here. 41 // Note that support for black allocation would require a barrier here.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 b.clear(); 138 b.clear();
137 b.reserveCapacity(temp.size()); 139 b.reserveCapacity(temp.size());
138 for (auto item : temp) { 140 for (auto item : temp) {
139 b.push_back(item.get()); 141 b.push_back(item.get());
140 } 142 }
141 } 143 }
142 144
143 } // namespace blink 145 } // namespace blink
144 146
145 #endif // TraceWrapperMember_h 147 #endif // TraceWrapperMember_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/GCInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698