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

Side by Side Diff: Source/platform/heap/PersistentNode.cpp

Issue 1271243003: CrossThreadPersistent invalidation: add missing orphaned check. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add unit test Created 5 years, 4 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 | « Source/platform/heap/HeapTest.cpp ('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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "config.h" 5 #include "config.h"
6 #include "platform/heap/PersistentNode.h" 6 #include "platform/heap/PersistentNode.h"
7 7
8 #include "platform/heap/Handle.h" 8 #include "platform/heap/Handle.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 continue; 112 continue;
113 113
114 // 'self' is in use, containing the cross-thread persistent wrapper object. 114 // 'self' is in use, containing the cross-thread persistent wrapper object.
115 CrossThreadPersistent<GCObject>* persistent = reinterpret_cast<Cross ThreadPersistent<GCObject>*>(slots->m_slot[i].self()); 115 CrossThreadPersistent<GCObject>* persistent = reinterpret_cast<Cross ThreadPersistent<GCObject>*>(slots->m_slot[i].self());
116 ASSERT(persistent); 116 ASSERT(persistent);
117 void* rawObject = persistent->get(); 117 void* rawObject = persistent->get();
118 if (!rawObject) 118 if (!rawObject)
119 continue; 119 continue;
120 BasePage* page = pageFromObject(rawObject); 120 BasePage* page = pageFromObject(rawObject);
121 ASSERT(page); 121 ASSERT(page);
122 // The main thread will upon detach just mark its heap pages as orph aned,
123 // but not invalidate its CrossThreadPersistent<>s.
124 if (page->orphaned())
125 continue;
122 if (page->heap()->threadState() == threadState) 126 if (page->heap()->threadState() == threadState)
haraken 2015/08/05 14:22:33 ah, page->heap() should be null for already orphan
123 persistent->clear(); 127 persistent->clear();
124 } 128 }
125 slots = slots->m_next; 129 slots = slots->m_next;
126 } 130 }
127 } 131 }
128 132
129 } // namespace blink 133 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698