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

Unified Diff: third_party/WebKit/Source/platform/heap/Persistent.h

Issue 2257333003: Check thread is attached when creating a Persistent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/Persistent.h
diff --git a/third_party/WebKit/Source/platform/heap/Persistent.h b/third_party/WebKit/Source/platform/heap/Persistent.h
index b95a3f61578d82b9eeab4303e099e16cd007b68b..37399f545ca475db1e18cd29ce91cdf00fed7e81 100644
--- a/third_party/WebKit/Source/platform/heap/Persistent.h
+++ b/third_party/WebKit/Source/platform/heap/Persistent.h
@@ -246,13 +246,18 @@ private:
if (!m_raw || isHashTableDeletedValue())
return;
- if (crossThreadnessConfiguration != CrossThreadPersistentConfiguration && m_creationThreadState) {
+ if (crossThreadnessConfiguration != CrossThreadPersistentConfiguration) {
ThreadState* current = ThreadState::current();
DCHECK(current);
+ // m_creationThreadState may be null when this is used in a heap
+ // collection which initialized the Persistent with memset and the
+ // constructor wasn't called.
+ if (m_creationThreadState) {
haraken 2016/08/19 06:31:31 Maybe would it be worth distinguishing the two cas
// Member should point to objects that belong in the same ThreadHeap.
DCHECK_EQ(&ThreadState::fromObject(m_raw)->heap(), &m_creationThreadState->heap());
// Member should point to objects that belong in the same ThreadHeap.
DCHECK_EQ(&current->heap(), &m_creationThreadState->heap());
+ }
}
#if defined(ADDRESS_SANITIZER)
@@ -272,10 +277,12 @@ private:
void saveCreationThreadHeap()
{
#if DCHECK_IS_ON()
- if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration)
+ if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) {
m_creationThreadState = nullptr;
- else
+ } else {
m_creationThreadState = ThreadState::current();
+ DCHECK(m_creationThreadState);
+ }
#endif
}
« 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