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

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

Issue 2456293002: Stop calling Persistent::uninitialize after blink::shutdown is called. (Closed)
Patch Set: Created 4 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
« 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 // 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 Persistent_h 5 #ifndef Persistent_h
6 #define Persistent_h 6 #define Persistent_h
7 7
8 #include "platform/heap/Heap.h" 8 #include "platform/heap/Heap.h"
9 #include "platform/heap/Member.h" 9 #include "platform/heap/Member.h"
10 #include "platform/heap/PersistentNode.h" 10 #include "platform/heap/PersistentNode.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( ); 217 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( );
218 ASSERT(state->checkThread()); 218 ASSERT(state->checkThread());
219 m_persistentNode = state->getPersistentRegion()->allocatePersistentNode( this, traceCallback); 219 m_persistentNode = state->getPersistentRegion()->allocatePersistentNode( this, traceCallback);
220 #if ENABLE(ASSERT) 220 #if ENABLE(ASSERT)
221 m_state = state; 221 m_state = state;
222 #endif 222 #endif
223 } 223 }
224 224
225 void uninitialize() 225 void uninitialize()
226 { 226 {
227 // TODO(haraken): This is a short-term hack to prevent use-after-frees
228 // during a shutdown sequence.
229 // 1) blink::shutdown() frees the underlying storage for persistent node s.
230 // 2) ~MessageLoop() destructs some Chromium-side objects that hold
231 // Persistent. It touches the underlying storage and crashes.
232 if (WTF::isShutdown())
233 return;
234
227 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) { 235 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) {
228 if (acquireLoad(reinterpret_cast<void* volatile*>(&m_persistentNode) )) 236 if (acquireLoad(reinterpret_cast<void* volatile*>(&m_persistentNode) ))
229 ProcessHeap::crossThreadPersistentRegion().freePersistentNode(m_ persistentNode); 237 ProcessHeap::crossThreadPersistentRegion().freePersistentNode(m_ persistentNode);
230 return; 238 return;
231 } 239 }
232 240
233 if (!m_persistentNode) 241 if (!m_persistentNode)
234 return; 242 return;
235 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( ); 243 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( );
236 ASSERT(state->checkThread()); 244 ASSERT(state->checkThread());
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 770
763 template <typename T> 771 template <typename T>
764 struct IsWeakReceiver<blink::WeakPersistent<T>> : std::true_type {}; 772 struct IsWeakReceiver<blink::WeakPersistent<T>> : std::true_type {};
765 773
766 template <typename T> 774 template <typename T>
767 struct IsWeakReceiver<blink::CrossThreadWeakPersistent<T>> : std::true_type {}; 775 struct IsWeakReceiver<blink::CrossThreadWeakPersistent<T>> : std::true_type {};
768 776
769 } 777 }
770 778
771 #endif // Persistent_h 779 #endif // Persistent_h
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