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

Unified Diff: third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp

Issue 1491253004: Release Oilpan heap singletons prior to LSan leak detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move static-local ref registration to wtf/LeakAnnotations.h Created 5 years 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
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;
}

Powered by Google App Engine
This is Rietveld 408576698