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

Unified Diff: third_party/WebKit/Source/wtf/ThreadSpecific.h

Issue 2249353002: Stop calling blink::shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp 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 | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/ThreadSpecific.h
diff --git a/third_party/WebKit/Source/wtf/ThreadSpecific.h b/third_party/WebKit/Source/wtf/ThreadSpecific.h
index f16836fead6a716fa7243d678cba5683ddb1f367..2de240622e8d050f295a3dd31b2ed6735ca5fcc1 100644
--- a/third_party/WebKit/Source/wtf/ThreadSpecific.h
+++ b/third_party/WebKit/Source/wtf/ThreadSpecific.h
@@ -42,6 +42,7 @@
#ifndef WTF_ThreadSpecific_h
#define WTF_ThreadSpecific_h
+#include "wtf/AddressSanitizer.h"
#include "wtf/Allocator.h"
#include "wtf/Noncopyable.h"
#include "wtf/StdLibExtras.h"
@@ -155,6 +156,7 @@ inline void ThreadSpecific<T>::set(T* ptr)
{
ASSERT(!get());
pthread_setspecific(m_key, new Data(ptr, this));
+ __lsan_register_root_region(ptr, sizeof(Data));
}
#elif OS(WIN)
@@ -213,6 +215,7 @@ inline void ThreadSpecific<T>::set(T* ptr)
{
ASSERT(!get());
Data* data = new Data(ptr, this);
+ __lsan_register_root_region(ptr, sizeof(Data));
data->destructor = &ThreadSpecific<T>::destroy;
TlsSetValue(tlsKeys()[m_index], data);
}
@@ -224,7 +227,9 @@ inline void ThreadSpecific<T>::set(T* ptr)
template<typename T>
inline void ThreadSpecific<T>::destroy(void* ptr)
{
- if (isShutdown())
+ // Never call destructors on the main thread.
+ // This is fine because Blink no longer has a graceful shutdown sequence.
+ if (isMainThread())
return;
Data* data = static_cast<Data*>(ptr);
@@ -265,6 +270,7 @@ inline ThreadSpecific<T>::operator T*()
ptr = static_cast<T*>(Partitions::fastZeroedMalloc(sizeof(T), WTF_HEAP_PROFILER_TYPE_NAME(T)));
set(ptr);
new (NotNull, ptr) T;
+ __lsan_register_root_region(ptr, sizeof(T));
}
return ptr;
}
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698