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

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

Issue 1411603007: [Oilpan] Add use-after-free detector in Member<> Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // non-live entries, so no entries will be removed. Since you can't set 89 // non-live entries, so no entries will be removed. Since you can't set
90 // the mark bit on a null pointer, that means that null pointers are 90 // the mark bit on a null pointer, that means that null pointers are
91 // always 'alive'. 91 // always 'alive'.
92 if (!object) 92 if (!object)
93 return true; 93 return true;
94 return ObjectAliveTrait<T>::isHeapObjectAlive(object); 94 return ObjectAliveTrait<T>::isHeapObjectAlive(object);
95 } 95 }
96 template<typename T> 96 template<typename T>
97 static inline bool isHeapObjectAlive(const Member<T>& member) 97 static inline bool isHeapObjectAlive(const Member<T>& member)
98 { 98 {
99 return isHeapObjectAlive(member.get()); 99 return isHeapObjectAlive(member.unsafeGet());
100 } 100 }
101 template<typename T> 101 template<typename T>
102 static inline bool isHeapObjectAlive(const WeakMember<T>& member) 102 static inline bool isHeapObjectAlive(const WeakMember<T>& member)
103 { 103 {
104 return isHeapObjectAlive(member.get()); 104 return isHeapObjectAlive(member.unsafeGet());
105 } 105 }
106 template<typename T> 106 template<typename T>
107 static inline bool isHeapObjectAlive(const UntracedMember<T>& member) 107 static inline bool isHeapObjectAlive(const UntracedMember<T>& member)
108 { 108 {
109 return isHeapObjectAlive(member.get()); 109 return isHeapObjectAlive(member.unsafeGet());
110 } 110 }
111 template<typename T> 111 template<typename T>
112 static inline bool isHeapObjectAlive(const RawPtr<T>& ptr) 112 static inline bool isHeapObjectAlive(const RawPtr<T>& ptr)
113 { 113 {
114 return isHeapObjectAlive(ptr.get()); 114 return isHeapObjectAlive(ptr.get());
115 } 115 }
116 116
117 // Is the finalizable GC object still alive, but slated for lazy sweeping? 117 // Is the finalizable GC object still alive, but slated for lazy sweeping?
118 // If a lazy sweep is in progress, returns true if the object was found 118 // If a lazy sweep is in progress, returns true if the object was found
119 // to be not reachable during the marking phase, but it has yet to be swept 119 // to be not reachable during the marking phase, but it has yet to be swept
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) 503 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object)
504 { 504 {
505 T** cell = reinterpret_cast<T**>(object); 505 T** cell = reinterpret_cast<T**>(object);
506 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) 506 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell))
507 *cell = nullptr; 507 *cell = nullptr;
508 } 508 }
509 509
510 } // namespace blink 510 } // namespace blink
511 511
512 #endif // Heap_h 512 #endif // Heap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698