Index: third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp |
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp |
index de14f7a56637d737bf52b3e482ddc5cb745a6008..83ba6adf45439a0583546f9b1e0f214cd0403864 100644 |
--- a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp |
+++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp |
@@ -158,9 +158,33 @@ bool CSSPrimitiveValue::colorIsDerivedFromElement() const |
} |
using CSSTextCache = WillBePersistentHeapHashMap<RawPtrWillBeWeakMember<const CSSPrimitiveValue>, String>; |
+ |
+#if ENABLE(OILPAN) && defined(LEAK_SANITIZER) |
+ |
+namespace { |
+// With LSan, wrap the persistent cache so that the registration of the |
+// (per-thread) static reference can be done. |
+class CSSTextCacheWrapper { |
+public: |
+ CSSTextCacheWrapper() |
+ { |
+ m_cache.registerAsStaticReference(); |
+ } |
+ |
+ operator CSSTextCache&() { return m_cache; } |
+ |
+private: |
+ CSSTextCache m_cache; |
+}; |
+ |
+} |
+#else |
+using CSSTextCacheWrapper = CSSTextCache; |
+#endif |
+ |
static CSSTextCache& cssTextCache() |
{ |
- AtomicallyInitializedStaticReference(ThreadSpecific<CSSTextCache>, cache, new ThreadSpecific<CSSTextCache>()); |
+ AtomicallyInitializedStaticReference(ThreadSpecific<CSSTextCacheWrapper>, cache, new ThreadSpecific<CSSTextCacheWrapper>); |
haraken
2015/12/06 23:56:21
Why do we need to use AtomicallyInitializedStaticR
sof
2015/12/07 06:04:58
It is needed due to the parser thread also using t
haraken
2015/12/07 06:09:24
Help me understand: Do we want to create two singl
|
return *cache; |
} |