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

Side by Side Diff: Source/platform/heap/Handle.h

Issue 1089763002: Oilpan: assert that new Persistents belong to Oilpan threads. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove assert in ~PersistentBase Created 5 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 | 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 m_prev->m_next = m_next; 172 m_prev->m_next = m_next;
173 } 173 }
174 174
175 protected: 175 protected:
176 inline PersistentBase() 176 inline PersistentBase()
177 : PersistentNode(TraceMethodDelegate<Owner, &Owner::trace>::trampoline) 177 : PersistentNode(TraceMethodDelegate<Owner, &Owner::trace>::trampoline)
178 #if ENABLE(ASSERT) 178 #if ENABLE(ASSERT)
179 , m_roots(RootsAccessor::roots()) 179 , m_roots(RootsAccessor::roots())
180 #endif 180 #endif
181 { 181 {
182 // Persistent must belong to a thread that will GC it.
183 ASSERT(m_roots == GlobalPersistents::roots() || ThreadState::current());
182 typename RootsAccessor::Lock lock; 184 typename RootsAccessor::Lock lock;
183 m_prev = RootsAccessor::roots(); 185 m_prev = RootsAccessor::roots();
184 m_next = m_prev->m_next; 186 m_next = m_prev->m_next;
185 m_prev->m_next = this; 187 m_prev->m_next = this;
186 m_next->m_prev = this; 188 m_next->m_prev = this;
187 } 189 }
188 190
189 inline explicit PersistentBase(const PersistentBase& otherref) 191 inline explicit PersistentBase(const PersistentBase& otherref)
190 : PersistentNode(otherref.m_trace) 192 : PersistentNode(otherref.m_trace)
191 #if ENABLE(ASSERT) 193 #if ENABLE(ASSERT)
192 , m_roots(RootsAccessor::roots()) 194 , m_roots(RootsAccessor::roots())
193 #endif 195 #endif
194 { 196 {
197 ASSERT(m_roots == GlobalPersistents::roots() || ThreadState::current());
195 // We don't support allocation of thread local Persistents while doing 198 // We don't support allocation of thread local Persistents while doing
196 // thread shutdown/cleanup. 199 // thread shutdown/cleanup.
197 ASSERT(!ThreadState::current()->isTerminating()); 200 ASSERT(!ThreadState::current()->isTerminating());
198 typename RootsAccessor::Lock lock; 201 typename RootsAccessor::Lock lock;
199 ASSERT(otherref.m_roots == m_roots); // Handles must belong to the same list. 202 ASSERT(otherref.m_roots == m_roots); // Handles must belong to the same list.
200 PersistentBase* other = const_cast<PersistentBase*>(&otherref); 203 PersistentBase* other = const_cast<PersistentBase*>(&otherref);
201 m_prev = other; 204 m_prev = other;
202 m_next = other->m_next; 205 m_next = other->m_next;
203 other->m_next = this; 206 other->m_next = this;
204 m_next->m_prev = this; 207 m_next->m_prev = this;
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 template<typename T> 1115 template<typename T>
1113 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin k::IsGarbageCollectedType<T>::value> { 1116 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin k::IsGarbageCollectedType<T>::value> {
1114 }; 1117 };
1115 1118
1116 template<typename T> 1119 template<typename T>
1117 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; 1120 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete;
1118 1121
1119 } // namespace WTF 1122 } // namespace WTF
1120 1123
1121 #endif 1124 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698