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

Side by Side Diff: third_party/WebKit/Source/platform/heap/Visitor.h

Issue 2592063002: SameThreadCheckedMember<>: verify same-thread usage of heap references. (Closed)
Patch Set: emphasize that the extended Member is for diagnosing/debugging Created 3 years, 12 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 | « third_party/WebKit/Source/platform/heap/TraceTraits.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 template <typename T> 45 template <typename T>
46 class GarbageCollected; 46 class GarbageCollected;
47 class HeapObjectHeader; 47 class HeapObjectHeader;
48 class InlinedGlobalMarkingVisitor; 48 class InlinedGlobalMarkingVisitor;
49 template <typename T> 49 template <typename T>
50 class TraceTrait; 50 class TraceTrait;
51 class ThreadState; 51 class ThreadState;
52 class Visitor; 52 class Visitor;
53 template <typename T> 53 template <typename T>
54 class SameThreadCheckedMember;
55 template <typename T>
54 class TraceWrapperMember; 56 class TraceWrapperMember;
55 57
56 // The TraceMethodDelegate is used to convert a trace method for type T to a 58 // The TraceMethodDelegate is used to convert a trace method for type T to a
57 // TraceCallback. This allows us to pass a type's trace method as a parameter 59 // TraceCallback. This allows us to pass a type's trace method as a parameter
58 // to the PersistentNode constructor. The PersistentNode constructor needs the 60 // to the PersistentNode constructor. The PersistentNode constructor needs the
59 // specific trace method due an issue with the Windows compiler which 61 // specific trace method due an issue with the Windows compiler which
60 // instantiates even unused variables. This causes problems 62 // instantiates even unused variables. This causes problems
61 // in header files where we have only forward declarations of classes. 63 // in header files where we have only forward declarations of classes.
62 template <typename T, void (T::*method)(Visitor*)> 64 template <typename T, void (T::*method)(Visitor*)>
63 struct TraceMethodDelegate { 65 struct TraceMethodDelegate {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 template <typename T> 158 template <typename T>
157 void trace(const Member<T>& t) { 159 void trace(const Member<T>& t) {
158 mark(t.get()); 160 mark(t.get());
159 } 161 }
160 162
161 template <typename T> 163 template <typename T>
162 void trace(const TraceWrapperMember<T>& t) { 164 void trace(const TraceWrapperMember<T>& t) {
163 trace(*(static_cast<const Member<T>*>(&t))); 165 trace(*(static_cast<const Member<T>*>(&t)));
164 } 166 }
165 167
168 template <typename T>
169 void trace(const SameThreadCheckedMember<T>& t) {
170 trace(*(static_cast<const Member<T>*>(&t)));
171 }
172
166 // Fallback method used only when we need to trace raw pointers of T. 173 // Fallback method used only when we need to trace raw pointers of T.
167 // This is the case when a member is a union where we do not support members. 174 // This is the case when a member is a union where we do not support members.
168 template <typename T> 175 template <typename T>
169 void trace(const T* t) { 176 void trace(const T* t) {
170 mark(const_cast<T*>(t)); 177 mark(const_cast<T*>(t));
171 } 178 }
172 template <typename T> 179 template <typename T>
173 void trace(T* t) { 180 void trace(T* t) {
174 mark(t); 181 mark(t);
175 } 182 }
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { 396 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) {
390 return static_cast<Visitor*>(helper); 397 return static_cast<Visitor*>(helper);
391 } 398 }
392 399
393 const MarkingMode m_markingMode; 400 const MarkingMode m_markingMode;
394 }; 401 };
395 402
396 } // namespace blink 403 } // namespace blink
397 404
398 #endif // Visitor_h 405 #endif // Visitor_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/TraceTraits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698